Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@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 | undefined
: Date object or string, parsable by moment.js.string | number | undefined
: 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 | undefined
: Date object or string, parsable by moment.js.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.Returns
string
: Formatted date.Formats a date. Does not alter the date's timezone.
Parameters
string
: PHP-style formatting string. See php.net/date.Moment | Date | string | undefined
: Date object or string, parsable by moment.js.Returns
string
: Formatted date.Create and return a JavaScript Date Object from a date string in the WP timezone.
Parameters
?string
: Date formatted in the WP timezone.Returns
Date
: DateReturns 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 | undefined
: Date object or string, parsable by moment.js.Returns
string
: Formatted date in English.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 | undefined
: Date object or string, parsable by moment.js.Returns
string
: Formatted date.Returns a human-readable time difference between two dates, like human_time_diff() in PHP.
Parameters
Moment | Date | string
: From date, in the WP timezone.Moment | Date | string | undefined
: To date, formatted in the WP timezone.Returns
string
: Human-readable time difference.Check whether a date is considered in the future according to the WordPress settings.
Parameters
string
: Date String or Date object in the Defined WP Timezone.Returns
boolean
: Is in the future.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 59,139 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.