@wordpress/date 4.15.1-next.d6164808d3.0 → 4.17.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 +8 -0
- package/README.md +8 -0
- package/build/index.js +27 -2
- package/build/index.js.map +1 -1
- package/build-module/index.js +24 -2
- package/build-module/index.js.map +1 -1
- package/build-types/index.d.ts +7 -0
- package/build-types/index.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/index.js +22 -2
- package/src/test/index.js +20 -20
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -82,6 +82,14 @@ _Returns_
|
|
|
82
82
|
|
|
83
83
|
- `Date`: Date
|
|
84
84
|
|
|
85
|
+
### getSettings
|
|
86
|
+
|
|
87
|
+
Returns the currently defined date settings.
|
|
88
|
+
|
|
89
|
+
_Returns_
|
|
90
|
+
|
|
91
|
+
- `DateSettings`: Settings, including locale data.
|
|
92
|
+
|
|
85
93
|
### gmdate
|
|
86
94
|
|
|
87
95
|
Formats a date (like `date()` in PHP), in the UTC timezone.
|
package/build/index.js
CHANGED
|
@@ -10,6 +10,7 @@ exports.date = date;
|
|
|
10
10
|
exports.dateI18n = dateI18n;
|
|
11
11
|
exports.format = format;
|
|
12
12
|
exports.getDate = getDate;
|
|
13
|
+
exports.getSettings = getSettings;
|
|
13
14
|
exports.gmdate = gmdate;
|
|
14
15
|
exports.gmdateI18n = gmdateI18n;
|
|
15
16
|
exports.isInTheFuture = isInTheFuture;
|
|
@@ -21,10 +22,16 @@ require("moment-timezone/moment-timezone");
|
|
|
21
22
|
|
|
22
23
|
require("moment-timezone/moment-timezone-utils");
|
|
23
24
|
|
|
25
|
+
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
26
|
+
|
|
24
27
|
/**
|
|
25
28
|
* External dependencies
|
|
26
29
|
*/
|
|
27
30
|
|
|
31
|
+
/**
|
|
32
|
+
* WordPress dependencies
|
|
33
|
+
*/
|
|
34
|
+
|
|
28
35
|
/** @typedef {import('moment').Moment} Moment */
|
|
29
36
|
|
|
30
37
|
/** @typedef {import('moment').LocaleSpecification} MomentLocaleSpecification */
|
|
@@ -192,9 +199,24 @@ function setSettings(dateSettings) {
|
|
|
192
199
|
*/
|
|
193
200
|
|
|
194
201
|
|
|
195
|
-
function
|
|
202
|
+
function getSettings() {
|
|
196
203
|
return settings;
|
|
197
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Returns the currently defined date settings.
|
|
207
|
+
*
|
|
208
|
+
* @deprecated
|
|
209
|
+
* @return {DateSettings} Settings, including locale data.
|
|
210
|
+
*/
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
function __experimentalGetSettings() {
|
|
214
|
+
(0, _deprecated.default)('wp.date.__experimentalGetSettings', {
|
|
215
|
+
since: '6.1',
|
|
216
|
+
alternative: 'wp.date.getSettings'
|
|
217
|
+
});
|
|
218
|
+
return getSettings();
|
|
219
|
+
}
|
|
198
220
|
|
|
199
221
|
function setupWPTimezone() {
|
|
200
222
|
// Create WP timezone based off dateSettings.
|
|
@@ -588,7 +610,10 @@ function buildMoment(dateValue) {
|
|
|
588
610
|
const dateMoment = (0, _moment.default)(dateValue);
|
|
589
611
|
|
|
590
612
|
if (timezone && !isUTCOffset(timezone)) {
|
|
591
|
-
|
|
613
|
+
// The ! isUTCOffset() check guarantees that timezone is a string.
|
|
614
|
+
return dateMoment.tz(
|
|
615
|
+
/** @type {string} */
|
|
616
|
+
timezone);
|
|
592
617
|
}
|
|
593
618
|
|
|
594
619
|
if (timezone && isUTCOffset(timezone)) {
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/date/src/index.js"],"names":["WP_ZONE","VALID_UTC_OFFSET","settings","l10n","locale","months","monthsShort","weekdays","weekdaysShort","meridiem","am","pm","AM","PM","relative","future","past","s","ss","m","mm","h","hh","d","dd","M","MM","y","yy","startOfWeek","formats","time","date","datetime","datetimeAbbreviated","timezone","offset","string","abbr","setSettings","dateSettings","setupWPTimezone","momentLib","locales","includes","localeData","longDateFormat","defineLocale","currentLocale","parentLocale","hour","minute","isLowercase","LT","LTS","L","LL","LLL","LLLL","relativeTime","__experimentalGetSettings","tz","add","pack","name","abbrs","untils","offsets","MINUTE_IN_SECONDS","HOUR_IN_MINUTES","HOUR_IN_SECONDS","formatMap","D","j","l","N","S","momentDate","num","format","withOrdinal","replace","w","z","parseInt","toString","W","F","n","t","daysInMonth","isLeapYear","o","Y","a","A","B","timezoned","utcOffset","seconds","minutes","hours","g","G","H","i","u","v","e","I","isDST","O","P","T","Z","sign","parts","substring","split","map","c","r","U","dateFormat","dateValue","Date","char","newFormat","length","push","formatter","join","dateMoment","buildMoment","gmdate","utc","dateI18n","gmdateI18n","undefined","isInTheFuture","now","momentObject","isAfter","getDate","dateString","toDate","isUTCOffset","String","test"],"mappings":";;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMA,OAAO,GAAG,IAAhB,C,CAEA;AACA;;AACA,MAAMC,gBAAgB,GAAG,iCAAzB,C,CAEA;AACA;;AACA;;AACA,IAAIC,QAAQ,GAAG;AACdC,EAAAA,IAAI,EAAE;AACLC,IAAAA,MAAM,EAAE,IADH;AAELC,IAAAA,MAAM,EAAE,CACP,SADO,EAEP,UAFO,EAGP,OAHO,EAIP,OAJO,EAKP,KALO,EAMP,MANO,EAOP,MAPO,EAQP,QARO,EASP,WATO,EAUP,SAVO,EAWP,UAXO,EAYP,UAZO,CAFH;AAgBLC,IAAAA,WAAW,EAAE,CACZ,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G,QAAF,CAA5B,EAA2C;AAC1C,WAAOiG,UAAU,CAAClC,SAAX,CAAsB/D,QAAtB,CAAP;AACA;;AAED,MAAKjC,QAAQ,CAACiC,QAAT,CAAkBE,MAAvB,EAAgC;AAC/B,WAAO+F,UAAU,CAACvE,EAAX,CAAe3D,QAAQ,CAACiC,QAAT,CAAkBE,MAAjC,CAAP;AACA;;AAED,SAAO+F,UAAU,CAAClC,SAAX,CAAsB,CAAChG,QAAQ,CAACiC,QAAT,CAAkBC,MAAzC,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS8G,WAAT,CAAsB9G,MAAtB,EAA+B;AAC9B,MAAK,aAAa,OAAOA,MAAzB,EAAkC;AACjC,WAAO,IAAP;AACA;;AAED,SAAOnC,gBAAgB,CAACmJ,IAAjB,CAAuBhH,MAAvB,CAAP;AACA;;AAEDK,eAAe","sourcesContent":["/**\n * External dependencies\n */\nimport momentLib from 'moment';\nimport 'moment-timezone/moment-timezone';\nimport 'moment-timezone/moment-timezone-utils';\n\n/** @typedef {import('moment').Moment} Moment */\n/** @typedef {import('moment').LocaleSpecification} MomentLocaleSpecification */\n\n/**\n * @typedef MeridiemConfig\n * @property {string} am Lowercase AM.\n * @property {string} AM Uppercase AM.\n * @property {string} pm Lowercase PM.\n * @property {string} PM Uppercase PM.\n */\n\n/**\n * @typedef FormatsConfig\n * @property {string} time Time format.\n * @property {string} date Date format.\n * @property {string} datetime Datetime format.\n * @property {string} datetimeAbbreviated Abbreviated datetime format.\n */\n\n/**\n * @typedef TimezoneConfig\n * @property {string} offset Offset setting.\n * @property {string} string The timezone as a string (e.g., `'America/Los_Angeles'`).\n * @property {string} abbr Abbreviation for the timezone.\n */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @typedef L10nSettings\n * @property {string} locale Moment locale.\n * @property {MomentLocaleSpecification['months']} months Locale months.\n * @property {MomentLocaleSpecification['monthsShort']} monthsShort Locale months short.\n * @property {MomentLocaleSpecification['weekdays']} weekdays Locale weekdays.\n * @property {MomentLocaleSpecification['weekdaysShort']} weekdaysShort Locale weekdays short.\n * @property {MeridiemConfig} meridiem Meridiem config.\n * @property {MomentLocaleSpecification['relativeTime']} relative Relative time config.\n * @property {0|1|2|3|4|5|6} startOfWeek Day that the week starts on.\n */\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * @typedef DateSettings\n * @property {L10nSettings} l10n Localization settings.\n * @property {FormatsConfig} formats Date/time formats config.\n * @property {TimezoneConfig} timezone Timezone settings.\n */\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 made in `lib/client-assets.php` as\n// well because it uses the `setSettings()` function to change these settings.\n/** @type {DateSettings} */\nlet settings = {\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', string: '', abbr: '' },\n};\n\n/**\n * Adds a locale to moment, using the format supplied by `wp_localize_script()`.\n *\n * @param {DateSettings} dateSettings Settings, including locale data.\n */\nexport function setSettings( 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 __experimentalGetSettings() {\n\treturn settings;\n}\n\nfunction setupWPTimezone() {\n\t// Create WP timezone based off dateSettings.\n\tmomentLib.tz.add(\n\t\tmomentLib.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\n// Date constants.\n/**\n * Number of seconds in one minute.\n *\n * @type {number}\n */\nconst MINUTE_IN_SECONDS = 60;\n/**\n * Number of minutes in one hour.\n *\n * @type {number}\n */\nconst HOUR_IN_MINUTES = 60;\n/**\n * Number of seconds in one hour.\n *\n * @type {number}\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 wp.date.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 wp.date.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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tS( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tz( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tt( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tL( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tB( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tI( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tZ( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tr( momentDate ) {\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date.\n */\nexport function format( dateFormat, dateValue = new Date() ) {\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 =\n\t\t\t\tformatMap[ /** @type {keyof formatMap} */ ( char ) ];\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable\n * by moment.js.\n * @param {string | number | undefined} 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( dateFormat, dateValue = new Date(), timezone ) {\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date in English.\n */\nexport function gmdate( dateFormat, dateValue = new Date() ) {\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable by\n * moment.js.\n * @param {string | number | boolean | undefined} 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 {string} Formatted date.\n */\nexport function dateI18n( dateFormat, dateValue = new Date(), timezone ) {\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date.\n */\nexport function gmdateI18n( dateFormat, dateValue = new Date() ) {\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 {string} dateValue Date String or Date object in the Defined WP Timezone.\n *\n * @return {boolean} Is in the future.\n */\nexport function isInTheFuture( dateValue ) {\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 {string?} dateString Date formatted in the WP timezone.\n *\n * @return {Date} Date\n */\nexport function getDate( dateString ) {\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 * Creates a moment instance using the given timezone or, if none is provided, using global settings.\n *\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable\n * by moment.js.\n * @param {string | number | undefined} 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 {Moment} a moment instance.\n */\nfunction buildMoment( dateValue, timezone = '' ) {\n\tconst dateMoment = momentLib( dateValue );\n\n\tif ( timezone && ! isUTCOffset( timezone ) ) {\n\t\treturn dateMoment.tz( String( timezone ) );\n\t}\n\n\tif ( timezone && isUTCOffset( timezone ) ) {\n\t\treturn dateMoment.utcOffset( timezone );\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 {number|string} offset a UTC offset.\n *\n * @return {boolean} whether a certain UTC offset is valid or not.\n */\nfunction isUTCOffset( offset ) {\n\tif ( 'number' === typeof offset ) {\n\t\treturn true;\n\t}\n\n\treturn VALID_UTC_OFFSET.test( offset );\n}\n\nsetupWPTimezone();\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/date/src/index.js"],"names":["WP_ZONE","VALID_UTC_OFFSET","settings","l10n","locale","months","monthsShort","weekdays","weekdaysShort","meridiem","am","pm","AM","PM","relative","future","past","s","ss","m","mm","h","hh","d","dd","M","MM","y","yy","startOfWeek","formats","time","date","datetime","datetimeAbbreviated","timezone","offset","string","abbr","setSettings","dateSettings","setupWPTimezone","momentLib","locales","includes","localeData","longDateFormat","defineLocale","currentLocale","parentLocale","hour","minute","isLowercase","LT","LTS","L","LL","LLL","LLLL","relativeTime","getSettings","__experimentalGetSettings","since","alternative","tz","add","pack","name","abbrs","untils","offsets","MINUTE_IN_SECONDS","HOUR_IN_MINUTES","HOUR_IN_SECONDS","formatMap","D","j","l","N","S","momentDate","num","format","withOrdinal","replace","w","z","parseInt","toString","W","F","n","t","daysInMonth","isLeapYear","o","Y","a","A","B","timezoned","utcOffset","seconds","minutes","hours","g","G","H","i","u","v","e","I","isDST","O","P","T","Z","sign","parts","substring","split","map","c","r","U","dateFormat","dateValue","Date","char","newFormat","length","push","formatter","join","dateMoment","buildMoment","gmdate","utc","dateI18n","gmdateI18n","undefined","isInTheFuture","now","momentObject","isAfter","getDate","dateString","toDate","isUTCOffset","test"],"mappings":";;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;;AAEA;AACA;AACA;A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AlB,EAA+B;AACrC,MAAK,CAAEA,UAAP,EAAoB;AACnB,WAAOzG,gBAAUsB,EAAV,CAAchE,OAAd,EAAwBoJ,MAAxB,EAAP;AACA;;AAED,SAAO1G,gBAAUsB,EAAV,CAAcmF,UAAd,EAA0BnJ,OAA1B,EAAoCoJ,MAApC,EAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASZ,WAAT,CAAsBT,SAAtB,EAAiD;AAAA,MAAhB5F,QAAgB,uEAAL,EAAK;AAChD,QAAMoG,UAAU,GAAG,qBAAWR,SAAX,CAAnB;;AAEA,MAAK5F,QAAQ,IAAI,CAAEkH,WAAW,CAAElH,QAAF,CAA9B,EAA6C;AAC5C;AACA,WAAOoG,UAAU,CAACvE,EAAX;AAAe;AAAwB7B,IAAAA,QAAvC,CAAP;AACA;;AAED,MAAKA,QAAQ,IAAIkH,WAAW,CAAElH,QAAF,CAA5B,EAA2C;AAC1C,WAAOoG,UAAU,CAAClC,SAAX,CAAsBlE,QAAtB,CAAP;AACA;;AAED,MAAKjC,QAAQ,CAACiC,QAAT,CAAkBE,MAAvB,EAAgC;AAC/B,WAAOkG,UAAU,CAACvE,EAAX,CAAe9D,QAAQ,CAACiC,QAAT,CAAkBE,MAAjC,CAAP;AACA;;AAED,SAAOkG,UAAU,CAAClC,SAAX,CAAsB,CAACnG,QAAQ,CAACiC,QAAT,CAAkBC,MAAzC,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASiH,WAAT,CAAsBjH,MAAtB,EAA+B;AAC9B,MAAK,aAAa,OAAOA,MAAzB,EAAkC;AACjC,WAAO,IAAP;AACA;;AAED,SAAOnC,gBAAgB,CAACqJ,IAAjB,CAAuBlH,MAAvB,CAAP;AACA;;AAEDK,eAAe","sourcesContent":["/**\n * External dependencies\n */\nimport momentLib from 'moment';\nimport 'moment-timezone/moment-timezone';\nimport 'moment-timezone/moment-timezone-utils';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/** @typedef {import('moment').Moment} Moment */\n/** @typedef {import('moment').LocaleSpecification} MomentLocaleSpecification */\n\n/**\n * @typedef MeridiemConfig\n * @property {string} am Lowercase AM.\n * @property {string} AM Uppercase AM.\n * @property {string} pm Lowercase PM.\n * @property {string} PM Uppercase PM.\n */\n\n/**\n * @typedef FormatsConfig\n * @property {string} time Time format.\n * @property {string} date Date format.\n * @property {string} datetime Datetime format.\n * @property {string} datetimeAbbreviated Abbreviated datetime format.\n */\n\n/**\n * @typedef TimezoneConfig\n * @property {string} offset Offset setting.\n * @property {string} string The timezone as a string (e.g., `'America/Los_Angeles'`).\n * @property {string} abbr Abbreviation for the timezone.\n */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @typedef L10nSettings\n * @property {string} locale Moment locale.\n * @property {MomentLocaleSpecification['months']} months Locale months.\n * @property {MomentLocaleSpecification['monthsShort']} monthsShort Locale months short.\n * @property {MomentLocaleSpecification['weekdays']} weekdays Locale weekdays.\n * @property {MomentLocaleSpecification['weekdaysShort']} weekdaysShort Locale weekdays short.\n * @property {MeridiemConfig} meridiem Meridiem config.\n * @property {MomentLocaleSpecification['relativeTime']} relative Relative time config.\n * @property {0|1|2|3|4|5|6} startOfWeek Day that the week starts on.\n */\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * @typedef DateSettings\n * @property {L10nSettings} l10n Localization settings.\n * @property {FormatsConfig} formats Date/time formats config.\n * @property {TimezoneConfig} timezone Timezone settings.\n */\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 made in `lib/client-assets.php` as\n// well because it uses the `setSettings()` function to change these settings.\n/** @type {DateSettings} */\nlet settings = {\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', string: '', abbr: '' },\n};\n\n/**\n * Adds a locale to moment, using the format supplied by `wp_localize_script()`.\n *\n * @param {DateSettings} dateSettings Settings, including locale data.\n */\nexport function setSettings( 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\nfunction setupWPTimezone() {\n\t// Create WP timezone based off dateSettings.\n\tmomentLib.tz.add(\n\t\tmomentLib.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\n// Date constants.\n/**\n * Number of seconds in one minute.\n *\n * @type {number}\n */\nconst MINUTE_IN_SECONDS = 60;\n/**\n * Number of minutes in one hour.\n *\n * @type {number}\n */\nconst HOUR_IN_MINUTES = 60;\n/**\n * Number of seconds in one hour.\n *\n * @type {number}\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 wp.date.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 wp.date.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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tS( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tz( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tt( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tL( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tB( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tI( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tZ( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tr( momentDate ) {\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date.\n */\nexport function format( dateFormat, dateValue = new Date() ) {\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 =\n\t\t\t\tformatMap[ /** @type {keyof formatMap} */ ( char ) ];\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable\n * by moment.js.\n * @param {string | number | undefined} 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( dateFormat, dateValue = new Date(), timezone ) {\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date in English.\n */\nexport function gmdate( dateFormat, dateValue = new Date() ) {\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable by\n * moment.js.\n * @param {string | number | boolean | undefined} 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 {string} Formatted date.\n */\nexport function dateI18n( dateFormat, dateValue = new Date(), timezone ) {\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date.\n */\nexport function gmdateI18n( dateFormat, dateValue = new Date() ) {\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 {string} dateValue Date String or Date object in the Defined WP Timezone.\n *\n * @return {boolean} Is in the future.\n */\nexport function isInTheFuture( dateValue ) {\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 {string?} dateString Date formatted in the WP timezone.\n *\n * @return {Date} Date\n */\nexport function getDate( dateString ) {\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 * Creates a moment instance using the given timezone or, if none is provided, using global settings.\n *\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable\n * by moment.js.\n * @param {string | number | undefined} 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 {Moment} a moment instance.\n */\nfunction buildMoment( dateValue, timezone = '' ) {\n\tconst dateMoment = momentLib( dateValue );\n\n\tif ( timezone && ! isUTCOffset( timezone ) ) {\n\t\t// The ! isUTCOffset() check guarantees that timezone is a string.\n\t\treturn dateMoment.tz( /** @type {string} */ ( timezone ) );\n\t}\n\n\tif ( timezone && isUTCOffset( timezone ) ) {\n\t\treturn dateMoment.utcOffset( timezone );\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 {number|string} offset a UTC offset.\n *\n * @return {boolean} whether a certain UTC offset is valid or not.\n */\nfunction isUTCOffset( offset ) {\n\tif ( 'number' === typeof offset ) {\n\t\treturn true;\n\t}\n\n\treturn VALID_UTC_OFFSET.test( offset );\n}\n\nsetupWPTimezone();\n"]}
|
package/build-module/index.js
CHANGED
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
import momentLib from 'moment';
|
|
5
5
|
import 'moment-timezone/moment-timezone';
|
|
6
6
|
import 'moment-timezone/moment-timezone-utils';
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import deprecated from '@wordpress/deprecated';
|
|
7
12
|
/** @typedef {import('moment').Moment} Moment */
|
|
8
13
|
|
|
9
14
|
/** @typedef {import('moment').LocaleSpecification} MomentLocaleSpecification */
|
|
@@ -169,9 +174,23 @@ export function setSettings(dateSettings) {
|
|
|
169
174
|
* @return {DateSettings} Settings, including locale data.
|
|
170
175
|
*/
|
|
171
176
|
|
|
172
|
-
export function
|
|
177
|
+
export function getSettings() {
|
|
173
178
|
return settings;
|
|
174
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* Returns the currently defined date settings.
|
|
182
|
+
*
|
|
183
|
+
* @deprecated
|
|
184
|
+
* @return {DateSettings} Settings, including locale data.
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
export function __experimentalGetSettings() {
|
|
188
|
+
deprecated('wp.date.__experimentalGetSettings', {
|
|
189
|
+
since: '6.1',
|
|
190
|
+
alternative: 'wp.date.getSettings'
|
|
191
|
+
});
|
|
192
|
+
return getSettings();
|
|
193
|
+
}
|
|
175
194
|
|
|
176
195
|
function setupWPTimezone() {
|
|
177
196
|
// Create WP timezone based off dateSettings.
|
|
@@ -556,7 +575,10 @@ function buildMoment(dateValue) {
|
|
|
556
575
|
const dateMoment = momentLib(dateValue);
|
|
557
576
|
|
|
558
577
|
if (timezone && !isUTCOffset(timezone)) {
|
|
559
|
-
|
|
578
|
+
// The ! isUTCOffset() check guarantees that timezone is a string.
|
|
579
|
+
return dateMoment.tz(
|
|
580
|
+
/** @type {string} */
|
|
581
|
+
timezone);
|
|
560
582
|
}
|
|
561
583
|
|
|
562
584
|
if (timezone && isUTCOffset(timezone)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/date/src/index.js"],"names":["momentLib","WP_ZONE","VALID_UTC_OFFSET","settings","l10n","locale","months","monthsShort","weekdays","weekdaysShort","meridiem","am","pm","AM","PM","relative","future","past","s","ss","m","mm","h","hh","d","dd","M","MM","y","yy","startOfWeek","formats","time","date","datetime","datetimeAbbreviated","timezone","offset","string","abbr","setSettings","dateSettings","setupWPTimezone","locales","includes","localeData","longDateFormat","defineLocale","currentLocale","parentLocale","hour","minute","isLowercase","LT","LTS","L","LL","LLL","LLLL","relativeTime","__experimentalGetSettings","tz","add","pack","name","abbrs","untils","offsets","MINUTE_IN_SECONDS","HOUR_IN_MINUTES","HOUR_IN_SECONDS","formatMap","D","j","l","N","S","momentDate","num","format","withOrdinal","replace","w","z","parseInt","toString","W","F","n","t","daysInMonth","isLeapYear","o","Y","a","A","B","timezoned","utcOffset","seconds","minutes","hours","g","G","H","i","u","v","e","I","isDST","O","P","T","Z","sign","parts","substring","split","map","c","r","U","dateFormat","dateValue","Date","char","newFormat","length","push","formatter","join","dateMoment","buildMoment","gmdate","utc","dateI18n","gmdateI18n","undefined","isInTheFuture","now","momentObject","isAfter","getDate","dateString","toDate","isUTCOffset","String","test"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,SAAP,MAAsB,QAAtB;AACA,OAAO,iCAAP;AACA,OAAO,uCAAP;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,OAAO,GAAG,IAAhB,C,CAEA;AACA;;AACA,MAAMC,gBAAgB,GAAG,iCAAzB,C,CAEA;AACA;;AACA;;AACA,IAAIC,QAAQ,GAAG;AACdC,EAAAA,IAAI,EAAE;AACLC,IAAAA,MAAM,EAAE,IADH;AAELC,IAAAA,MAAM,EAAE,CACP,SADO,EAEP,UAFO,EAGP,OAHO,EAIP,OAJO,EAKP,KALO,EAMP,MANO,EAOP,MAPO,EAQP,QARO,EASP,WATO,EAUP,SAVO,EAWP,UAXO,EAYP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AAK;AAChD,QAAMgG,UAAU,GAAGpI,SAAS,CAAE4H,SAAF,CAA5B;;AAEA,MAAKxF,QAAQ,IAAI,CAAE8G,WAAW,CAAE9G,QAAF,CAA9B,EAA6C;AAC5C,WAAOgG,UAAU,CAACvE,EAAX,CAAesF,MAAM,CAAE/G,QAAF,CAArB,CAAP;AACA;;AAED,MAAKA,QAAQ,IAAI8G,WAAW,CAAE9G,QAAF,CAA5B,EAA2C;AAC1C,WAAOgG,UAAU,CAAClC,SAAX,CAAsB9D,QAAtB,CAAP;AACA;;AAED,MAAKjC,QAAQ,CAACiC,QAAT,CAAkBE,MAAvB,EAAgC;AAC/B,WAAO8F,UAAU,CAACvE,EAAX,CAAe1D,QAAQ,CAACiC,QAAT,CAAkBE,MAAjC,CAAP;AACA;;AAED,SAAO8F,UAAU,CAAClC,SAAX,CAAsB,CAAC/F,QAAQ,CAACiC,QAAT,CAAkBC,MAAzC,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS6G,WAAT,CAAsB7G,MAAtB,EAA+B;AAC9B,MAAK,aAAa,OAAOA,MAAzB,EAAkC;AACjC,WAAO,IAAP;AACA;;AAED,SAAOnC,gBAAgB,CAACkJ,IAAjB,CAAuB/G,MAAvB,CAAP;AACA;;AAEDK,eAAe","sourcesContent":["/**\n * External dependencies\n */\nimport momentLib from 'moment';\nimport 'moment-timezone/moment-timezone';\nimport 'moment-timezone/moment-timezone-utils';\n\n/** @typedef {import('moment').Moment} Moment */\n/** @typedef {import('moment').LocaleSpecification} MomentLocaleSpecification */\n\n/**\n * @typedef MeridiemConfig\n * @property {string} am Lowercase AM.\n * @property {string} AM Uppercase AM.\n * @property {string} pm Lowercase PM.\n * @property {string} PM Uppercase PM.\n */\n\n/**\n * @typedef FormatsConfig\n * @property {string} time Time format.\n * @property {string} date Date format.\n * @property {string} datetime Datetime format.\n * @property {string} datetimeAbbreviated Abbreviated datetime format.\n */\n\n/**\n * @typedef TimezoneConfig\n * @property {string} offset Offset setting.\n * @property {string} string The timezone as a string (e.g., `'America/Los_Angeles'`).\n * @property {string} abbr Abbreviation for the timezone.\n */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @typedef L10nSettings\n * @property {string} locale Moment locale.\n * @property {MomentLocaleSpecification['months']} months Locale months.\n * @property {MomentLocaleSpecification['monthsShort']} monthsShort Locale months short.\n * @property {MomentLocaleSpecification['weekdays']} weekdays Locale weekdays.\n * @property {MomentLocaleSpecification['weekdaysShort']} weekdaysShort Locale weekdays short.\n * @property {MeridiemConfig} meridiem Meridiem config.\n * @property {MomentLocaleSpecification['relativeTime']} relative Relative time config.\n * @property {0|1|2|3|4|5|6} startOfWeek Day that the week starts on.\n */\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * @typedef DateSettings\n * @property {L10nSettings} l10n Localization settings.\n * @property {FormatsConfig} formats Date/time formats config.\n * @property {TimezoneConfig} timezone Timezone settings.\n */\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 made in `lib/client-assets.php` as\n// well because it uses the `setSettings()` function to change these settings.\n/** @type {DateSettings} */\nlet settings = {\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', string: '', abbr: '' },\n};\n\n/**\n * Adds a locale to moment, using the format supplied by `wp_localize_script()`.\n *\n * @param {DateSettings} dateSettings Settings, including locale data.\n */\nexport function setSettings( 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 __experimentalGetSettings() {\n\treturn settings;\n}\n\nfunction setupWPTimezone() {\n\t// Create WP timezone based off dateSettings.\n\tmomentLib.tz.add(\n\t\tmomentLib.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\n// Date constants.\n/**\n * Number of seconds in one minute.\n *\n * @type {number}\n */\nconst MINUTE_IN_SECONDS = 60;\n/**\n * Number of minutes in one hour.\n *\n * @type {number}\n */\nconst HOUR_IN_MINUTES = 60;\n/**\n * Number of seconds in one hour.\n *\n * @type {number}\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 wp.date.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 wp.date.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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tS( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tz( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tt( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tL( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tB( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tI( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tZ( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tr( momentDate ) {\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date.\n */\nexport function format( dateFormat, dateValue = new Date() ) {\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 =\n\t\t\t\tformatMap[ /** @type {keyof formatMap} */ ( char ) ];\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable\n * by moment.js.\n * @param {string | number | undefined} 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( dateFormat, dateValue = new Date(), timezone ) {\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date in English.\n */\nexport function gmdate( dateFormat, dateValue = new Date() ) {\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable by\n * moment.js.\n * @param {string | number | boolean | undefined} 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 {string} Formatted date.\n */\nexport function dateI18n( dateFormat, dateValue = new Date(), timezone ) {\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date.\n */\nexport function gmdateI18n( dateFormat, dateValue = new Date() ) {\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 {string} dateValue Date String or Date object in the Defined WP Timezone.\n *\n * @return {boolean} Is in the future.\n */\nexport function isInTheFuture( dateValue ) {\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 {string?} dateString Date formatted in the WP timezone.\n *\n * @return {Date} Date\n */\nexport function getDate( dateString ) {\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 * Creates a moment instance using the given timezone or, if none is provided, using global settings.\n *\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable\n * by moment.js.\n * @param {string | number | undefined} 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 {Moment} a moment instance.\n */\nfunction buildMoment( dateValue, timezone = '' ) {\n\tconst dateMoment = momentLib( dateValue );\n\n\tif ( timezone && ! isUTCOffset( timezone ) ) {\n\t\treturn dateMoment.tz( String( timezone ) );\n\t}\n\n\tif ( timezone && isUTCOffset( timezone ) ) {\n\t\treturn dateMoment.utcOffset( timezone );\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 {number|string} offset a UTC offset.\n *\n * @return {boolean} whether a certain UTC offset is valid or not.\n */\nfunction isUTCOffset( offset ) {\n\tif ( 'number' === typeof offset ) {\n\t\treturn true;\n\t}\n\n\treturn VALID_UTC_OFFSET.test( offset );\n}\n\nsetupWPTimezone();\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/date/src/index.js"],"names":["momentLib","deprecated","WP_ZONE","VALID_UTC_OFFSET","settings","l10n","locale","months","monthsShort","weekdays","weekdaysShort","meridiem","am","pm","AM","PM","relative","future","past","s","ss","m","mm","h","hh","d","dd","M","MM","y","yy","startOfWeek","formats","time","date","datetime","datetimeAbbreviated","timezone","offset","string","abbr","setSettings","dateSettings","setupWPTimezone","locales","includes","localeData","longDateFormat","defineLocale","currentLocale","parentLocale","hour","minute","isLowercase","LT","LTS","L","LL","LLL","LLLL","relativeTime","getSettings","__experimentalGetSettings","since","alternative","tz","add","pack","name","abbrs","untils","offsets","MINUTE_IN_SECONDS","HOUR_IN_MINUTES","HOUR_IN_SECONDS","formatMap","D","j","l","N","S","momentDate","num","format","withOrdinal","replace","w","z","parseInt","toString","W","F","n","t","daysInMonth","isLeapYear","o","Y","a","A","B","timezoned","utcOffset","seconds","minutes","hours","g","G","H","i","u","v","e","I","isDST","O","P","T","Z","sign","parts","substring","split","map","c","r","U","dateFormat","dateValue","Date","char","newFormat","length","push","formatter","join","dateMoment","buildMoment","gmdate","utc","dateI18n","gmdateI18n","undefined","isInTheFuture","now","momentObject","isAfter","getDate","dateString","toDate","isUTCOffset","test"],"mappings":"AAAA;AACA;AACA;AACA,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AQ,CAACiC,QAAT,CAAkBE,MAAvB,EAAgC;AAC/B,WAAOiG,UAAU,CAACvE,EAAX,CAAe7D,QAAQ,CAACiC,QAAT,CAAkBE,MAAjC,CAAP;AACA;;AAED,SAAOiG,UAAU,CAAClC,SAAX,CAAsB,CAAClG,QAAQ,CAACiC,QAAT,CAAkBC,MAAzC,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASgH,WAAT,CAAsBhH,MAAtB,EAA+B;AAC9B,MAAK,aAAa,OAAOA,MAAzB,EAAkC;AACjC,WAAO,IAAP;AACA;;AAED,SAAOnC,gBAAgB,CAACoJ,IAAjB,CAAuBjH,MAAvB,CAAP;AACA;;AAEDK,eAAe","sourcesContent":["/**\n * External dependencies\n */\nimport momentLib from 'moment';\nimport 'moment-timezone/moment-timezone';\nimport 'moment-timezone/moment-timezone-utils';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/** @typedef {import('moment').Moment} Moment */\n/** @typedef {import('moment').LocaleSpecification} MomentLocaleSpecification */\n\n/**\n * @typedef MeridiemConfig\n * @property {string} am Lowercase AM.\n * @property {string} AM Uppercase AM.\n * @property {string} pm Lowercase PM.\n * @property {string} PM Uppercase PM.\n */\n\n/**\n * @typedef FormatsConfig\n * @property {string} time Time format.\n * @property {string} date Date format.\n * @property {string} datetime Datetime format.\n * @property {string} datetimeAbbreviated Abbreviated datetime format.\n */\n\n/**\n * @typedef TimezoneConfig\n * @property {string} offset Offset setting.\n * @property {string} string The timezone as a string (e.g., `'America/Los_Angeles'`).\n * @property {string} abbr Abbreviation for the timezone.\n */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @typedef L10nSettings\n * @property {string} locale Moment locale.\n * @property {MomentLocaleSpecification['months']} months Locale months.\n * @property {MomentLocaleSpecification['monthsShort']} monthsShort Locale months short.\n * @property {MomentLocaleSpecification['weekdays']} weekdays Locale weekdays.\n * @property {MomentLocaleSpecification['weekdaysShort']} weekdaysShort Locale weekdays short.\n * @property {MeridiemConfig} meridiem Meridiem config.\n * @property {MomentLocaleSpecification['relativeTime']} relative Relative time config.\n * @property {0|1|2|3|4|5|6} startOfWeek Day that the week starts on.\n */\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * @typedef DateSettings\n * @property {L10nSettings} l10n Localization settings.\n * @property {FormatsConfig} formats Date/time formats config.\n * @property {TimezoneConfig} timezone Timezone settings.\n */\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 made in `lib/client-assets.php` as\n// well because it uses the `setSettings()` function to change these settings.\n/** @type {DateSettings} */\nlet settings = {\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', string: '', abbr: '' },\n};\n\n/**\n * Adds a locale to moment, using the format supplied by `wp_localize_script()`.\n *\n * @param {DateSettings} dateSettings Settings, including locale data.\n */\nexport function setSettings( 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\nfunction setupWPTimezone() {\n\t// Create WP timezone based off dateSettings.\n\tmomentLib.tz.add(\n\t\tmomentLib.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\n// Date constants.\n/**\n * Number of seconds in one minute.\n *\n * @type {number}\n */\nconst MINUTE_IN_SECONDS = 60;\n/**\n * Number of minutes in one hour.\n *\n * @type {number}\n */\nconst HOUR_IN_MINUTES = 60;\n/**\n * Number of seconds in one hour.\n *\n * @type {number}\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 wp.date.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 wp.date.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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tS( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tz( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tt( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tL( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tB( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tI( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tZ( momentDate ) {\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 {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tr( momentDate ) {\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date.\n */\nexport function format( dateFormat, dateValue = new Date() ) {\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 =\n\t\t\t\tformatMap[ /** @type {keyof formatMap} */ ( char ) ];\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable\n * by moment.js.\n * @param {string | number | undefined} 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( dateFormat, dateValue = new Date(), timezone ) {\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date in English.\n */\nexport function gmdate( dateFormat, dateValue = new Date() ) {\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable by\n * moment.js.\n * @param {string | number | boolean | undefined} 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 {string} Formatted date.\n */\nexport function dateI18n( dateFormat, dateValue = new Date(), timezone ) {\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 {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date.\n */\nexport function gmdateI18n( dateFormat, dateValue = new Date() ) {\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 {string} dateValue Date String or Date object in the Defined WP Timezone.\n *\n * @return {boolean} Is in the future.\n */\nexport function isInTheFuture( dateValue ) {\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 {string?} dateString Date formatted in the WP timezone.\n *\n * @return {Date} Date\n */\nexport function getDate( dateString ) {\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 * Creates a moment instance using the given timezone or, if none is provided, using global settings.\n *\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable\n * by moment.js.\n * @param {string | number | undefined} 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 {Moment} a moment instance.\n */\nfunction buildMoment( dateValue, timezone = '' ) {\n\tconst dateMoment = momentLib( dateValue );\n\n\tif ( timezone && ! isUTCOffset( timezone ) ) {\n\t\t// The ! isUTCOffset() check guarantees that timezone is a string.\n\t\treturn dateMoment.tz( /** @type {string} */ ( timezone ) );\n\t}\n\n\tif ( timezone && isUTCOffset( timezone ) ) {\n\t\treturn dateMoment.utcOffset( timezone );\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 {number|string} offset a UTC offset.\n *\n * @return {boolean} whether a certain UTC offset is valid or not.\n */\nfunction isUTCOffset( offset ) {\n\tif ( 'number' === typeof offset ) {\n\t\treturn true;\n\t}\n\n\treturn VALID_UTC_OFFSET.test( offset );\n}\n\nsetupWPTimezone();\n"]}
|
package/build-types/index.d.ts
CHANGED
|
@@ -9,6 +9,13 @@ export function setSettings(dateSettings: DateSettings): void;
|
|
|
9
9
|
*
|
|
10
10
|
* @return {DateSettings} Settings, including locale data.
|
|
11
11
|
*/
|
|
12
|
+
export function getSettings(): DateSettings;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the currently defined date settings.
|
|
15
|
+
*
|
|
16
|
+
* @deprecated
|
|
17
|
+
* @return {DateSettings} Settings, including locale data.
|
|
18
|
+
*/
|
|
12
19
|
export function __experimentalGetSettings(): DateSettings;
|
|
13
20
|
/**
|
|
14
21
|
* Formats a date. Does not alter the date's timezone.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAyIA;;;;GAIG;AACH,0CAFW,YAAY,QA8DtB;AAED;;;;GAIG;AACH,+BAFY,YAAY,CAIvB;AAED;;;;;GAKG;AACH,6CAFY,YAAY,CAQvB;AAuMD;;;;;;;;;GASG;AACH,mCAPW,MAAM,cAEN,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,GAGjC,MAAM,CAgCjB;AAED;;;;;;;;;;;;;;;GAeG;AACH,iCAbW,MAAM,aAEN,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG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
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.17.0",
|
|
4
4
|
"description": "Date module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,11 +27,12 @@
|
|
|
27
27
|
"types": "build-types",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
+
"@wordpress/deprecated": "^3.17.0",
|
|
30
31
|
"moment": "^2.22.1",
|
|
31
32
|
"moment-timezone": "^0.5.31"
|
|
32
33
|
},
|
|
33
34
|
"publishConfig": {
|
|
34
35
|
"access": "public"
|
|
35
36
|
},
|
|
36
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "0d732d4b184adcb28cc83087603e81b764390d4b"
|
|
37
38
|
}
|
package/src/index.js
CHANGED
|
@@ -5,6 +5,11 @@ import momentLib from 'moment';
|
|
|
5
5
|
import 'moment-timezone/moment-timezone';
|
|
6
6
|
import 'moment-timezone/moment-timezone-utils';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
import deprecated from '@wordpress/deprecated';
|
|
12
|
+
|
|
8
13
|
/** @typedef {import('moment').Moment} Moment */
|
|
9
14
|
/** @typedef {import('moment').LocaleSpecification} MomentLocaleSpecification */
|
|
10
15
|
|
|
@@ -202,10 +207,24 @@ export function setSettings( dateSettings ) {
|
|
|
202
207
|
*
|
|
203
208
|
* @return {DateSettings} Settings, including locale data.
|
|
204
209
|
*/
|
|
205
|
-
export function
|
|
210
|
+
export function getSettings() {
|
|
206
211
|
return settings;
|
|
207
212
|
}
|
|
208
213
|
|
|
214
|
+
/**
|
|
215
|
+
* Returns the currently defined date settings.
|
|
216
|
+
*
|
|
217
|
+
* @deprecated
|
|
218
|
+
* @return {DateSettings} Settings, including locale data.
|
|
219
|
+
*/
|
|
220
|
+
export function __experimentalGetSettings() {
|
|
221
|
+
deprecated( 'wp.date.__experimentalGetSettings', {
|
|
222
|
+
since: '6.1',
|
|
223
|
+
alternative: 'wp.date.getSettings',
|
|
224
|
+
} );
|
|
225
|
+
return getSettings();
|
|
226
|
+
}
|
|
227
|
+
|
|
209
228
|
function setupWPTimezone() {
|
|
210
229
|
// Create WP timezone based off dateSettings.
|
|
211
230
|
momentLib.tz.add(
|
|
@@ -580,7 +599,8 @@ function buildMoment( dateValue, timezone = '' ) {
|
|
|
580
599
|
const dateMoment = momentLib( dateValue );
|
|
581
600
|
|
|
582
601
|
if ( timezone && ! isUTCOffset( timezone ) ) {
|
|
583
|
-
|
|
602
|
+
// The ! isUTCOffset() check guarantees that timezone is a string.
|
|
603
|
+
return dateMoment.tz( /** @type {string} */ ( timezone ) );
|
|
584
604
|
}
|
|
585
605
|
|
|
586
606
|
if ( timezone && isUTCOffset( timezone ) ) {
|
package/src/test/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
getSettings,
|
|
6
6
|
date as dateNoI18n,
|
|
7
7
|
dateI18n,
|
|
8
8
|
getDate,
|
|
@@ -28,7 +28,7 @@ describe( 'isInTheFuture', () => {
|
|
|
28
28
|
} );
|
|
29
29
|
|
|
30
30
|
it( 'should ignore the timezone', () => {
|
|
31
|
-
const settings =
|
|
31
|
+
const settings = getSettings();
|
|
32
32
|
|
|
33
33
|
// Set a timezone in the future.
|
|
34
34
|
setSettings( {
|
|
@@ -75,7 +75,7 @@ describe( 'Function date', () => {
|
|
|
75
75
|
] )(
|
|
76
76
|
'should format date as "%s", ignoring locale settings',
|
|
77
77
|
( formatString, expected ) => {
|
|
78
|
-
const settings =
|
|
78
|
+
const settings = getSettings();
|
|
79
79
|
|
|
80
80
|
// Simulate different locale.
|
|
81
81
|
const l10n = settings.l10n;
|
|
@@ -110,7 +110,7 @@ describe( 'Function date', () => {
|
|
|
110
110
|
);
|
|
111
111
|
|
|
112
112
|
it( 'should format date into a date that uses site’s timezone, if no timezone was provided and there’s a site timezone set', () => {
|
|
113
|
-
const settings =
|
|
113
|
+
const settings = getSettings();
|
|
114
114
|
|
|
115
115
|
// Simulate different timezone.
|
|
116
116
|
setSettings( {
|
|
@@ -136,7 +136,7 @@ describe( 'Function date', () => {
|
|
|
136
136
|
} );
|
|
137
137
|
|
|
138
138
|
it( 'should format date into a date that uses site’s UTC offset setting, if no timezone was provided and there isn’t a timezone set in the site', () => {
|
|
139
|
-
const settings =
|
|
139
|
+
const settings = getSettings();
|
|
140
140
|
|
|
141
141
|
// Simulate different timezone.
|
|
142
142
|
setSettings( {
|
|
@@ -162,7 +162,7 @@ describe( 'Function date', () => {
|
|
|
162
162
|
} );
|
|
163
163
|
|
|
164
164
|
it( 'should format date into a date that uses the given timezone, if said timezone is valid', () => {
|
|
165
|
-
const settings =
|
|
165
|
+
const settings = getSettings();
|
|
166
166
|
|
|
167
167
|
// Simulate different timezone.
|
|
168
168
|
setSettings( {
|
|
@@ -183,7 +183,7 @@ describe( 'Function date', () => {
|
|
|
183
183
|
} );
|
|
184
184
|
|
|
185
185
|
it( 'should format date into a date that uses the given UTC offset, if given timezone is actually a UTC offset', () => {
|
|
186
|
-
const settings =
|
|
186
|
+
const settings = getSettings();
|
|
187
187
|
|
|
188
188
|
// Simulate different timezone.
|
|
189
189
|
setSettings( {
|
|
@@ -246,7 +246,7 @@ describe( 'Function gmdate', () => {
|
|
|
246
246
|
] )(
|
|
247
247
|
'should format date as "%s", ignoring locale settings',
|
|
248
248
|
( formatString, expected ) => {
|
|
249
|
-
const settings =
|
|
249
|
+
const settings = getSettings();
|
|
250
250
|
|
|
251
251
|
// Simulate different locale.
|
|
252
252
|
const l10n = settings.l10n;
|
|
@@ -281,7 +281,7 @@ describe( 'Function gmdate', () => {
|
|
|
281
281
|
);
|
|
282
282
|
|
|
283
283
|
it( 'should format date into a UTC date', () => {
|
|
284
|
-
const settings =
|
|
284
|
+
const settings = getSettings();
|
|
285
285
|
|
|
286
286
|
// Simulate different timezone.
|
|
287
287
|
setSettings( {
|
|
@@ -325,7 +325,7 @@ describe( 'Function dateI18n', () => {
|
|
|
325
325
|
] )(
|
|
326
326
|
'should format date as "%s", using locale settings',
|
|
327
327
|
( formatString, expected ) => {
|
|
328
|
-
const settings =
|
|
328
|
+
const settings = getSettings();
|
|
329
329
|
|
|
330
330
|
// Simulate different locale.
|
|
331
331
|
const l10n = settings.l10n;
|
|
@@ -361,7 +361,7 @@ describe( 'Function dateI18n', () => {
|
|
|
361
361
|
);
|
|
362
362
|
|
|
363
363
|
it( 'should format date into a date that uses site’s timezone, if no timezone was provided and there’s a site timezone set', () => {
|
|
364
|
-
const settings =
|
|
364
|
+
const settings = getSettings();
|
|
365
365
|
|
|
366
366
|
// Simulate different timezone.
|
|
367
367
|
setSettings( {
|
|
@@ -387,7 +387,7 @@ describe( 'Function dateI18n', () => {
|
|
|
387
387
|
} );
|
|
388
388
|
|
|
389
389
|
it( 'should format date into a date that uses site’s UTC offset setting, if no timezone was provided and there isn’t a timezone set in the site', () => {
|
|
390
|
-
const settings =
|
|
390
|
+
const settings = getSettings();
|
|
391
391
|
|
|
392
392
|
// Simulate different timezone.
|
|
393
393
|
setSettings( {
|
|
@@ -413,7 +413,7 @@ describe( 'Function dateI18n', () => {
|
|
|
413
413
|
} );
|
|
414
414
|
|
|
415
415
|
it( 'should format date into a date that uses the given timezone, if said timezone is valid', () => {
|
|
416
|
-
const settings =
|
|
416
|
+
const settings = getSettings();
|
|
417
417
|
|
|
418
418
|
// Simulate different timezone.
|
|
419
419
|
setSettings( {
|
|
@@ -434,7 +434,7 @@ describe( 'Function dateI18n', () => {
|
|
|
434
434
|
} );
|
|
435
435
|
|
|
436
436
|
it( 'should format date into a date that uses the given UTC offset, if given timezone is actually a UTC offset', () => {
|
|
437
|
-
const settings =
|
|
437
|
+
const settings = getSettings();
|
|
438
438
|
|
|
439
439
|
// Simulate different timezone.
|
|
440
440
|
setSettings( {
|
|
@@ -466,7 +466,7 @@ describe( 'Function dateI18n', () => {
|
|
|
466
466
|
} );
|
|
467
467
|
|
|
468
468
|
it( 'should format date into a UTC date if `gmt` is set to `true`', () => {
|
|
469
|
-
const settings =
|
|
469
|
+
const settings = getSettings();
|
|
470
470
|
|
|
471
471
|
// Simulate different timezone.
|
|
472
472
|
setSettings( {
|
|
@@ -487,7 +487,7 @@ describe( 'Function dateI18n', () => {
|
|
|
487
487
|
} );
|
|
488
488
|
|
|
489
489
|
it( 'should format date into a date that uses site’s timezone if `gmt` is set to `false`', () => {
|
|
490
|
-
const settings =
|
|
490
|
+
const settings = getSettings();
|
|
491
491
|
|
|
492
492
|
// Simulate different timezone.
|
|
493
493
|
setSettings( {
|
|
@@ -535,7 +535,7 @@ describe( 'Function gmdateI18n', () => {
|
|
|
535
535
|
] )(
|
|
536
536
|
'should format date as "%s", using locale settings',
|
|
537
537
|
( formatString, expected ) => {
|
|
538
|
-
const settings =
|
|
538
|
+
const settings = getSettings();
|
|
539
539
|
|
|
540
540
|
// Simulate different locale.
|
|
541
541
|
const l10n = settings.l10n;
|
|
@@ -570,7 +570,7 @@ describe( 'Function gmdateI18n', () => {
|
|
|
570
570
|
);
|
|
571
571
|
|
|
572
572
|
it( 'should format date into a UTC date', () => {
|
|
573
|
-
const settings =
|
|
573
|
+
const settings = getSettings();
|
|
574
574
|
|
|
575
575
|
// Simulate different timezone.
|
|
576
576
|
setSettings( {
|
|
@@ -592,7 +592,7 @@ describe( 'Function gmdateI18n', () => {
|
|
|
592
592
|
|
|
593
593
|
describe( 'Moment.js Localization', () => {
|
|
594
594
|
it( 'should change the relative time strings', () => {
|
|
595
|
-
const settings =
|
|
595
|
+
const settings = getSettings();
|
|
596
596
|
|
|
597
597
|
// Change the locale strings for tests.
|
|
598
598
|
setSettings( {
|
|
@@ -608,7 +608,7 @@ describe( 'Moment.js Localization', () => {
|
|
|
608
608
|
} );
|
|
609
609
|
|
|
610
610
|
// Get the freshly changed setings.
|
|
611
|
-
const newSettings =
|
|
611
|
+
const newSettings = getSettings();
|
|
612
612
|
|
|
613
613
|
// Test the unchanged values.
|
|
614
614
|
expect( newSettings.l10n.locale ).toBe( settings.l10n.locale );
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/moment/moment.d.ts","../../node_modules/moment-timezone/index.d.ts","../../node_modules/moment-timezone/moment-timezone-utils.d.ts","./src/index.js"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","eb75e89d63b3b72dd9ca8b0cac801cecae5be352307c004adeaa60bc9d6df51f","2cc028cd0bdb35b1b5eb723d84666a255933fffbea607f72cbd0c7c7b4bee144",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"cd6efb9467a8b6338ece2e2855e37765700f2cd061ca54b01b33878cf5c7677e","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},"f2b43a96a09d31d1be3aab9a84311b407b72b8e3705af970f2e8f9173aacb470","8621a7b709bc463d5ab5a96d95bae465323fbf80b8a3d9eff5d2d6b60c795dd1","d6c98241d79795637aeabaf26de83c65890de10a79dd18039fc32d380212f42e","
|
|
1
|
+
{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/moment/moment.d.ts","../../node_modules/moment-timezone/index.d.ts","../../node_modules/moment-timezone/moment-timezone-utils.d.ts","../../node_modules/utility-types/dist/aliases-and-guards.d.ts","../../node_modules/utility-types/dist/mapped-types.d.ts","../../node_modules/utility-types/dist/utility-types.d.ts","../../node_modules/utility-types/dist/functional-helpers.d.ts","../../node_modules/utility-types/dist/index.d.ts","../deprecated/build-types/index.d.ts","./src/index.js"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","eb75e89d63b3b72dd9ca8b0cac801cecae5be352307c004adeaa60bc9d6df51f","2cc028cd0bdb35b1b5eb723d84666a255933fffbea607f72cbd0c7c7b4bee144",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"cd6efb9467a8b6338ece2e2855e37765700f2cd061ca54b01b33878cf5c7677e","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},"f2b43a96a09d31d1be3aab9a84311b407b72b8e3705af970f2e8f9173aacb470","8621a7b709bc463d5ab5a96d95bae465323fbf80b8a3d9eff5d2d6b60c795dd1","d6c98241d79795637aeabaf26de83c65890de10a79dd18039fc32d380212f42e","bd0d80db12ef1aceefc4f9d3eb88517b9634fa747ae8475981da8655292feab8","55e68fb1618e3f55f7866b8c8415152159309a14b716370081ab0b7af96d876e","bf0491af2455f92282b61807be2be6e7ad7d532e47fac7b698019d3617c28ff7","5d874fb879ab8601c02549817dceb2d0a30729cb7e161625dd6f819bbff1ec0b","ee551a880882770c4f56a0964a9767c9feafe497a5be52652527d098c88d85cb","b192606574769a5566620f9bf19358a3994bc2726ecdeaad9c66f3333b2687c8","dfc3f8deb300c35569667503e44774c204f8f69f26e9ec8ed0dc65d28701a685"],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"importsNotUsedAsValues":2,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":false,"rootDir":"./src","strict":true,"target":99},"fileIdsList":[[45,47],[45,46],[48,49,50,51],[48],[49],[45,47,53],[52]],"referencedMap":[[46,1],[47,2],[52,3],[49,4],[50,5],[54,6],[53,7]],"exportedModulesMap":[[46,1],[47,2],[52,3],[49,4],[50,5],[54,6],[53,7]],"semanticDiagnosticsPerFile":[46,47,45,10,12,11,2,13,14,15,16,17,18,19,20,3,4,24,21,22,23,25,26,27,5,28,29,30,31,6,32,33,34,35,7,40,36,37,38,39,8,41,42,43,1,9,44,48,51,52,49,50,54,53]},"version":"4.4.2"}
|