@wordpress/date 5.46.0 → 5.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 5.47.0 (2026-05-27)
6
+
5
7
  ## 5.46.0 (2026-05-14)
6
8
 
7
9
  ## 5.45.0 (2026-04-29)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport type { Moment } from 'moment';\nimport momentLib from 'moment';\nimport 'moment-timezone/moment-timezone.js';\nimport 'moment-timezone/moment-timezone-utils.js';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n/**\n * Internal dependencies\n */\nimport type { DateSettings } from './types';\n\nexport type * from './types';\n\nconst WP_ZONE = 'WP';\n\n// This regular expression tests positive for UTC offsets as described in ISO 8601.\n// See: https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\nconst VALID_UTC_OFFSET = /^[+-][0-1][0-9](:?[0-9][0-9])?$/;\n\n// Changes made here will likely need to be synced with Core in the file\n// src/wp-includes/script-loader.php in `wp_default_packages_inline_scripts()`.\nlet settings: DateSettings = {\n\tl10n: {\n\t\tlocale: 'en',\n\t\tmonths: [\n\t\t\t'January',\n\t\t\t'February',\n\t\t\t'March',\n\t\t\t'April',\n\t\t\t'May',\n\t\t\t'June',\n\t\t\t'July',\n\t\t\t'August',\n\t\t\t'September',\n\t\t\t'October',\n\t\t\t'November',\n\t\t\t'December',\n\t\t],\n\t\tmonthsShort: [\n\t\t\t'Jan',\n\t\t\t'Feb',\n\t\t\t'Mar',\n\t\t\t'Apr',\n\t\t\t'May',\n\t\t\t'Jun',\n\t\t\t'Jul',\n\t\t\t'Aug',\n\t\t\t'Sep',\n\t\t\t'Oct',\n\t\t\t'Nov',\n\t\t\t'Dec',\n\t\t],\n\t\tweekdays: [\n\t\t\t'Sunday',\n\t\t\t'Monday',\n\t\t\t'Tuesday',\n\t\t\t'Wednesday',\n\t\t\t'Thursday',\n\t\t\t'Friday',\n\t\t\t'Saturday',\n\t\t],\n\t\tweekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],\n\t\tmeridiem: { am: 'am', pm: 'pm', AM: 'AM', PM: 'PM' },\n\t\trelative: {\n\t\t\tfuture: '%s from now',\n\t\t\tpast: '%s ago',\n\t\t\ts: 'a few seconds',\n\t\t\tss: '%d seconds',\n\t\t\tm: 'a minute',\n\t\t\tmm: '%d minutes',\n\t\t\th: 'an hour',\n\t\t\thh: '%d hours',\n\t\t\td: 'a day',\n\t\t\tdd: '%d days',\n\t\t\tM: 'a month',\n\t\t\tMM: '%d months',\n\t\t\ty: 'a year',\n\t\t\tyy: '%d years',\n\t\t},\n\t\tstartOfWeek: 0,\n\t},\n\tformats: {\n\t\ttime: 'g:i a',\n\t\tdate: 'F j, Y',\n\t\tdatetime: 'F j, Y g:i a',\n\t\tdatetimeAbbreviated: 'M j, Y g:i a',\n\t},\n\ttimezone: { offset: 0, offsetFormatted: '0', string: '', abbr: '' },\n};\n\n/**\n * Adds a locale to moment, using the format supplied by `wp_localize_script()`.\n *\n * @param dateSettings Settings, including locale data.\n */\nexport function setSettings( dateSettings: DateSettings ) {\n\tsettings = dateSettings;\n\n\tsetupWPTimezone();\n\n\t// Does moment already have a locale with the right name?\n\tif ( momentLib.locales().includes( dateSettings.l10n.locale ) ) {\n\t\t// Is that locale misconfigured, e.g. because we are on a site running\n\t\t// WordPress < 6.0?\n\t\tif (\n\t\t\tmomentLib\n\t\t\t\t.localeData( dateSettings.l10n.locale )\n\t\t\t\t.longDateFormat( 'LTS' ) === null\n\t\t) {\n\t\t\t// Delete the misconfigured locale.\n\t\t\t// @ts-ignore Type definitions are incorrect - null is permitted.\n\t\t\tmomentLib.defineLocale( dateSettings.l10n.locale, null );\n\t\t} else {\n\t\t\t// We have a properly configured locale, so no need to create one.\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// defineLocale() will modify the current locale, so back it up.\n\tconst currentLocale = momentLib.locale();\n\n\t// Create locale.\n\tmomentLib.defineLocale( dateSettings.l10n.locale, {\n\t\t// Inherit anything missing from English. We don't load\n\t\t// moment-with-locales.js so English is all there is.\n\t\tparentLocale: 'en',\n\t\tmonths: dateSettings.l10n.months,\n\t\tmonthsShort: dateSettings.l10n.monthsShort,\n\t\tweekdays: dateSettings.l10n.weekdays,\n\t\tweekdaysShort: dateSettings.l10n.weekdaysShort,\n\t\tmeridiem( hour, minute, isLowercase ) {\n\t\t\tif ( hour < 12 ) {\n\t\t\t\treturn isLowercase\n\t\t\t\t\t? dateSettings.l10n.meridiem.am\n\t\t\t\t\t: dateSettings.l10n.meridiem.AM;\n\t\t\t}\n\t\t\treturn isLowercase\n\t\t\t\t? dateSettings.l10n.meridiem.pm\n\t\t\t\t: dateSettings.l10n.meridiem.PM;\n\t\t},\n\t\tlongDateFormat: {\n\t\t\tLT: dateSettings.formats.time,\n\t\t\tLTS: momentLib.localeData( 'en' ).longDateFormat( 'LTS' ),\n\t\t\tL: momentLib.localeData( 'en' ).longDateFormat( 'L' ),\n\t\t\tLL: dateSettings.formats.date,\n\t\t\tLLL: dateSettings.formats.datetime,\n\t\t\tLLLL: momentLib.localeData( 'en' ).longDateFormat( 'LLLL' ),\n\t\t},\n\t\t// From human_time_diff?\n\t\t// Set to `(number, withoutSuffix, key, isFuture) => {}` instead.\n\t\trelativeTime: dateSettings.l10n.relative,\n\t} );\n\n\t// Restore the locale to what it was.\n\tmomentLib.locale( currentLocale );\n}\n\n/**\n * Returns the currently defined date settings.\n *\n * @return {DateSettings} Settings, including locale data.\n */\nexport function getSettings() {\n\treturn settings;\n}\n\n/**\n * Returns the currently defined date settings.\n *\n * @deprecated\n * @return {DateSettings} Settings, including locale data.\n */\nexport function __experimentalGetSettings() {\n\tdeprecated( 'wp.date.__experimentalGetSettings', {\n\t\tsince: '6.1',\n\t\talternative: 'wp.date.getSettings',\n\t} );\n\treturn getSettings();\n}\n\n// Cached packed zone string, used to re-add the WP zone without requiring\n// moment-timezone-utils (which provides .pack()) after a third-party plugin\n// reloads moment-timezone and destroys both the zone and the utils.\nlet wpZonePacked: string | undefined;\n\n/**\n * Ensures the custom WP timezone zone exists in moment-timezone's registry.\n *\n * Third-party plugins (e.g. WooCommerce) may load their own copy of\n * moment-timezone, which reinitializes the internal zone storage and\n * destroys the custom 'WP' zone. This function checks for the zone's\n * existence and re-creates it if necessary.\n */\nfunction ensureWPTimezone() {\n\tif ( ! momentLib.tz.zone( WP_ZONE ) ) {\n\t\tif ( wpZonePacked ) {\n\t\t\tmomentLib.tz.add( wpZonePacked );\n\t\t} else {\n\t\t\tsetupWPTimezone();\n\t\t}\n\t}\n}\n\nfunction setupWPTimezone() {\n\t// Get the current timezone settings from the WP timezone string.\n\tconst currentTimezone = momentLib.tz.zone( settings.timezone.string );\n\n\tlet packed;\n\t// Check to see if we have a valid TZ data, if so, use it for the custom WP_ZONE timezone, otherwise just use the offset.\n\tif ( currentTimezone ) {\n\t\t// Create WP timezone based off settings.timezone.string. We need to include the additional data so that we\n\t\t// don't lose information about daylight savings time and other items.\n\t\t// See https://github.com/WordPress/gutenberg/pull/48083\n\t\tpacked = momentLib.tz.pack( {\n\t\t\tname: WP_ZONE,\n\t\t\tabbrs: currentTimezone.abbrs,\n\t\t\tuntils: currentTimezone.untils,\n\t\t\toffsets: currentTimezone.offsets,\n\t\t} );\n\t} else {\n\t\t// Create WP timezone based off dateSettings.\n\t\tpacked = momentLib.tz.pack( {\n\t\t\tname: WP_ZONE,\n\t\t\tabbrs: [ WP_ZONE ],\n\t\t\tuntils: [ null ],\n\t\t\toffsets: [ -settings.timezone.offset * 60 || 0 ],\n\t\t} );\n\t}\n\n\twpZonePacked = packed;\n\tmomentLib.tz.add( packed );\n}\n\n// Date constants.\n/**\n * Number of seconds in one minute.\n */\nconst MINUTE_IN_SECONDS = 60;\n/**\n * Number of minutes in one hour.\n */\nconst HOUR_IN_MINUTES = 60;\n/**\n * Number of seconds in one hour.\n */\nconst HOUR_IN_SECONDS = 60 * MINUTE_IN_SECONDS;\n\n/**\n * Map of PHP formats to Moment.js formats.\n *\n * These are used internally by {@link format}, and are either\n * a string representing the corresponding Moment.js format code, or a\n * function which returns the formatted string.\n *\n * This should only be used through {@link format}, not\n * directly.\n */\nconst formatMap = {\n\t// Day.\n\td: 'DD',\n\tD: 'ddd',\n\tj: 'D',\n\tl: 'dddd',\n\tN: 'E',\n\n\t/**\n\t * Gets the ordinal suffix.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tS( momentDate: Moment ) {\n\t\t// Do - D.\n\t\tconst num = momentDate.format( 'D' );\n\t\tconst withOrdinal = momentDate.format( 'Do' );\n\t\treturn withOrdinal.replace( num, '' );\n\t},\n\n\tw: 'd',\n\t/**\n\t * Gets the day of the year (zero-indexed).\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tz( momentDate: Moment ) {\n\t\t// DDD - 1.\n\t\treturn ( parseInt( momentDate.format( 'DDD' ), 10 ) - 1 ).toString();\n\t},\n\n\t// Week.\n\tW: 'W',\n\n\t// Month.\n\tF: 'MMMM',\n\tm: 'MM',\n\tM: 'MMM',\n\tn: 'M',\n\t/**\n\t * Gets the days in the month.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tt( momentDate: Moment ) {\n\t\treturn momentDate.daysInMonth();\n\t},\n\n\t// Year.\n\t/**\n\t * Gets whether the current year is a leap year.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tL( momentDate: Moment ) {\n\t\treturn momentDate.isLeapYear() ? '1' : '0';\n\t},\n\to: 'GGGG',\n\tY: 'YYYY',\n\ty: 'YY',\n\n\t// Time.\n\ta: 'a',\n\tA: 'A',\n\t/**\n\t * Gets the current time in Swatch Internet Time (.beats).\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tB( momentDate: Moment ) {\n\t\tconst timezoned = momentLib( momentDate ).utcOffset( 60 );\n\t\tconst seconds = parseInt( timezoned.format( 's' ), 10 ),\n\t\t\tminutes = parseInt( timezoned.format( 'm' ), 10 ),\n\t\t\thours = parseInt( timezoned.format( 'H' ), 10 );\n\t\treturn parseInt(\n\t\t\t(\n\t\t\t\t( seconds +\n\t\t\t\t\tminutes * MINUTE_IN_SECONDS +\n\t\t\t\t\thours * HOUR_IN_SECONDS ) /\n\t\t\t\t86.4\n\t\t\t).toString(),\n\t\t\t10\n\t\t);\n\t},\n\tg: 'h',\n\tG: 'H',\n\th: 'hh',\n\tH: 'HH',\n\ti: 'mm',\n\ts: 'ss',\n\tu: 'SSSSSS',\n\tv: 'SSS',\n\t// Timezone.\n\te: 'zz',\n\t/**\n\t * Gets whether the timezone is in DST currently.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tI( momentDate: Moment ) {\n\t\treturn momentDate.isDST() ? '1' : '0';\n\t},\n\tO: 'ZZ',\n\tP: 'Z',\n\tT: 'z',\n\t/**\n\t * Gets the timezone offset in seconds.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tZ( momentDate: Moment ) {\n\t\t// Timezone offset in seconds.\n\t\tconst offset = momentDate.format( 'Z' );\n\t\tconst sign = offset[ 0 ] === '-' ? -1 : 1;\n\t\tconst parts = offset\n\t\t\t.substring( 1 )\n\t\t\t.split( ':' )\n\t\t\t.map( ( n ) => parseInt( n, 10 ) );\n\t\treturn (\n\t\t\tsign *\n\t\t\t( parts[ 0 ] * HOUR_IN_MINUTES + parts[ 1 ] ) *\n\t\t\tMINUTE_IN_SECONDS\n\t\t);\n\t},\n\t// Full date/time.\n\tc: 'YYYY-MM-DDTHH:mm:ssZ', // .toISOString.\n\t/**\n\t * Formats the date as RFC2822.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tr( momentDate: Moment ) {\n\t\treturn momentDate\n\t\t\t.locale( 'en' )\n\t\t\t.format( 'ddd, DD MMM YYYY HH:mm:ss ZZ' );\n\t},\n\tU: 'X',\n};\n\n/**\n * Formats a date. Does not alter the date's timezone.\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return Formatted date.\n */\nexport function format(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date()\n) {\n\tlet i, char;\n\tconst newFormat = [];\n\tconst momentDate = momentLib( dateValue );\n\tfor ( i = 0; i < dateFormat.length; i++ ) {\n\t\tchar = dateFormat[ i ];\n\t\t// Is this an escape?\n\t\tif ( '\\\\' === char ) {\n\t\t\t// Add next character, then move on.\n\t\t\ti++;\n\t\t\tnewFormat.push( '[' + dateFormat[ i ] + ']' );\n\t\t\tcontinue;\n\t\t}\n\t\tif ( char in formatMap ) {\n\t\t\tconst formatter = formatMap[ char as keyof typeof formatMap ];\n\t\t\tif ( typeof formatter !== 'string' ) {\n\t\t\t\t// If the format is a function, call it.\n\t\t\t\tnewFormat.push( '[' + formatter( momentDate ) + ']' );\n\t\t\t} else {\n\t\t\t\t// Otherwise, add as a formatting string.\n\t\t\t\tnewFormat.push( formatter );\n\t\t\t}\n\t\t} else {\n\t\t\tnewFormat.push( '[' + char + ']' );\n\t\t}\n\t}\n\t// Join with [] between to separate characters, and replace\n\t// unneeded separators with static text.\n\treturn momentDate.format( newFormat.join( '[]' ) );\n}\n\n/**\n * Formats a date (like `date()` in PHP).\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string, parsable\n * by moment.js.\n * @param timezone Timezone to output result in or a\n * UTC offset. Defaults to timezone from\n * site.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return {string} Formatted date in English.\n */\nexport function date(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date(),\n\ttimezone?: string\n) {\n\tconst dateMoment = buildMoment( dateValue, timezone );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `date()` in PHP), in the UTC timezone.\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return Formatted date in English.\n */\nexport function gmdate(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date()\n) {\n\tconst dateMoment = momentLib( dateValue ).utc();\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `wp_date()` in PHP), translating it into site's locale.\n *\n * Backward Compatibility Notice: if `timezone` is set to `true`, the function\n * behaves like `gmdateI18n`.\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string, parsable by\n * moment.js.\n * @param timezone Timezone to output result in or a\n * UTC offset. Defaults to timezone from\n * site. Notice: `boolean` is effectively\n * deprecated, but still supported for\n * backward compatibility reasons.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return Formatted date.\n */\nexport function dateI18n(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date(),\n\ttimezone?: string | number | boolean\n) {\n\tif ( true === timezone ) {\n\t\treturn gmdateI18n( dateFormat, dateValue );\n\t}\n\n\tif ( false === timezone ) {\n\t\ttimezone = undefined;\n\t}\n\n\tconst dateMoment = buildMoment( dateValue, timezone );\n\tdateMoment.locale( settings.l10n.locale );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `wp_date()` in PHP), translating it into site's locale\n * and using the UTC timezone.\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return Formatted date.\n */\nexport function gmdateI18n(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date()\n) {\n\tconst dateMoment = momentLib( dateValue ).utc();\n\tdateMoment.locale( settings.l10n.locale );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Check whether a date is considered in the future according to the WordPress settings.\n *\n * @param dateValue Date String or Date object in the Defined WP Timezone.\n *\n * @return Is in the future.\n */\nexport function isInTheFuture( dateValue: Date | string | number ) {\n\tensureWPTimezone();\n\tconst now = momentLib.tz( WP_ZONE );\n\tconst momentObject = momentLib.tz( dateValue, WP_ZONE );\n\n\treturn momentObject.isAfter( now );\n}\n\n/**\n * Create and return a JavaScript Date Object from a date string in the WP timezone.\n *\n * @param dateString Date formatted in the WP timezone.\n *\n * @return Date\n */\nexport function getDate( dateString?: string | null ) {\n\tensureWPTimezone();\n\tif ( ! dateString ) {\n\t\treturn momentLib.tz( WP_ZONE ).toDate();\n\t}\n\n\treturn momentLib.tz( dateString, WP_ZONE ).toDate();\n}\n\n/**\n * Returns a human-readable time difference between two dates, like human_time_diff() in PHP.\n *\n * @param from From date, in the WP timezone.\n * @param to To date, formatted in the WP timezone.\n *\n * @return Human-readable time difference.\n */\nexport function humanTimeDiff(\n\tfrom: Moment | Date | string | number,\n\tto?: Moment | Date | string | number\n) {\n\tensureWPTimezone();\n\tconst fromMoment = momentLib.tz( from, WP_ZONE );\n\tconst toMoment = to ? momentLib.tz( to, WP_ZONE ) : momentLib.tz( WP_ZONE );\n\treturn fromMoment.from( toMoment );\n}\n\n/**\n * Creates a moment instance using the given timezone or, if none is provided, using global settings.\n *\n * @param dateValue Date object or string, parsable\n * by moment.js.\n * @param timezone Timezone to output result in or a\n * UTC offset. Defaults to timezone from\n * site.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return A moment instance.\n */\nfunction buildMoment(\n\tdateValue?: Moment | Date | string | number,\n\ttimezone: string | number = ''\n) {\n\tconst dateMoment = momentLib( dateValue );\n\n\tif ( timezone !== '' ) {\n\t\treturn isUTCOffset( timezone )\n\t\t\t? dateMoment.utcOffset( timezone )\n\t\t\t: // A false isUTCOffset() guarantees that timezone is a string.\n\t\t\t dateMoment.tz( timezone as string );\n\t}\n\n\tif ( settings.timezone.string ) {\n\t\treturn dateMoment.tz( settings.timezone.string );\n\t}\n\n\treturn dateMoment.utcOffset( +settings.timezone.offset );\n}\n\n/**\n * Returns whether a certain UTC offset is valid or not.\n *\n * @param offset a UTC offset.\n *\n * @return whether a certain UTC offset is valid or not.\n */\nfunction isUTCOffset( offset: number | string ) {\n\tif ( 'number' === typeof offset ) {\n\t\treturn true;\n\t}\n\n\treturn VALID_UTC_OFFSET.test( offset );\n}\n\nsetupWPTimezone();\n"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport type { Moment } from 'moment';\nimport momentLib from 'moment';\nimport 'moment-timezone/moment-timezone.js';\nimport 'moment-timezone/moment-timezone-utils.js';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n/**\n * Internal dependencies\n */\nimport type { DateSettings } from './types';\n\nexport type * from './types';\n\nconst WP_ZONE = 'WP';\n\n// This regular expression tests positive for UTC offsets as described in ISO 8601.\n// See: https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\nconst VALID_UTC_OFFSET = /^[+-][0-1][0-9](:?[0-9][0-9])?$/;\n\n// Changes made here will likely need to be synced with Core in the file\n// src/wp-includes/script-loader.php in `wp_default_packages_inline_scripts()`.\nlet settings: DateSettings = {\n\tl10n: {\n\t\tlocale: 'en',\n\t\tmonths: [\n\t\t\t'January',\n\t\t\t'February',\n\t\t\t'March',\n\t\t\t'April',\n\t\t\t'May',\n\t\t\t'June',\n\t\t\t'July',\n\t\t\t'August',\n\t\t\t'September',\n\t\t\t'October',\n\t\t\t'November',\n\t\t\t'December',\n\t\t],\n\t\tmonthsShort: [\n\t\t\t'Jan',\n\t\t\t'Feb',\n\t\t\t'Mar',\n\t\t\t'Apr',\n\t\t\t'May',\n\t\t\t'Jun',\n\t\t\t'Jul',\n\t\t\t'Aug',\n\t\t\t'Sep',\n\t\t\t'Oct',\n\t\t\t'Nov',\n\t\t\t'Dec',\n\t\t],\n\t\tweekdays: [\n\t\t\t'Sunday',\n\t\t\t'Monday',\n\t\t\t'Tuesday',\n\t\t\t'Wednesday',\n\t\t\t'Thursday',\n\t\t\t'Friday',\n\t\t\t'Saturday',\n\t\t],\n\t\tweekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],\n\t\tmeridiem: { am: 'am', pm: 'pm', AM: 'AM', PM: 'PM' },\n\t\trelative: {\n\t\t\tfuture: '%s from now',\n\t\t\tpast: '%s ago',\n\t\t\ts: 'a few seconds',\n\t\t\tss: '%d seconds',\n\t\t\tm: 'a minute',\n\t\t\tmm: '%d minutes',\n\t\t\th: 'an hour',\n\t\t\thh: '%d hours',\n\t\t\td: 'a day',\n\t\t\tdd: '%d days',\n\t\t\tM: 'a month',\n\t\t\tMM: '%d months',\n\t\t\ty: 'a year',\n\t\t\tyy: '%d years',\n\t\t},\n\t\tstartOfWeek: 0,\n\t},\n\tformats: {\n\t\ttime: 'g:i a',\n\t\tdate: 'F j, Y',\n\t\tdatetime: 'F j, Y g:i a',\n\t\tdatetimeAbbreviated: 'M j, Y g:i a',\n\t},\n\ttimezone: { offset: 0, offsetFormatted: '0', string: '', abbr: '' },\n};\n\n/**\n * Adds a locale to moment, using the format supplied by `wp_localize_script()`.\n *\n * @param dateSettings Settings, including locale data.\n */\nexport function setSettings( dateSettings: DateSettings ) {\n\tsettings = dateSettings;\n\n\tsetupWPTimezone();\n\n\t// Does moment already have a locale with the right name?\n\tif ( momentLib.locales().includes( dateSettings.l10n.locale ) ) {\n\t\t// Is that locale misconfigured, e.g. because we are on a site running\n\t\t// WordPress < 6.0?\n\t\tif (\n\t\t\tmomentLib\n\t\t\t\t.localeData( dateSettings.l10n.locale )\n\t\t\t\t.longDateFormat( 'LTS' ) === null\n\t\t) {\n\t\t\t// Delete the misconfigured locale.\n\t\t\t// @ts-ignore Type definitions are incorrect - null is permitted.\n\t\t\tmomentLib.defineLocale( dateSettings.l10n.locale, null );\n\t\t} else {\n\t\t\t// We have a properly configured locale, so no need to create one.\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// defineLocale() will modify the current locale, so back it up.\n\tconst currentLocale = momentLib.locale();\n\n\t// Create locale.\n\tmomentLib.defineLocale( dateSettings.l10n.locale, {\n\t\t// Inherit anything missing from English. We don't load\n\t\t// moment-with-locales.js so English is all there is.\n\t\tparentLocale: 'en',\n\t\tmonths: dateSettings.l10n.months,\n\t\tmonthsShort: dateSettings.l10n.monthsShort,\n\t\tweekdays: dateSettings.l10n.weekdays,\n\t\tweekdaysShort: dateSettings.l10n.weekdaysShort,\n\t\tmeridiem( hour, minute, isLowercase ) {\n\t\t\tif ( hour < 12 ) {\n\t\t\t\treturn isLowercase\n\t\t\t\t\t? dateSettings.l10n.meridiem.am\n\t\t\t\t\t: dateSettings.l10n.meridiem.AM;\n\t\t\t}\n\t\t\treturn isLowercase\n\t\t\t\t? dateSettings.l10n.meridiem.pm\n\t\t\t\t: dateSettings.l10n.meridiem.PM;\n\t\t},\n\t\tlongDateFormat: {\n\t\t\tLT: dateSettings.formats.time,\n\t\t\tLTS: momentLib.localeData( 'en' ).longDateFormat( 'LTS' ),\n\t\t\tL: momentLib.localeData( 'en' ).longDateFormat( 'L' ),\n\t\t\tLL: dateSettings.formats.date,\n\t\t\tLLL: dateSettings.formats.datetime,\n\t\t\tLLLL: momentLib.localeData( 'en' ).longDateFormat( 'LLLL' ),\n\t\t},\n\t\t// From human_time_diff?\n\t\t// Set to `(number, withoutSuffix, key, isFuture) => {}` instead.\n\t\trelativeTime: dateSettings.l10n.relative,\n\t} );\n\n\t// Restore the locale to what it was.\n\tmomentLib.locale( currentLocale );\n}\n\n/**\n * Returns the currently defined date settings.\n *\n * @return {DateSettings} Settings, including locale data.\n */\nexport function getSettings() {\n\treturn settings;\n}\n\n/**\n * Returns the currently defined date settings.\n *\n * @deprecated\n * @return {DateSettings} Settings, including locale data.\n */\nexport function __experimentalGetSettings() {\n\tdeprecated( 'wp.date.__experimentalGetSettings', {\n\t\tsince: '6.1',\n\t\talternative: 'wp.date.getSettings',\n\t} );\n\treturn getSettings();\n}\n\n// Cached packed zone string, used to re-add the WP zone without requiring\n// moment-timezone-utils (which provides .pack()) after a third-party plugin\n// reloads moment-timezone and destroys both the zone and the utils.\nlet wpZonePacked: string | undefined;\n\n/**\n * Ensures the custom WP timezone zone exists in moment-timezone's registry.\n *\n * Third-party plugins (e.g. WooCommerce) may load their own copy of\n * moment-timezone, which reinitializes the internal zone storage and\n * destroys the custom 'WP' zone. This function checks for the zone's\n * existence and re-creates it if necessary.\n */\nfunction ensureWPTimezone() {\n\tif ( ! momentLib.tz.zone( WP_ZONE ) ) {\n\t\tif ( wpZonePacked ) {\n\t\t\tmomentLib.tz.add( wpZonePacked );\n\t\t} else {\n\t\t\tsetupWPTimezone();\n\t\t}\n\t}\n}\n\nfunction setupWPTimezone() {\n\t// Get the current timezone settings from the WP timezone string.\n\tconst currentTimezone = momentLib.tz.zone( settings.timezone.string );\n\n\tlet packed;\n\t// Check to see if we have a valid TZ data, if so, use it for the custom WP_ZONE timezone, otherwise just use the offset.\n\tif ( currentTimezone ) {\n\t\t// Create WP timezone based off settings.timezone.string. We need to include the additional data so that we\n\t\t// don't lose information about daylight savings time and other items.\n\t\t// See https://github.com/WordPress/gutenberg/pull/48083\n\t\tpacked = momentLib.tz.pack( {\n\t\t\tname: WP_ZONE,\n\t\t\tabbrs: currentTimezone.abbrs,\n\t\t\tuntils: currentTimezone.untils,\n\t\t\toffsets: currentTimezone.offsets,\n\t\t} );\n\t} else {\n\t\t// Create WP timezone based off dateSettings.\n\t\tpacked = momentLib.tz.pack( {\n\t\t\tname: WP_ZONE,\n\t\t\tabbrs: [ WP_ZONE ],\n\t\t\tuntils: [ null ],\n\t\t\toffsets: [ -settings.timezone.offset * 60 || 0 ],\n\t\t} );\n\t}\n\n\twpZonePacked = packed;\n\tmomentLib.tz.add( packed );\n}\n\n// Date constants.\n/**\n * Number of seconds in one minute.\n */\nconst MINUTE_IN_SECONDS = 60;\n/**\n * Number of minutes in one hour.\n */\nconst HOUR_IN_MINUTES = 60;\n/**\n * Number of seconds in one hour.\n */\nconst HOUR_IN_SECONDS = 60 * MINUTE_IN_SECONDS;\n\n/**\n * Map of PHP formats to Moment.js formats.\n *\n * These are used internally by {@link format}, and are either\n * a string representing the corresponding Moment.js format code, or a\n * function which returns the formatted string.\n *\n * This should only be used through {@link format}, not\n * directly.\n */\nconst formatMap = {\n\t// Day.\n\td: 'DD',\n\tD: 'ddd',\n\tj: 'D',\n\tl: 'dddd',\n\tN: 'E',\n\n\t/**\n\t * Gets the ordinal suffix.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tS( momentDate: Moment ) {\n\t\t// Do - D.\n\t\tconst num = momentDate.format( 'D' );\n\t\tconst withOrdinal = momentDate.format( 'Do' );\n\t\treturn withOrdinal.replace( num, '' );\n\t},\n\n\tw: 'd',\n\t/**\n\t * Gets the day of the year (zero-indexed).\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tz( momentDate: Moment ) {\n\t\t// DDD - 1.\n\t\treturn ( parseInt( momentDate.format( 'DDD' ), 10 ) - 1 ).toString();\n\t},\n\n\t// Week.\n\tW: 'W',\n\n\t// Month.\n\tF: 'MMMM',\n\tm: 'MM',\n\tM: 'MMM',\n\tn: 'M',\n\t/**\n\t * Gets the days in the month.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tt( momentDate: Moment ) {\n\t\treturn momentDate.daysInMonth();\n\t},\n\n\t// Year.\n\t/**\n\t * Gets whether the current year is a leap year.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tL( momentDate: Moment ) {\n\t\treturn momentDate.isLeapYear() ? '1' : '0';\n\t},\n\to: 'GGGG',\n\tY: 'YYYY',\n\ty: 'YY',\n\n\t// Time.\n\ta: 'a',\n\tA: 'A',\n\t/**\n\t * Gets the current time in Swatch Internet Time (.beats).\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tB( momentDate: Moment ) {\n\t\tconst timezoned = momentLib( momentDate ).utcOffset( 60 );\n\t\tconst seconds = parseInt( timezoned.format( 's' ), 10 ),\n\t\t\tminutes = parseInt( timezoned.format( 'm' ), 10 ),\n\t\t\thours = parseInt( timezoned.format( 'H' ), 10 );\n\t\treturn parseInt(\n\t\t\t(\n\t\t\t\t( seconds +\n\t\t\t\t\tminutes * MINUTE_IN_SECONDS +\n\t\t\t\t\thours * HOUR_IN_SECONDS ) /\n\t\t\t\t86.4\n\t\t\t).toString(),\n\t\t\t10\n\t\t);\n\t},\n\tg: 'h',\n\tG: 'H',\n\th: 'hh',\n\tH: 'HH',\n\ti: 'mm',\n\ts: 'ss',\n\tu: 'SSSSSS',\n\tv: 'SSS',\n\t// Timezone.\n\te: 'zz',\n\t/**\n\t * Gets whether the timezone is in DST currently.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tI( momentDate: Moment ) {\n\t\treturn momentDate.isDST() ? '1' : '0';\n\t},\n\tO: 'ZZ',\n\tP: 'Z',\n\tT: 'z',\n\t/**\n\t * Gets the timezone offset in seconds.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tZ( momentDate: Moment ) {\n\t\t// Timezone offset in seconds.\n\t\tconst offset = momentDate.format( 'Z' );\n\t\tconst sign = offset[ 0 ] === '-' ? -1 : 1;\n\t\tconst parts = offset\n\t\t\t.substring( 1 )\n\t\t\t.split( ':' )\n\t\t\t.map( ( n ) => parseInt( n, 10 ) );\n\t\treturn (\n\t\t\tsign *\n\t\t\t( parts[ 0 ] * HOUR_IN_MINUTES + parts[ 1 ] ) *\n\t\t\tMINUTE_IN_SECONDS\n\t\t);\n\t},\n\t// Full date/time.\n\tc: 'YYYY-MM-DDTHH:mm:ssZ', // .toISOString.\n\t/**\n\t * Formats the date as RFC2822.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tr( momentDate: Moment ) {\n\t\treturn momentDate\n\t\t\t.locale( 'en' )\n\t\t\t.format( 'ddd, DD MMM YYYY HH:mm:ss ZZ' );\n\t},\n\tU: 'X',\n};\n\n/**\n * Formats a date. Does not alter the date's timezone.\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return Formatted date.\n */\nexport function format(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date()\n) {\n\tlet i, char;\n\tconst newFormat = [];\n\tconst momentDate = momentLib( dateValue );\n\tfor ( i = 0; i < dateFormat.length; i++ ) {\n\t\tchar = dateFormat[ i ];\n\t\t// Is this an escape?\n\t\tif ( '\\\\' === char ) {\n\t\t\t// Add next character, then move on.\n\t\t\ti++;\n\t\t\tnewFormat.push( '[' + dateFormat[ i ] + ']' );\n\t\t\tcontinue;\n\t\t}\n\t\tif ( char in formatMap ) {\n\t\t\tconst formatter = formatMap[ char as keyof typeof formatMap ];\n\t\t\tif ( typeof formatter !== 'string' ) {\n\t\t\t\t// If the format is a function, call it.\n\t\t\t\tnewFormat.push( '[' + formatter( momentDate ) + ']' );\n\t\t\t} else {\n\t\t\t\t// Otherwise, add as a formatting string.\n\t\t\t\tnewFormat.push( formatter );\n\t\t\t}\n\t\t} else {\n\t\t\tnewFormat.push( '[' + char + ']' );\n\t\t}\n\t}\n\t// Join with [] between to separate characters, and replace\n\t// unneeded separators with static text.\n\treturn momentDate.format( newFormat.join( '[]' ) );\n}\n\n/**\n * Formats a date (like `date()` in PHP).\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string, parsable\n * by moment.js.\n * @param timezone Timezone to output result in or a\n * UTC offset. Defaults to timezone from\n * site.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return {string} Formatted date in English.\n */\nexport function date(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date(),\n\ttimezone?: string\n) {\n\tconst dateMoment = buildMoment( dateValue, timezone );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `date()` in PHP), in the UTC timezone.\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return Formatted date in English.\n */\nexport function gmdate(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date()\n) {\n\tconst dateMoment = momentLib( dateValue ).utc();\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `wp_date()` in PHP), translating it into site's locale.\n *\n * Backward Compatibility Notice: if `timezone` is set to `true`, the function\n * behaves like `gmdateI18n`.\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string, parsable by\n * moment.js.\n * @param timezone Timezone to output result in or a\n * UTC offset. Defaults to timezone from\n * site. Notice: `boolean` is effectively\n * deprecated, but still supported for\n * backward compatibility reasons.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return Formatted date.\n */\nexport function dateI18n(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date(),\n\ttimezone?: string | number | boolean\n) {\n\tif ( true === timezone ) {\n\t\treturn gmdateI18n( dateFormat, dateValue );\n\t}\n\n\tif ( false === timezone ) {\n\t\ttimezone = undefined;\n\t}\n\n\tconst dateMoment = buildMoment( dateValue, timezone );\n\tdateMoment.locale( settings.l10n.locale );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `wp_date()` in PHP), translating it into site's locale\n * and using the UTC timezone.\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return Formatted date.\n */\nexport function gmdateI18n(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date()\n) {\n\tconst dateMoment = momentLib( dateValue ).utc();\n\tdateMoment.locale( settings.l10n.locale );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Check whether a date is considered in the future according to the WordPress settings.\n *\n * @param dateValue Date String or Date object in the Defined WP Timezone.\n *\n * @return Is in the future.\n */\nexport function isInTheFuture( dateValue: Date | string | number ) {\n\tensureWPTimezone();\n\tconst now = momentLib.tz( WP_ZONE );\n\tconst momentObject = momentLib.tz( dateValue, WP_ZONE );\n\n\treturn momentObject.isAfter( now );\n}\n\n/**\n * Create and return a JavaScript Date Object from a date string in the WP timezone.\n *\n * @param dateString Date formatted in the WP timezone.\n *\n * @return Date\n */\nexport function getDate( dateString?: string | null ) {\n\tensureWPTimezone();\n\tif ( ! dateString ) {\n\t\treturn momentLib.tz( WP_ZONE ).toDate();\n\t}\n\n\treturn momentLib.tz( dateString, WP_ZONE ).toDate();\n}\n\n/**\n * Returns a human-readable time difference between two dates, like human_time_diff() in PHP.\n *\n * @param from From date, in the WP timezone.\n * @param to To date, formatted in the WP timezone.\n *\n * @return Human-readable time difference.\n */\nexport function humanTimeDiff(\n\tfrom: Moment | Date | string | number,\n\tto?: Moment | Date | string | number\n) {\n\tensureWPTimezone();\n\tconst fromMoment = momentLib.tz( from, WP_ZONE );\n\tconst toMoment = to ? momentLib.tz( to, WP_ZONE ) : momentLib.tz( WP_ZONE );\n\treturn fromMoment.from( toMoment );\n}\n\n/**\n * Creates a moment instance using the given timezone or, if none is provided, using global settings.\n *\n * @param dateValue Date object or string, parsable\n * by moment.js.\n * @param timezone Timezone to output result in or a\n * UTC offset. Defaults to timezone from\n * site.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return A moment instance.\n */\nfunction buildMoment(\n\tdateValue: Moment | Date | string | number,\n\ttimezone: string | number = ''\n) {\n\tconst dateMoment = momentLib( dateValue );\n\n\tif ( timezone !== '' ) {\n\t\treturn isUTCOffset( timezone )\n\t\t\t? dateMoment.utcOffset( timezone )\n\t\t\t: // A false isUTCOffset() guarantees that timezone is a string.\n\t\t\t dateMoment.tz( timezone as string );\n\t}\n\n\tif ( settings.timezone.string ) {\n\t\treturn dateMoment.tz( settings.timezone.string );\n\t}\n\n\treturn dateMoment.utcOffset( +settings.timezone.offset );\n}\n\n/**\n * Returns whether a certain UTC offset is valid or not.\n *\n * @param offset a UTC offset.\n *\n * @return whether a certain UTC offset is valid or not.\n */\nfunction isUTCOffset( offset: number | string ) {\n\tif ( 'number' === typeof offset ) {\n\t\treturn true;\n\t}\n\n\treturn VALID_UTC_OFFSET.test( offset );\n}\n\nsetupWPTimezone();\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oBAAsB;AACtB,6BAAO;AACP,mCAAO;AAKP,wBAAuB;AAQvB,IAAM,UAAU;AAIhB,IAAM,mBAAmB;AAIzB,IAAI,WAAyB;AAAA,EAC5B,MAAM;AAA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,WAAW,GAAI,QAAmB;AAAA;AAAA,EACtC;AAEA,MAAK,SAAS,SAAS,QAAS;AAC/B,WAAO,WAAW,GAAI,SAAS,SAAS,MAAO;AAAA,EAChD;AAEA,SAAO,WAAW,UAAW,CAAC,SAAS,SAAS,MAAO;AACxD;AASA,SAAS,YAAa,QAA0B;AAC/C,MAAK,aAAa,OAAO,QAAS;AACjC,WAAO;AAAA,EACR;AAEA,SAAO,iBAAiB,KAAM,MAAO;AACtC;AAEA,gBAAgB;",
