Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/date/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Enhancements

- Improved TypeScript definitions ([67573](https://github.com/WordPress/gutenberg/pull/67573))

## 5.24.0 (2025-05-22)

## 5.23.0 (2025-05-07)
Expand Down
36 changes: 18 additions & 18 deletions packages/date/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ _Related_
_Parameters_

- _dateFormat_ `string`: PHP-style formatting string. See [php.net/date](https://www.php.net/manual/en/function.date.php).
- _dateValue_ `Moment | Date | string | undefined`: Date object or string, parsable by moment.js.
- _timezone_ `string | number | undefined`: Timezone to output result in or a UTC offset. Defaults to timezone from site.
- _dateValue_ `Moment | Date | string | number`: Date object or string, parsable by moment.js.
- _timezone_ `string`: Timezone to output result in or a UTC offset. Defaults to timezone from site.

_Returns_

Expand All @@ -49,12 +49,12 @@ _Related_
_Parameters_

- _dateFormat_ `string`: PHP-style formatting string. See [php.net/date](https://www.php.net/manual/en/function.date.php).
- _dateValue_ `Moment | Date | string | undefined`: Date object or string, parsable by moment.js.
- _timezone_ `string | number | boolean | undefined=`: Timezone to output result in or a UTC offset. Defaults to timezone from site. Notice: `boolean` is effectively deprecated, but still supported for backward compatibility reasons.
- _dateValue_ `Moment | Date | string | number`: Date object or string, parsable by moment.js.
- _timezone_ `string | number | boolean`: Timezone to output result in or a UTC offset. Defaults to timezone from site. Notice: `boolean` is effectively deprecated, but still supported for backward compatibility reasons.

_Returns_

- `string`: Formatted date.
- Formatted date.

### format

Expand All @@ -63,23 +63,23 @@ Formats a date. Does not alter the date's timezone.
_Parameters_

- _dateFormat_ `string`: PHP-style formatting string. See [php.net/date](https://www.php.net/manual/en/function.date.php).
- _dateValue_ `Moment | Date | string | undefined`: Date object or string, parsable by moment.js.
- _dateValue_ `Moment | Date | string | number`: Date object or string, parsable by moment.js.

_Returns_

- `string`: Formatted date.
- Formatted date.

### getDate

Create and return a JavaScript Date Object from a date string in the WP timezone.

_Parameters_

- _dateString_ `?string`: Date formatted in the WP timezone.
- _dateString_ `string | null`: Date formatted in the WP timezone.

_Returns_

- `Date`: Date
- Date

### getSettings

Expand All @@ -96,11 +96,11 @@ Formats a date (like `date()` in PHP), in the UTC timezone.
_Parameters_

- _dateFormat_ `string`: PHP-style formatting string. See [php.net/date](https://www.php.net/manual/en/function.date.php).
- _dateValue_ `Moment | Date | string | undefined`: Date object or string, parsable by moment.js.
- _dateValue_ `Moment | Date | string | number`: Date object or string, parsable by moment.js.

_Returns_

- `string`: Formatted date in English.
- Formatted date in English.

### gmdateI18n

Expand All @@ -109,36 +109,36 @@ Formats a date (like `wp_date()` in PHP), translating it into site's locale and
_Parameters_

- _dateFormat_ `string`: PHP-style formatting string. See [php.net/date](https://www.php.net/manual/en/function.date.php).
- _dateValue_ `Moment | Date | string | undefined`: Date object or string, parsable by moment.js.
- _dateValue_ `Moment | Date | string | number`: Date object or string, parsable by moment.js.

_Returns_

- `string`: Formatted date.
- Formatted date.

### humanTimeDiff

Returns a human-readable time difference between two dates, like human_time_diff() in PHP.

_Parameters_

- _from_ `Moment | Date | string`: From date, in the WP timezone.
- _to_ `Moment | Date | string | undefined`: To date, formatted in the WP timezone.
- _from_ `Moment | Date | string | number`: From date, in the WP timezone.
- _to_ `Moment | Date | string | number`: To date, formatted in the WP timezone.

_Returns_

- `string`: Human-readable time difference.
- Human-readable time difference.

### isInTheFuture

Check whether a date is considered in the future according to the WordPress settings.

_Parameters_

- _dateValue_ `string`: Date String or Date object in the Defined WP Timezone.
- _dateValue_ `Date | string`: Date String or Date object in the Defined WP Timezone.

_Returns_

- `boolean`: Is in the future.
- Is in the future.

### setSettings

Expand Down
Loading
Loading