
Research
/Security News
Shai Hulud Strikes Again (v2)
Another wave of Shai-Hulud campaign has hit npm with more than 500 packages and 700+ versions affected.
@wordpress/date
Advanced tools
Date module for WordPress.
Install the module
npm install @wordpress/date --save
This package assumes that your code will run in an ES2015+ environment. If you're using an environment that has limited or no support for such language features and APIs, you should include the polyfill shipped in @wordpress/babel-preset-default in your code.
Formats a date (like date() in PHP).
Related
Parameters
string: PHP-style formatting string. See php.net/date.Moment | Date | string | number: Date object or string, parsable by moment.js.string: Timezone to output result in or a UTC offset. Defaults to timezone from site.Returns
string: Formatted date in English.Formats a date (like wp_date() in PHP), translating it into site's locale.
Backward Compatibility Notice: if timezone is set to true, the function behaves like gmdateI18n.
Related
Parameters
string: PHP-style formatting string. See php.net/date.Moment | Date | string | number: Date object or string, parsable by moment.js.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
Formats a date. Does not alter the date's timezone.
Parameters
string: PHP-style formatting string. See php.net/date.Moment | Date | string | number: Date object or string, parsable by moment.js.Returns
Create and return a JavaScript Date Object from a date string in the WP timezone.
Parameters
string | null: Date formatted in the WP timezone.Returns
Returns the currently defined date settings.
Returns
DateSettings: Settings, including locale data.Formats a date (like date() in PHP), in the UTC timezone.
Parameters
string: PHP-style formatting string. See php.net/date.Moment | Date | string | number: Date object or string, parsable by moment.js.Returns
Formats a date (like wp_date() in PHP), translating it into site's locale and using the UTC timezone.
Parameters
string: PHP-style formatting string. See php.net/date.Moment | Date | string | number: Date object or string, parsable by moment.js.Returns
Returns a human-readable time difference between two dates, like human_time_diff() in PHP.
Parameters
Moment | Date | string | number: From date, in the WP timezone.Moment | Date | string | number: To date, formatted in the WP timezone.Returns
Check whether a date is considered in the future according to the WordPress settings.
Parameters
Date | string | number: Date String or Date object in the Defined WP Timezone.Returns
Adds a locale to moment, using the format supplied by wp_localize_script().
Parameters
DateSettings: Settings, including locale data.This is an individual package that's part of the Gutenberg project. The project is organized as a monorepo. It's made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to npm and used by WordPress as well as other software projects.
To find out more about contributing to this package or Gutenberg as a whole, please read the project's main contributor guide.

FAQs
Date module for WordPress.
The npm package @wordpress/date receives a total of 117,066 weekly downloads. As such, @wordpress/date popularity was classified as popular.
We found that @wordpress/date demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 23 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Another wave of Shai-Hulud campaign has hit npm with more than 500 packages and 700+ versions affected.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.