Skip to content

Commit

Permalink
DateFormatPicker: Improve line breaks in JSDoc and README (WordPress#…
Browse files Browse the repository at this point in the history
…68006)

Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
  • Loading branch information
3 people authored and yogeshbhutkar committed Dec 18, 2024
1 parent 8c94287 commit 1f04074
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 28 deletions.
19 changes: 6 additions & 13 deletions packages/block-editor/src/components/date-format-picker/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
# DateFormatPicker

The `DateFormatPicker` component renders controls that let the user choose a
_date format_. That is, how they want their dates to be formatted.
The `DateFormatPicker` component renders controls that let the user choose a _date format_. That is, how they want their dates to be formatted.

A user can pick _Default_ to use the default date format (usually set at the
site level).
A user can pick _Default_ to use the default date format (usually set at the site level).

Otherwise, a user may choose a suggested date format or type in their own date
format by selecting _Custom_.
Otherwise, a user may choose a suggested date format or type in their own date format by selecting _Custom_.

All date format strings should be in the format accepted by by the [`dateI18n`
function in
`@wordpress/date`](https://github.com/WordPress/gutenberg/tree/trunk/packages/date#datei18n).
All date format strings should be in the format accepted by by the [`dateI18n` function in `@wordpress/date`](https://github.com/WordPress/gutenberg/tree/trunk/packages/date#datei18n).

## Usage

Expand Down Expand Up @@ -43,16 +38,14 @@ The current date format selected by the user. If `null`, _Default_ is selected.

### `defaultFormat`

The default format string. Used to show to the user what the date will look like
if _Default_ is selected.
The default format string. Used to show to the user what the date will look like if _Default_ is selected.

- Type: `string`
- Required: Yes

### `onChange`

Called when the user makes a selection, or when the user types in a date format.
`null` indicates that _Default_ is selected.
Called when the user makes a selection, or when the user types in a date format. `null` indicates that _Default_ is selected.

- Type: `( format: string|null ) => void`
- Required: Yes
19 changes: 4 additions & 15 deletions packages/block-editor/src/components/date-format-picker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,10 @@ if ( exampleDate.getMonth() === 4 ) {
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/date-format-picker/README.md
*
* @param {Object} props
* @param {string|null} props.format The selected date
* format. If
* `null`,
* _Default_ is
* selected.
* @param {string} props.defaultFormat The date format that
* will be used if the
* user selects
* 'Default'.
* @param {( format: string|null ) => void} props.onChange Called when a
* selection is
* made. If `null`,
* _Default_ is
* selected.
* @param {Object} props
* @param {string|null} props.format The selected date format. If `null`, _Default_ is selected.
* @param {string} props.defaultFormat The date format that will be used if the user selects 'Default'.
* @param {Function} props.onChange Called when a selection is made. If `null`, _Default_ is selected.
*/
export default function DateFormatPicker( {
format,
Expand Down

0 comments on commit 1f04074

Please sign in to comment.