6
6
  "names": ["momentLib", "deprecated"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport type { Moment } from 'moment';\nimport momentLib from 'moment';\nimport 'moment-timezone/moment-timezone.js';\nimport 'moment-timezone/moment-timezone-utils.js';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n/**\n * Internal dependencies\n */\nimport type { DateSettings } from './types';\n\nexport type * from './types';\n\nconst WP_ZONE = 'WP';\n\n// This regular expression tests positive for UTC offsets as described in ISO 8601.\n// See: https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\nconst VALID_UTC_OFFSET = /^[+-][0-1][0-9](:?[0-9][0-9])?$/;\n\n// Changes made here will likely need to be synced with Core in the file\n// src/wp-includes/script-loader.php in `wp_default_packages_inline_scripts()`.\nlet settings: DateSettings = {\n\tl10n: {\n\t\tlocale: 'en',\n\t\tmonths: [\n\t\t\t'January',\n\t\t\t'February',\n\t\t\t'March',\n\t\t\t'April',\n\t\t\t'May',\n\t\t\t'June',\n\t\t\t'July',\n\t\t\t'August',\n\t\t\t'September',\n\t\t\t'October',\n\t\t\t'November',\n\t\t\t'December',\n\t\t],\n\t\tmonthsShort: [\n\t\t\t'Jan',\n\t\t\t'Feb',\n\t\t\t'Mar',\n\t\t\t'Apr',\n\t\t\t'May',\n\t\t\t'Jun',\n\t\t\t'Jul',\n\t\t\t'Aug',\n\t\t\t'Sep',\n\t\t\t'Oct',\n\t\t\t'Nov',\n\t\t\t'Dec',\n\t\t],\n\t\tweekdays: [\n\t\t\t'Sunday',\n\t\t\t'Monday',\n\t\t\t'Tuesday',\n\t\t\t'Wednesday',\n\t\t\t'Thursday',\n\t\t\t'Friday',\n\t\t\t'Saturday',\n\t\t],\n\t\tweekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],\n\t\tmeridiem: { am: 'am', pm: 'pm', AM: 'AM', PM: 'PM' },\n\t\trelative: {\n\t\t\tfuture: '%s from now',\n\t\t\tpast: '%s ago',\n\t\t\ts: 'a few seconds',\n\t\t\tss: '%d seconds',\n\t\t\tm: 'a minute',\n\t\t\tmm: '%d minutes',\n\t\t\th: 'an hour',\n\t\t\thh: '%d hours',\n\t\t\td: 'a day',\n\t\t\tdd: '%d days',\n\t\t\tM: 'a month',\n\t\t\tMM: '%d months',\n\t\t\ty: 'a year',\n\t\t\tyy: '%d years',\n\t\t},\n\t\tstartOfWeek: 0,\n\t},\n\tformats: {\n\t\ttime: 'g:i a',\n\t\tdate: 'F j, Y',\n\t\tdatetime: 'F j, Y g:i a',\n\t\tdatetimeAbbreviated: 'M j, Y g:i a',\n\t},\n\ttimezone: { offset: 0, offsetFormatted: '0', string: '', abbr: '' },\n};\n\n/**\n * Adds a locale to moment, using the format supplied by `wp_localize_script()`.\n *\n * @param dateSettings Settings, including locale data.\n */\nexport function setSettings( dateSettings: DateSettings ) {\n\tsettings = dateSettings;\n\n\tsetupWPTimezone();\n\n\t// Does moment already have a locale with the right name?\n\tif ( momentLib.locales().includes( dateSettings.l10n.locale ) ) {\n\t\t// Is that locale misconfigured, e.g. because we are on a site running\n\t\t// WordPress < 6.0?\n\t\tif (\n\t\t\tmomentLib\n\t\t\t\t.localeData( dateSettings.l10n.locale )\n\t\t\t\t.longDateFormat( 'LTS' ) === null\n\t\t) {\n\t\t\t// Delete the misconfigured locale.\n\t\t\t// @ts-ignore Type definitions are incorrect - null is permitted.\n\t\t\tmomentLib.defineLocale( dateSettings.l10n.locale, null );\n\t\t} else {\n\t\t\t// We have a properly configured locale, so no need to create one.\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// defineLocale() will modify the current locale, so back it up.\n\tconst currentLocale = momentLib.locale();\n\n\t// Create locale.\n\tmomentLib.defineLocale( dateSettings.l10n.locale, {\n\t\t// Inherit anything missing from English. We don't load\n\t\t// moment-with-locales.js so English is all there is.\n\t\tparentLocale: 'en',\n\t\tmonths: dateSettings.l10n.months,\n\t\tmonthsShort: dateSettings.l10n.monthsShort,\n\t\tweekdays: dateSettings.l10n.weekdays,\n\t\tweekdaysShort: dateSettings.l10n.weekdaysShort,\n\t\tmeridiem( hour, minute, isLowercase ) {\n\t\t\tif ( hour < 12 ) {\n\t\t\t\treturn isLowercase\n\t\t\t\t\t? dateSettings.l10n.meridiem.am\n\t\t\t\t\t: dateSettings.l10n.meridiem.AM;\n\t\t\t}\n\t\t\treturn isLowercase\n\t\t\t\t? dateSettings.l10n.meridiem.pm\n\t\t\t\t: dateSettings.l10n.meridiem.PM;\n\t\t},\n\t\tlongDateFormat: {\n\t\t\tLT: dateSettings.formats.time,\n\t\t\tLTS: momentLib.localeData( 'en' ).longDateFormat( 'LTS' ),\n\t\t\tL: momentLib.localeData( 'en' ).longDateFormat( 'L' ),\n\t\t\tLL: dateSettings.formats.date,\n\t\t\tLLL: dateSettings.formats.datetime,\n\t\t\tLLLL: momentLib.localeData( 'en' ).longDateFormat( 'LLLL' ),\n\t\t},\n\t\t// From human_time_diff?\n\t\t// Set to `(number, withoutSuffix, key, isFuture) => {}` instead.\n\t\trelativeTime: dateSettings.l10n.relative,\n\t} );\n\n\t// Restore the locale to what it was.\n\tmomentLib.locale( currentLocale );\n}\n\n/**\n * Returns the currently defined date settings.\n *\n * @return {DateSettings} Settings, including locale data.\n */\nexport function getSettings() {\n\treturn settings;\n}\n\n/**\n * Returns the currently defined date settings.\n *\n * @deprecated\n * @return {DateSettings} Settings, including locale data.\n */\nexport function __experimentalGetSettings() {\n\tdeprecated( 'wp.date.__experimentalGetSettings', {\n\t\tsince: '6.1',\n\t\talternative: 'wp.date.getSettings',\n\t} );\n\treturn getSettings();\n}\n\n// Cached packed zone string, used to re-add the WP zone without requiring\n// moment-timezone-utils (which provides .pack()) after a third-party plugin\n// reloads moment-timezone and destroys both the zone and the utils.\nlet wpZonePacked: string | undefined;\n\n/**\n * Ensures the custom WP timezone zone exists in moment-timezone's registry.\n *\n * Third-party plugins (e.g. WooCommerce) may load their own copy of\n * moment-timezone, which reinitializes the internal zone storage and\n * destroys the custom 'WP' zone. This function checks for the zone's\n * existence and re-creates it if necessary.\n */\nfunction ensureWPTimezone() {\n\tif ( ! momentLib.tz.zone( WP_ZONE ) ) {\n\t\tif ( wpZonePacked ) {\n\t\t\tmomentLib.tz.add( wpZonePacked );\n\t\t} else {\n\t\t\tsetupWPTimezone();\n\t\t}\n\t}\n}\n\nfunction setupWPTimezone() {\n\t// Get the current timezone settings from the WP timezone string.\n\tconst currentTimezone = momentLib.tz.zone( settings.timezone.string );\n\n\tlet packed;\n\t// Check to see if we have a valid TZ data, if so, use it for the custom WP_ZONE timezone, otherwise just use the offset.\n\tif ( currentTimezone ) {\n\t\t// Create WP timezone based off settings.timezone.string. We need to include the additional data so that we\n\t\t// don't lose information about daylight savings time and other items.\n\t\t// See https://github.com/WordPress/gutenberg/pull/48083\n\t\tpacked = momentLib.tz.pack( {\n\t\t\tname: WP_ZONE,\n\t\t\tabbrs: currentTimezone.abbrs,\n\t\t\tuntils: currentTimezone.untils,\n\t\t\toffsets: currentTimezone.offsets,\n\t\t} );\n\t} else {\n\t\t// Create WP timezone based off dateSettings.\n\t\tpacked = momentLib.tz.pack( {\n\t\t\tname: WP_ZONE,\n\t\t\tabbrs: [ WP_ZONE ],\n\t\t\tuntils: [ null ],\n\t\t\toffsets: [ -settings.timezone.offset * 60 || 0 ],\n\t\t} );\n\t}\n\n\twpZonePacked = packed;\n\tmomentLib.tz.add( packed );\n}\n\n// Date constants.\n/**\n * Number of seconds in one minute.\n */\nconst MINUTE_IN_SECONDS = 60;\n/**\n * Number of minutes in one hour.\n */\nconst HOUR_IN_MINUTES = 60;\n/**\n * Number of seconds in one hour.\n */\nconst HOUR_IN_SECONDS = 60 * MINUTE_IN_SECONDS;\n\n/**\n * Map of PHP formats to Moment.js formats.\n *\n * These are used internally by {@link format}, and are either\n * a string representing the corresponding Moment.js format code, or a\n * function which returns the formatted string.\n *\n * This should only be used through {@link format}, not\n * directly.\n */\nconst formatMap = {\n\t// Day.\n\td: 'DD',\n\tD: 'ddd',\n\tj: 'D',\n\tl: 'dddd',\n\tN: 'E',\n\n\t/**\n\t * Gets the ordinal suffix.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tS( momentDate: Moment ) {\n\t\t// Do - D.\n\t\tconst num = momentDate.format( 'D' );\n\t\tconst withOrdinal = momentDate.format( 'Do' );\n\t\treturn withOrdinal.replace( num, '' );\n\t},\n\n\tw: 'd',\n\t/**\n\t * Gets the day of the year (zero-indexed).\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tz( momentDate: Moment ) {\n\t\t// DDD - 1.\n\t\treturn ( parseInt( momentDate.format( 'DDD' ), 10 ) - 1 ).toString();\n\t},\n\n\t// Week.\n\tW: 'W',\n\n\t// Month.\n\tF: 'MMMM',\n\tm: 'MM',\n\tM: 'MMM',\n\tn: 'M',\n\t/**\n\t * Gets the days in the month.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tt( momentDate: Moment ) {\n\t\treturn momentDate.daysInMonth();\n\t},\n\n\t// Year.\n\t/**\n\t * Gets whether the current year is a leap year.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tL( momentDate: Moment ) {\n\t\treturn momentDate.isLeapYear() ? '1' : '0';\n\t},\n\to: 'GGGG',\n\tY: 'YYYY',\n\ty: 'YY',\n\n\t// Time.\n\ta: 'a',\n\tA: 'A',\n\t/**\n\t * Gets the current time in Swatch Internet Time (.beats).\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tB( momentDate: Moment ) {\n\t\tconst timezoned = momentLib( momentDate ).utcOffset( 60 );\n\t\tconst seconds = parseInt( timezoned.format( 's' ), 10 ),\n\t\t\tminutes = parseInt( timezoned.format( 'm' ), 10 ),\n\t\t\thours = parseInt( timezoned.format( 'H' ), 10 );\n\t\treturn parseInt(\n\t\t\t(\n\t\t\t\t( seconds +\n\t\t\t\t\tminutes * MINUTE_IN_SECONDS +\n\t\t\t\t\thours * HOUR_IN_SECONDS ) /\n\t\t\t\t86.4\n\t\t\t).toString(),\n\t\t\t10\n\t\t);\n\t},\n\tg: 'h',\n\tG: 'H',\n\th: 'hh',\n\tH: 'HH',\n\ti: 'mm',\n\ts: 'ss',\n\tu: 'SSSSSS',\n\tv: 'SSS',\n\t// Timezone.\n\te: 'zz',\n\t/**\n\t * Gets whether the timezone is in DST currently.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tI( momentDate: Moment ) {\n\t\treturn momentDate.isDST() ? '1' : '0';\n\t},\n\tO: 'ZZ',\n\tP: 'Z',\n\tT: 'z',\n\t/**\n\t * Gets the timezone offset in seconds.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tZ( momentDate: Moment ) {\n\t\t// Timezone offset in seconds.\n\t\tconst offset = momentDate.format( 'Z' );\n\t\tconst sign = offset[ 0 ] === '-' ? -1 : 1;\n\t\tconst parts = offset\n\t\t\t.substring( 1 )\n\t\t\t.split( ':' )\n\t\t\t.map( ( n ) => parseInt( n, 10 ) );\n\t\treturn (\n\t\t\tsign *\n\t\t\t( parts[ 0 ] * HOUR_IN_MINUTES + parts[ 1 ] ) *\n\t\t\tMINUTE_IN_SECONDS\n\t\t);\n\t},\n\t// Full date/time.\n\tc: 'YYYY-MM-DDTHH:mm:ssZ', // .toISOString.\n\t/**\n\t * Formats the date as RFC2822.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tr( momentDate: Moment ) {\n\t\treturn momentDate\n\t\t\t.locale( 'en' )\n\t\t\t.format( 'ddd, DD MMM YYYY HH:mm:ss ZZ' );\n\t},\n\tU: 'X',\n};\n\n/**\n * Formats a date. Does not alter the date's timezone.\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return Formatted date.\n */\nexport function format(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date()\n) {\n\tlet i, char;\n\tconst newFormat = [];\n\tconst momentDate = momentLib( dateValue );\n\tfor ( i = 0; i < dateFormat.length; i++ ) {\n\t\tchar = dateFormat[ i ];\n\t\t// Is this an escape?\n\t\tif ( '\\\\' === char ) {\n\t\t\t// Add next character, then move on.\n\t\t\ti++;\n\t\t\tnewFormat.push( '[' + dateFormat[ i ] + ']' );\n\t\t\tcontinue;\n\t\t}\n\t\tif ( char in formatMap ) {\n\t\t\tconst formatter = formatMap[ char as keyof typeof formatMap ];\n\t\t\tif ( typeof formatter !== 'string' ) {\n\t\t\t\t// If the format is a function, call it.\n\t\t\t\tnewFormat.push( '[' + formatter( momentDate ) + ']' );\n\t\t\t} else {\n\t\t\t\t// Otherwise, add as a formatting string.\n\t\t\t\tnewFormat.push( formatter );\n\t\t\t}\n\t\t} else {\n\t\t\tnewFormat.push( '[' + char + ']' );\n\t\t}\n\t}\n\t// Join with [] between to separate characters, and replace\n\t// unneeded separators with static text.\n\treturn momentDate.format( newFormat.join( '[]' ) );\n}\n\n/**\n * Formats a date (like `date()` in PHP).\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string, parsable\n * by moment.js.\n * @param timezone Timezone to output result in or a\n * UTC offset. Defaults to timezone from\n * site.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return {string} Formatted date in English.\n */\nexport function date(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date(),\n\ttimezone?: string\n) {\n\tconst dateMoment = buildMoment( dateValue, timezone );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `date()` in PHP), in the UTC timezone.\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return Formatted date in English.\n */\nexport function gmdate(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date()\n) {\n\tconst dateMoment = momentLib( dateValue ).utc();\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `wp_date()` in PHP), translating it into site's locale.\n *\n * Backward Compatibility Notice: if `timezone` is set to `true`, the function\n * behaves like `gmdateI18n`.\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string, parsable by\n * moment.js.\n * @param timezone Timezone to output result in or a\n * UTC offset. Defaults to timezone from\n * site. Notice: `boolean` is effectively\n * deprecated, but still supported for\n * backward compatibility reasons.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return Formatted date.\n */\nexport function dateI18n(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date(),\n\ttimezone?: string | number | boolean\n) {\n\tif ( true === timezone ) {\n\t\treturn gmdateI18n( dateFormat, dateValue );\n\t}\n\n\tif ( false === timezone ) {\n\t\ttimezone = undefined;\n\t}\n\n\tconst dateMoment = buildMoment( dateValue, timezone );\n\tdateMoment.locale( settings.l10n.locale );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `wp_date()` in PHP), translating it into site's locale\n * and using the UTC timezone.\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return Formatted date.\n */\nexport function gmdateI18n(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date()\n) {\n\tconst dateMoment = momentLib( dateValue ).utc();\n\tdateMoment.locale( settings.l10n.locale );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Check whether a date is considered in the future according to the WordPress settings.\n *\n * @param dateValue Date String or Date object in the Defined WP Timezone.\n *\n * @return Is in the future.\n */\nexport function isInTheFuture( dateValue: Date | string | number ) {\n\tensureWPTimezone();\n\tconst now = momentLib.tz( WP_ZONE );\n\tconst momentObject = momentLib.tz( dateValue, WP_ZONE );\n\n\treturn momentObject.isAfter( now );\n}\n\n/**\n * Create and return a JavaScript Date Object from a date string in the WP timezone.\n *\n * @param dateString Date formatted in the WP timezone.\n *\n * @return Date\n */\nexport function getDate( dateString?: string | null ) {\n\tensureWPTimezone();\n\tif ( ! dateString ) {\n\t\treturn momentLib.tz( WP_ZONE ).toDate();\n\t}\n\n\treturn momentLib.tz( dateString, WP_ZONE ).toDate();\n}\n\n/**\n * Returns a human-readable time difference between two dates, like human_time_diff() in PHP.\n *\n * @param from From date, in the WP timezone.\n * @param to To date, formatted in the WP timezone.\n *\n * @return Human-readable time difference.\n */\nexport function humanTimeDiff(\n\tfrom: Moment | Date | string | number,\n\tto?: Moment | Date | string | number\n) {\n\tensureWPTimezone();\n\tconst fromMoment = momentLib.tz( from, WP_ZONE );\n\tconst toMoment = to ? momentLib.tz( to, WP_ZONE ) : momentLib.tz( WP_ZONE );\n\treturn fromMoment.from( toMoment );\n}\n\n/**\n * Creates a moment instance using the given timezone or, if none is provided, using global settings.\n *\n * @param dateValue Date object or string, parsable\n * by moment.js.\n * @param timezone Timezone to output result in or a\n * UTC offset. Defaults to timezone from\n * site.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return A moment instance.\n */\nfunction buildMoment(\n\tdateValue?: Moment | Date | string | number,\n\ttimezone: string | number = ''\n) {\n\tconst dateMoment = momentLib( dateValue );\n\n\tif ( timezone !== '' ) {\n\t\treturn isUTCOffset( timezone )\n\t\t\t? dateMoment.utcOffset( timezone )\n\t\t\t: // A false isUTCOffset() guarantees that timezone is a string.\n\t\t\t dateMoment.tz( timezone as string );\n\t}\n\n\tif ( settings.timezone.string ) {\n\t\treturn dateMoment.tz( settings.timezone.string );\n\t}\n\n\treturn dateMoment.utcOffset( +settings.timezone.offset );\n}\n\n/**\n * Returns whether a certain UTC offset is valid or not.\n *\n * @param offset a UTC offset.\n *\n * @return whether a certain UTC offset is valid or not.\n */\nfunction isUTCOffset( offset: number | string ) {\n\tif ( 'number' === typeof offset ) {\n\t\treturn true;\n\t}\n\n\treturn VALID_UTC_OFFSET.test( offset );\n}\n\nsetupWPTimezone();\n"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport type { Moment } from 'moment';\nimport momentLib from 'moment';\nimport 'moment-timezone/moment-timezone.js';\nimport 'moment-timezone/moment-timezone-utils.js';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n/**\n * Internal dependencies\n */\nimport type { DateSettings } from './types';\n\nexport type * from './types';\n\nconst WP_ZONE = 'WP';\n\n// This regular expression tests positive for UTC offsets as described in ISO 8601.\n// See: https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\nconst VALID_UTC_OFFSET = /^[+-][0-1][0-9](:?[0-9][0-9])?$/;\n\n// Changes made here will likely need to be synced with Core in the file\n// src/wp-includes/script-loader.php in `wp_default_packages_inline_scripts()`.\nlet settings: DateSettings = {\n\tl10n: {\n\t\tlocale: 'en',\n\t\tmonths: [\n\t\t\t'January',\n\t\t\t'February',\n\t\t\t'March',\n\t\t\t'April',\n\t\t\t'May',\n\t\t\t'June',\n\t\t\t'July',\n\t\t\t'August',\n\t\t\t'September',\n\t\t\t'October',\n\t\t\t'November',\n\t\t\t'December',\n\t\t],\n\t\tmonthsShort: [\n\t\t\t'Jan',\n\t\t\t'Feb',\n\t\t\t'Mar',\n\t\t\t'Apr',\n\t\t\t'May',\n\t\t\t'Jun',\n\t\t\t'Jul',\n\t\t\t'Aug',\n\t\t\t'Sep',\n\t\t\t'Oct',\n\t\t\t'Nov',\n\t\t\t'Dec',\n\t\t],\n\t\tweekdays: [\n\t\t\t'Sunday',\n\t\t\t'Monday',\n\t\t\t'Tuesday',\n\t\t\t'Wednesday',\n\t\t\t'Thursday',\n\t\t\t'Friday',\n\t\t\t'Saturday',\n\t\t],\n\t\tweekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],\n\t\tmeridiem: { am: 'am', pm: 'pm', AM: 'AM', PM: 'PM' },\n\t\trelative: {\n\t\t\tfuture: '%s from now',\n\t\t\tpast: '%s ago',\n\t\t\ts: 'a few seconds',\n\t\t\tss: '%d seconds',\n\t\t\tm: 'a minute',\n\t\t\tmm: '%d minutes',\n\t\t\th: 'an hour',\n\t\t\thh: '%d hours',\n\t\t\td: 'a day',\n\t\t\tdd: '%d days',\n\t\t\tM: 'a month',\n\t\t\tMM: '%d months',\n\t\t\ty: 'a year',\n\t\t\tyy: '%d years',\n\t\t},\n\t\tstartOfWeek: 0,\n\t},\n\tformats: {\n\t\ttime: 'g:i a',\n\t\tdate: 'F j, Y',\n\t\tdatetime: 'F j, Y g:i a',\n\t\tdatetimeAbbreviated: 'M j, Y g:i a',\n\t},\n\ttimezone: { offset: 0, offsetFormatted: '0', string: '', abbr: '' },\n};\n\n/**\n * Adds a locale to moment, using the format supplied by `wp_localize_script()`.\n *\n * @param dateSettings Settings, including locale data.\n */\nexport function setSettings( dateSettings: DateSettings ) {\n\tsettings = dateSettings;\n\n\tsetupWPTimezone();\n\n\t// Does moment already have a locale with the right name?\n\tif ( momentLib.locales().includes( dateSettings.l10n.locale ) ) {\n\t\t// Is that locale misconfigured, e.g. because we are on a site running\n\t\t// WordPress < 6.0?\n\t\tif (\n\t\t\tmomentLib\n\t\t\t\t.localeData( dateSettings.l10n.locale )\n\t\t\t\t.longDateFormat( 'LTS' ) === null\n\t\t) {\n\t\t\t// Delete the misconfigured locale.\n\t\t\t// @ts-ignore Type definitions are incorrect - null is permitted.\n\t\t\tmomentLib.defineLocale( dateSettings.l10n.locale, null );\n\t\t} else {\n\t\t\t// We have a properly configured locale, so no need to create one.\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// defineLocale() will modify the current locale, so back it up.\n\tconst currentLocale = momentLib.locale();\n\n\t// Create locale.\n\tmomentLib.defineLocale( dateSettings.l10n.locale, {\n\t\t// Inherit anything missing from English. We don't load\n\t\t// moment-with-locales.js so English is all there is.\n\t\tparentLocale: 'en',\n\t\tmonths: dateSettings.l10n.months,\n\t\tmonthsShort: dateSettings.l10n.monthsShort,\n\t\tweekdays: dateSettings.l10n.weekdays,\n\t\tweekdaysShort: dateSettings.l10n.weekdaysShort,\n\t\tmeridiem( hour, minute, isLowercase ) {\n\t\t\tif ( hour < 12 ) {\n\t\t\t\treturn isLowercase\n\t\t\t\t\t? dateSettings.l10n.meridiem.am\n\t\t\t\t\t: dateSettings.l10n.meridiem.AM;\n\t\t\t}\n\t\t\treturn isLowercase\n\t\t\t\t? dateSettings.l10n.meridiem.pm\n\t\t\t\t: dateSettings.l10n.meridiem.PM;\n\t\t},\n\t\tlongDateFormat: {\n\t\t\tLT: dateSettings.formats.time,\n\t\t\tLTS: momentLib.localeData( 'en' ).longDateFormat( 'LTS' ),\n\t\t\tL: momentLib.localeData( 'en' ).longDateFormat( 'L' ),\n\t\t\tLL: dateSettings.formats.date,\n\t\t\tLLL: dateSettings.formats.datetime,\n\t\t\tLLLL: momentLib.localeData( 'en' ).longDateFormat( 'LLLL' ),\n\t\t},\n\t\t// From human_time_diff?\n\t\t// Set to `(number, withoutSuffix, key, isFuture) => {}` instead.\n\t\trelativeTime: dateSettings.l10n.relative,\n\t} );\n\n\t// Restore the locale to what it was.\n\tmomentLib.locale( currentLocale );\n}\n\n/**\n * Returns the currently defined date settings.\n *\n * @return {DateSettings} Settings, including locale data.\n */\nexport function getSettings() {\n\treturn settings;\n}\n\n/**\n * Returns the currently defined date settings.\n *\n * @deprecated\n * @return {DateSettings} Settings, including locale data.\n */\nexport function __experimentalGetSettings() {\n\tdeprecated( 'wp.date.__experimentalGetSettings', {\n\t\tsince: '6.1',\n\t\talternative: 'wp.date.getSettings',\n\t} );\n\treturn getSettings();\n}\n\n// Cached packed zone string, used to re-add the WP zone without requiring\n// moment-timezone-utils (which provides .pack()) after a third-party plugin\n// reloads moment-timezone and destroys both the zone and the utils.\nlet wpZonePacked: string | undefined;\n\n/**\n * Ensures the custom WP timezone zone exists in moment-timezone's registry.\n *\n * Third-party plugins (e.g. WooCommerce) may load their own copy of\n * moment-timezone, which reinitializes the internal zone storage and\n * destroys the custom 'WP' zone. This function checks for the zone's\n * existence and re-creates it if necessary.\n */\nfunction ensureWPTimezone() {\n\tif ( ! momentLib.tz.zone( WP_ZONE ) ) {\n\t\tif ( wpZonePacked ) {\n\t\t\tmomentLib.tz.add( wpZonePacked );\n\t\t} else {\n\t\t\tsetupWPTimezone();\n\t\t}\n\t}\n}\n\nfunction setupWPTimezone() {\n\t// Get the current timezone settings from the WP timezone string.\n\tconst currentTimezone = momentLib.tz.zone( settings.timezone.string );\n\n\tlet packed;\n\t// Check to see if we have a valid TZ data, if so, use it for the custom WP_ZONE timezone, otherwise just use the offset.\n\tif ( currentTimezone ) {\n\t\t// Create WP timezone based off settings.timezone.string. We need to include the additional data so that we\n\t\t// don't lose information about daylight savings time and other items.\n\t\t// See https://github.com/WordPress/gutenberg/pull/48083\n\t\tpacked = momentLib.tz.pack( {\n\t\t\tname: WP_ZONE,\n\t\t\tabbrs: currentTimezone.abbrs,\n\t\t\tuntils: currentTimezone.untils,\n\t\t\toffsets: currentTimezone.offsets,\n\t\t} );\n\t} else {\n\t\t// Create WP timezone based off dateSettings.\n\t\tpacked = momentLib.tz.pack( {\n\t\t\tname: WP_ZONE,\n\t\t\tabbrs: [ WP_ZONE ],\n\t\t\tuntils: [ null ],\n\t\t\toffsets: [ -settings.timezone.offset * 60 || 0 ],\n\t\t} );\n\t}\n\n\twpZonePacked = packed;\n\tmomentLib.tz.add( packed );\n}\n\n// Date constants.\n/**\n * Number of seconds in one minute.\n */\nconst MINUTE_IN_SECONDS = 60;\n/**\n * Number of minutes in one hour.\n */\nconst HOUR_IN_MINUTES = 60;\n/**\n * Number of seconds in one hour.\n */\nconst HOUR_IN_SECONDS = 60 * MINUTE_IN_SECONDS;\n\n/**\n * Map of PHP formats to Moment.js formats.\n *\n * These are used internally by {@link format}, and are either\n * a string representing the corresponding Moment.js format code, or a\n * function which returns the formatted string.\n *\n * This should only be used through {@link format}, not\n * directly.\n */\nconst formatMap = {\n\t// Day.\n\td: 'DD',\n\tD: 'ddd',\n\tj: 'D',\n\tl: 'dddd',\n\tN: 'E',\n\n\t/**\n\t * Gets the ordinal suffix.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tS( momentDate: Moment ) {\n\t\t// Do - D.\n\t\tconst num = momentDate.format( 'D' );\n\t\tconst withOrdinal = momentDate.format( 'Do' );\n\t\treturn withOrdinal.replace( num, '' );\n\t},\n\n\tw: 'd',\n\t/**\n\t * Gets the day of the year (zero-indexed).\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tz( momentDate: Moment ) {\n\t\t// DDD - 1.\n\t\treturn ( parseInt( momentDate.format( 'DDD' ), 10 ) - 1 ).toString();\n\t},\n\n\t// Week.\n\tW: 'W',\n\n\t// Month.\n\tF: 'MMMM',\n\tm: 'MM',\n\tM: 'MMM',\n\tn: 'M',\n\t/**\n\t * Gets the days in the month.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tt( momentDate: Moment ) {\n\t\treturn momentDate.daysInMonth();\n\t},\n\n\t// Year.\n\t/**\n\t * Gets whether the current year is a leap year.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tL( momentDate: Moment ) {\n\t\treturn momentDate.isLeapYear() ? '1' : '0';\n\t},\n\to: 'GGGG',\n\tY: 'YYYY',\n\ty: 'YY',\n\n\t// Time.\n\ta: 'a',\n\tA: 'A',\n\t/**\n\t * Gets the current time in Swatch Internet Time (.beats).\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tB( momentDate: Moment ) {\n\t\tconst timezoned = momentLib( momentDate ).utcOffset( 60 );\n\t\tconst seconds = parseInt( timezoned.format( 's' ), 10 ),\n\t\t\tminutes = parseInt( timezoned.format( 'm' ), 10 ),\n\t\t\thours = parseInt( timezoned.format( 'H' ), 10 );\n\t\treturn parseInt(\n\t\t\t(\n\t\t\t\t( seconds +\n\t\t\t\t\tminutes * MINUTE_IN_SECONDS +\n\t\t\t\t\thours * HOUR_IN_SECONDS ) /\n\t\t\t\t86.4\n\t\t\t).toString(),\n\t\t\t10\n\t\t);\n\t},\n\tg: 'h',\n\tG: 'H',\n\th: 'hh',\n\tH: 'HH',\n\ti: 'mm',\n\ts: 'ss',\n\tu: 'SSSSSS',\n\tv: 'SSS',\n\t// Timezone.\n\te: 'zz',\n\t/**\n\t * Gets whether the timezone is in DST currently.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tI( momentDate: Moment ) {\n\t\treturn momentDate.isDST() ? '1' : '0';\n\t},\n\tO: 'ZZ',\n\tP: 'Z',\n\tT: 'z',\n\t/**\n\t * Gets the timezone offset in seconds.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tZ( momentDate: Moment ) {\n\t\t// Timezone offset in seconds.\n\t\tconst offset = momentDate.format( 'Z' );\n\t\tconst sign = offset[ 0 ] === '-' ? -1 : 1;\n\t\tconst parts = offset\n\t\t\t.substring( 1 )\n\t\t\t.split( ':' )\n\t\t\t.map( ( n ) => parseInt( n, 10 ) );\n\t\treturn (\n\t\t\tsign *\n\t\t\t( parts[ 0 ] * HOUR_IN_MINUTES + parts[ 1 ] ) *\n\t\t\tMINUTE_IN_SECONDS\n\t\t);\n\t},\n\t// Full date/time.\n\tc: 'YYYY-MM-DDTHH:mm:ssZ', // .toISOString.\n\t/**\n\t * Formats the date as RFC2822.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tr( momentDate: Moment ) {\n\t\treturn momentDate\n\t\t\t.locale( 'en' )\n\t\t\t.format( 'ddd, DD MMM YYYY HH:mm:ss ZZ' );\n\t},\n\tU: 'X',\n};\n\n/**\n * Formats a date. Does not alter the date's timezone.\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return Formatted date.\n */\nexport function format(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date()\n) {\n\tlet i, char;\n\tconst newFormat = [];\n\tconst momentDate = momentLib( dateValue );\n\tfor ( i = 0; i < dateFormat.length; i++ ) {\n\t\tchar = dateFormat[ i ];\n\t\t// Is this an escape?\n\t\tif ( '\\\\' === char ) {\n\t\t\t// Add next character, then move on.\n\t\t\ti++;\n\t\t\tnewFormat.push( '[' + dateFormat[ i ] + ']' );\n\t\t\tcontinue;\n\t\t}\n\t\tif ( char in formatMap ) {\n\t\t\tconst formatter = formatMap[ char as keyof typeof formatMap ];\n\t\t\tif ( typeof formatter !== 'string' ) {\n\t\t\t\t// If the format is a function, call it.\n\t\t\t\tnewFormat.push( '[' + formatter( momentDate ) + ']' );\n\t\t\t} else {\n\t\t\t\t// Otherwise, add as a formatting string.\n\t\t\t\tnewFormat.push( formatter );\n\t\t\t}\n\t\t} else {\n\t\t\tnewFormat.push( '[' + char + ']' );\n\t\t}\n\t}\n\t// Join with [] between to separate characters, and replace\n\t// unneeded separators with static text.\n\treturn momentDate.format( newFormat.join( '[]' ) );\n}\n\n/**\n * Formats a date (like `date()` in PHP).\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string, parsable\n * by moment.js.\n * @param timezone Timezone to output result in or a\n * UTC offset. Defaults to timezone from\n * site.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return {string} Formatted date in English.\n */\nexport function date(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date(),\n\ttimezone?: string\n) {\n\tconst dateMoment = buildMoment( dateValue, timezone );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `date()` in PHP), in the UTC timezone.\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return Formatted date in English.\n */\nexport function gmdate(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date()\n) {\n\tconst dateMoment = momentLib( dateValue ).utc();\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `wp_date()` in PHP), translating it into site's locale.\n *\n * Backward Compatibility Notice: if `timezone` is set to `true`, the function\n * behaves like `gmdateI18n`.\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string, parsable by\n * moment.js.\n * @param timezone Timezone to output result in or a\n * UTC offset. Defaults to timezone from\n * site. Notice: `boolean` is effectively\n * deprecated, but still supported for\n * backward compatibility reasons.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return Formatted date.\n */\nexport function dateI18n(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date(),\n\ttimezone?: string | number | boolean\n) {\n\tif ( true === timezone ) {\n\t\treturn gmdateI18n( dateFormat, dateValue );\n\t}\n\n\tif ( false === timezone ) {\n\t\ttimezone = undefined;\n\t}\n\n\tconst dateMoment = buildMoment( dateValue, timezone );\n\tdateMoment.locale( settings.l10n.locale );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `wp_date()` in PHP), translating it into site's locale\n * and using the UTC timezone.\n *\n * @param dateFormat PHP-style formatting string.\n * See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return Formatted date.\n */\nexport function gmdateI18n(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date()\n) {\n\tconst dateMoment = momentLib( dateValue ).utc();\n\tdateMoment.locale( settings.l10n.locale );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Check whether a date is considered in the future according to the WordPress settings.\n *\n * @param dateValue Date String or Date object in the Defined WP Timezone.\n *\n * @return Is in the future.\n */\nexport function isInTheFuture( dateValue: Date | string | number ) {\n\tensureWPTimezone();\n\tconst now = momentLib.tz( WP_ZONE );\n\tconst momentObject = momentLib.tz( dateValue, WP_ZONE );\n\n\treturn momentObject.isAfter( now );\n}\n\n/**\n * Create and return a JavaScript Date Object from a date string in the WP timezone.\n *\n * @param dateString Date formatted in the WP timezone.\n *\n * @return Date\n */\nexport function getDate( dateString?: string | null ) {\n\tensureWPTimezone();\n\tif ( ! dateString ) {\n\t\treturn momentLib.tz( WP_ZONE ).toDate();\n\t}\n\n\treturn momentLib.tz( dateString, WP_ZONE ).toDate();\n}\n\n/**\n * Returns a human-readable time difference between two dates, like human_time_diff() in PHP.\n *\n * @param from From date, in the WP timezone.\n * @param to To date, formatted in the WP timezone.\n *\n * @return Human-readable time difference.\n */\nexport function humanTimeDiff(\n\tfrom: Moment | Date | string | number,\n\tto?: Moment | Date | string | number\n) {\n\tensureWPTimezone();\n\tconst fromMoment = momentLib.tz( from, WP_ZONE );\n\tconst toMoment = to ? momentLib.tz( to, WP_ZONE ) : momentLib.tz( WP_ZONE );\n\treturn fromMoment.from( toMoment );\n}\n\n/**\n * Creates a moment instance using the given timezone or, if none is provided, using global settings.\n *\n * @param dateValue Date object or string, parsable\n * by moment.js.\n * @param timezone Timezone to output result in or a\n * UTC offset. Defaults to timezone from\n * site.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return A moment instance.\n */\nfunction buildMoment(\n\tdateValue: Moment | Date | string | number,\n\ttimezone: string | number = ''\n) {\n\tconst dateMoment = momentLib( dateValue );\n\n\tif ( timezone !== '' ) {\n\t\treturn isUTCOffset( timezone )\n\t\t\t? dateMoment.utcOffset( timezone )\n\t\t\t: // A false isUTCOffset() guarantees that timezone is a string.\n\t\t\t dateMoment.tz( timezone as string );\n\t}\n\n\tif ( settings.timezone.string ) {\n\t\treturn dateMoment.tz( settings.timezone.string );\n\t}\n\n\treturn dateMoment.utcOffset( +settings.timezone.offset );\n}\n\n/**\n * Returns whether a certain UTC offset is valid or not.\n *\n * @param offset a UTC offset.\n *\n * @return whether a certain UTC offset is valid or not.\n */\nfunction isUTCOffset( offset: number | string ) {\n\tif ( 'number' === typeof offset ) {\n\t\treturn true;\n\t}\n\n\treturn VALID_UTC_OFFSET.test( offset );\n}\n\nsetupWPTimezone();\n"],
5
5
  "mappings": ";AAIA,OAAO,eAAe;AACtB,OAAO;AACP,OAAO;AAKP,OAAO,gBAAgB;AAQvB,IAAM,UAAU;AAIhB,IAAM,mBAAmB;AAIzB,IAAI,WAAyB;AAAA,EAC5B,MAAM;AAAA,IACL,QAAQ;AAAA,IACR,QAAQ;AAAA,MACP;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AAEA,SAAO,iBAAiB,KAAM,MAAO;AACtC;AAEA,gBAAgB;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/date",
3
- "version": "5.46.0",
3
+ "version": "5.47.0",
4
4
  "description": "Date module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -43,12 +43,12 @@
43
43
  "wpScript": true,
44
44
  "types": "build-types",
45
45
  "dependencies": {
46
- "@wordpress/deprecated": "^4.46.0",
46
+ "@wordpress/deprecated": "^4.47.0",
47
47
  "moment": "^2.29.4",
48
48
  "moment-timezone": "^0.5.40"
49
49
  },
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "gitHead": "51264e33b95fadff9a06b68141e674ce9cde9675"
53
+ "gitHead": "d653c5fd6161571a0c2ebde28553d6e25624eacc"
54
54
  }
package/src/index.ts CHANGED
@@ -626,7 +626,7 @@ export function humanTimeDiff(
626
626
  * @return A moment instance.
627
627
  */
628
628
  function buildMoment(
629
- dateValue?: Moment | Date | string | number,
629
+ dateValue: Moment | Date | string | number,
630
630
  timezone: string | number = ''
631
631
  ) {
632
632
  const dateMoment = momentLib( dateValue );