@wordpress/date 4.5.0 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 4.7.0 (2022-04-21)
6
+
7
+ ## 4.6.0 (2022-04-08)
8
+
5
9
  ## 4.5.0 (2022-03-23)
6
10
 
7
11
  ## 4.4.0 (2022-03-11)
package/build/index.js CHANGED
@@ -130,13 +130,30 @@ let settings = {
130
130
  */
131
131
 
132
132
  function setSettings(dateSettings) {
133
- settings = dateSettings; // Backup and restore current locale.
133
+ settings = dateSettings;
134
+ setupWPTimezone(); // Does moment already have a locale with the right name?
135
+
136
+ if (_moment.default.locales().includes(dateSettings.l10n.locale)) {
137
+ // Is that locale misconfigured, e.g. because we are on a site running
138
+ // WordPress < 6.0?
139
+ if (_moment.default.localeData(dateSettings.l10n.locale).longDateFormat('LTS') === null) {
140
+ // Delete the misconfigured locale.
141
+ // @ts-ignore Type definitions are incorrect - null is permitted.
142
+ _moment.default.defineLocale(dateSettings.l10n.locale, null);
143
+ } else {
144
+ // We have a properly configured locale, so no need to create one.
145
+ return;
146
+ }
147
+ } // defineLocale() will modify the current locale, so back it up.
148
+
149
+
150
+ const currentLocale = _moment.default.locale(); // Create locale.
134
151
 
135
- const currentLocale = _moment.default.locale();
136
152
 
137
- _moment.default.updateLocale(dateSettings.l10n.locale, {
138
- // Inherit anything missing from the default locale.
139
- parentLocale: currentLocale,
153
+ _moment.default.defineLocale(dateSettings.l10n.locale, {
154
+ // Inherit anything missing from English. We don't load
155
+ // moment-with-locales.js so English is all there is.
156
+ parentLocale: 'en',
140
157
  months: dateSettings.l10n.months,
141
158
  monthsShort: dateSettings.l10n.monthsShort,
142
159
  weekdays: dateSettings.l10n.weekdays,
@@ -152,23 +169,19 @@ function setSettings(dateSettings) {
152
169
 
153
170
  longDateFormat: {
154
171
  LT: dateSettings.formats.time,
155
- // @ts-ignore Forcing this to `null`
156
- LTS: null,
157
- // @ts-ignore Forcing this to `null`
158
- L: null,
172
+ LTS: _moment.default.localeData('en').longDateFormat('LTS'),
173
+ L: _moment.default.localeData('en').longDateFormat('L'),
159
174
  LL: dateSettings.formats.date,
160
175
  LLL: dateSettings.formats.datetime,
161
- // @ts-ignore Forcing this to `null`
162
- LLLL: null
176
+ LLLL: _moment.default.localeData('en').longDateFormat('LLLL')
163
177
  },
164
178
  // From human_time_diff?
165
179
  // Set to `(number, withoutSuffix, key, isFuture) => {}` instead.
166
180
  relativeTime: dateSettings.l10n.relative
167
- });
181
+ }); // Restore the locale to what it was.
168
182
 
169
- _moment.default.locale(currentLocale);
170
183
 
171
- setupWPTimezone();
184
+ _moment.default.locale(currentLocale);
172
185
  }
173
186
  /**
174
187
  * Returns the currently defined date settings.
@@ -357,8 +370,20 @@ const formatMap = {
357
370
 
358
371
  // Full date/time.
359
372
  c: 'YYYY-MM-DDTHH:mm:ssZ',
373
+
360
374
  // .toISOString.
361
- r: 'ddd, D MMM YYYY HH:mm:ss ZZ',
375
+
376
+ /**
377
+ * Formats the date as RFC2822.
378
+ *
379
+ * @param {Moment} momentDate Moment instance.
380
+ *
381
+ * @return {string} Formatted date.
382
+ */
383
+ r(momentDate) {
384
+ return momentDate.locale('en').format('ddd, DD MMM YYYY HH:mm:ss ZZ');
385
+ },
386
+
362
387
  U: 'X'
363
388
  };
364
389
  /**
@@ -572,7 +597,7 @@ function buildMoment(dateValue) {
572
597
  return dateMoment.tz(settings.timezone.string);
573
598
  }
574
599
 
575
- return dateMoment.utcOffset(settings.timezone.offset);
600
+ return dateMoment.utcOffset(+settings.timezone.offset);
576
601
  }
577
602
  /**
578
603
  * Returns whether a certain UTC offset is valid or not.
@@ -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","formats","time","date","datetime","datetimeAbbreviated","timezone","offset","string","abbr","setSettings","dateSettings","currentLocale","momentLib","updateLocale","parentLocale","hour","minute","isLowercase","longDateFormat","LT","LTS","L","LL","LLL","LLLL","relativeTime","setupWPTimezone","__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","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;;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,I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,OAAd,EAAwB6I,MAAxB,EAAP;AACA;;AAED,SAAOpG,gBAAUgB,EAAV,CAAcmF,UAAd,EAA0B5I,OAA1B,EAAoC6I,MAApC,EAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASZ,WAAT,CAAsBT,SAAtB,EAAiD;AAAA,MAAhBtF,QAAgB,uEAAL,EAAK;AAChD,QAAM8F,UAAU,GAAG,qBAAWR,SAAX,CAAnB;;AAEA,MAAKtF,QAAQ,IAAI,CAAE4G,WAAW,CAAE5G,QAAF,CAA9B,EAA6C;AAC5C,WAAO8F,UAAU,CAACvE,EAAX,CAAevB,QAAf,CAAP;AACA;;AAED,MAAKA,QAAQ,IAAI4G,WAAW,CAAE5G,QAAF,CAA5B,EAA2C;AAC1C,WAAO8F,UAAU,CAAClC,SAAX,CAAsB5D,QAAtB,CAAP;AACA;;AAED,MAAKhC,QAAQ,CAACgC,QAAT,CAAkBE,MAAvB,EAAgC;AAC/B,WAAO4F,UAAU,CAACvE,EAAX,CAAevD,QAAQ,CAACgC,QAAT,CAAkBE,MAAjC,CAAP;AACA;;AAED,SAAO4F,UAAU,CAAClC,SAAX,CAAsB5F,QAAQ,CAACgC,QAAT,CAAkBC,MAAxC,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS2G,WAAT,CAAsB3G,MAAtB,EAA+B;AAC9B,MAAK,aAAa,OAAOA,MAAzB,EAAkC;AACjC,WAAO,IAAP;AACA;;AAED,SAAOlC,gBAAgB,CAAC8I,IAAjB,CAAuB5G,MAAvB,CAAP;AACA;;AAEDoB,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 */\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},\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\t// Backup and restore current locale.\n\tconst currentLocale = momentLib.locale();\n\tmomentLib.updateLocale( dateSettings.l10n.locale, {\n\t\t// Inherit anything missing from the default locale.\n\t\tparentLocale: currentLocale,\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\t// @ts-ignore Forcing this to `null`\n\t\t\tLTS: null,\n\t\t\t// @ts-ignore Forcing this to `null`\n\t\t\tL: null,\n\t\t\tLL: dateSettings.formats.date,\n\t\t\tLLL: dateSettings.formats.datetime,\n\t\t\t// @ts-ignore Forcing this to `null`\n\t\t\tLLLL: null,\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\tmomentLib.locale( currentLocale );\n\n\tsetupWPTimezone();\n}\n\n/**\n * Returns the currently defined date settings.\n *\n * @return {Object} 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\tr: 'ddd, D MMM YYYY HH:mm:ss ZZ',\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 | 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 | 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 | 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( 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","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","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;;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,M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AP;AACA;;AAED,MAAKA,QAAQ,IAAI+G,WAAW,CAAE/G,QAAF,CAA5B,EAA2C;AAC1C,WAAOiG,UAAU,CAAClC,SAAX,CAAsB/D,QAAtB,CAAP;AACA;;AAED,MAAKhC,QAAQ,CAACgC,QAAT,CAAkBE,MAAvB,EAAgC;AAC/B,WAAO+F,UAAU,CAACvE,EAAX,CAAe1D,QAAQ,CAACgC,QAAT,CAAkBE,MAAjC,CAAP;AACA;;AAED,SAAO+F,UAAU,CAAClC,SAAX,CAAsB,CAAC/F,QAAQ,CAACgC,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,SAAOlC,gBAAgB,CAACiJ,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 */\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},\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 {Object} 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 | 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 | 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 | 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( 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"]}
@@ -110,12 +110,29 @@ let settings = {
110
110
  */
111
111
 
112
112
  export function setSettings(dateSettings) {
113
- settings = dateSettings; // Backup and restore current locale.
113
+ settings = dateSettings;
114
+ setupWPTimezone(); // Does moment already have a locale with the right name?
115
+
116
+ if (momentLib.locales().includes(dateSettings.l10n.locale)) {
117
+ // Is that locale misconfigured, e.g. because we are on a site running
118
+ // WordPress < 6.0?
119
+ if (momentLib.localeData(dateSettings.l10n.locale).longDateFormat('LTS') === null) {
120
+ // Delete the misconfigured locale.
121
+ // @ts-ignore Type definitions are incorrect - null is permitted.
122
+ momentLib.defineLocale(dateSettings.l10n.locale, null);
123
+ } else {
124
+ // We have a properly configured locale, so no need to create one.
125
+ return;
126
+ }
127
+ } // defineLocale() will modify the current locale, so back it up.
128
+
129
+
130
+ const currentLocale = momentLib.locale(); // Create locale.
114
131
 
115
- const currentLocale = momentLib.locale();
116
- momentLib.updateLocale(dateSettings.l10n.locale, {
117
- // Inherit anything missing from the default locale.
118
- parentLocale: currentLocale,
132
+ momentLib.defineLocale(dateSettings.l10n.locale, {
133
+ // Inherit anything missing from English. We don't load
134
+ // moment-with-locales.js so English is all there is.
135
+ parentLocale: 'en',
119
136
  months: dateSettings.l10n.months,
120
137
  monthsShort: dateSettings.l10n.monthsShort,
121
138
  weekdays: dateSettings.l10n.weekdays,
@@ -131,21 +148,18 @@ export function setSettings(dateSettings) {
131
148
 
132
149
  longDateFormat: {
133
150
  LT: dateSettings.formats.time,
134
- // @ts-ignore Forcing this to `null`
135
- LTS: null,
136
- // @ts-ignore Forcing this to `null`
137
- L: null,
151
+ LTS: momentLib.localeData('en').longDateFormat('LTS'),
152
+ L: momentLib.localeData('en').longDateFormat('L'),
138
153
  LL: dateSettings.formats.date,
139
154
  LLL: dateSettings.formats.datetime,
140
- // @ts-ignore Forcing this to `null`
141
- LLLL: null
155
+ LLLL: momentLib.localeData('en').longDateFormat('LLLL')
142
156
  },
143
157
  // From human_time_diff?
144
158
  // Set to `(number, withoutSuffix, key, isFuture) => {}` instead.
145
159
  relativeTime: dateSettings.l10n.relative
146
- });
160
+ }); // Restore the locale to what it was.
161
+
147
162
  momentLib.locale(currentLocale);
148
- setupWPTimezone();
149
163
  }
150
164
  /**
151
165
  * Returns the currently defined date settings.
@@ -333,8 +347,20 @@ const formatMap = {
333
347
 
334
348
  // Full date/time.
335
349
  c: 'YYYY-MM-DDTHH:mm:ssZ',
350
+
336
351
  // .toISOString.
337
- r: 'ddd, D MMM YYYY HH:mm:ss ZZ',
352
+
353
+ /**
354
+ * Formats the date as RFC2822.
355
+ *
356
+ * @param {Moment} momentDate Moment instance.
357
+ *
358
+ * @return {string} Formatted date.
359
+ */
360
+ r(momentDate) {
361
+ return momentDate.locale('en').format('ddd, DD MMM YYYY HH:mm:ss ZZ');
362
+ },
363
+
338
364
  U: 'X'
339
365
  };
340
366
  /**
@@ -539,7 +565,7 @@ function buildMoment(dateValue) {
539
565
  return dateMoment.tz(settings.timezone.string);
540
566
  }
541
567
 
542
- return dateMoment.utcOffset(settings.timezone.offset);
568
+ return dateMoment.utcOffset(+settings.timezone.offset);
543
569
  }
544
570
  /**
545
571
  * Returns whether a certain UTC offset is valid or not.
@@ -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","formats","time","date","datetime","datetimeAbbreviated","timezone","offset","string","abbr","setSettings","dateSettings","currentLocale","updateLocale","parentLocale","hour","minute","isLowercase","longDateFormat","LT","LTS","L","LL","LLL","LLLL","relativeTime","setupWPTimezone","__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","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;;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,UAZO,CAFH;AAgBLC,IAAAA,WAAW,EAAE,CACZ,KADY,EAEZ,KAFY,EAGZ,KAHY,EAIZ,KAJY,EAKZ,KALY,EAMZ,KANY,EAOZ,KAPY,EAQZ,KARY,EASZ,KATY,EAUZ,KAVY,EAWZ,KAXY,EAYZ,KAZY,CAhBR;AA8BLC,IA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AAO7I,SAAS,CAACyD,EAAV,CAAcmF,UAAd,EAA0B3I,OAA1B,EAAoC4I,MAApC,EAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASZ,WAAT,CAAsBT,SAAtB,EAAiD;AAAA,MAAhBrF,QAAgB,uEAAL,EAAK;AAChD,QAAM6F,UAAU,GAAGhI,SAAS,CAAEwH,SAAF,CAA5B;;AAEA,MAAKrF,QAAQ,IAAI,CAAE2G,WAAW,CAAE3G,QAAF,CAA9B,EAA6C;AAC5C,WAAO6F,UAAU,CAACvE,EAAX,CAAetB,QAAf,CAAP;AACA;;AAED,MAAKA,QAAQ,IAAI2G,WAAW,CAAE3G,QAAF,CAA5B,EAA2C;AAC1C,WAAO6F,UAAU,CAAClC,SAAX,CAAsB3D,QAAtB,CAAP;AACA;;AAED,MAAKhC,QAAQ,CAACgC,QAAT,CAAkBE,MAAvB,EAAgC;AAC/B,WAAO2F,UAAU,CAACvE,EAAX,CAAetD,QAAQ,CAACgC,QAAT,CAAkBE,MAAjC,CAAP;AACA;;AAED,SAAO2F,UAAU,CAAClC,SAAX,CAAsB3F,QAAQ,CAACgC,QAAT,CAAkBC,MAAxC,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS0G,WAAT,CAAsB1G,MAAtB,EAA+B;AAC9B,MAAK,aAAa,OAAOA,MAAzB,EAAkC;AACjC,WAAO,IAAP;AACA;;AAED,SAAOlC,gBAAgB,CAAC6I,IAAjB,CAAuB3G,MAAvB,CAAP;AACA;;AAEDmB,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 */\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},\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\t// Backup and restore current locale.\n\tconst currentLocale = momentLib.locale();\n\tmomentLib.updateLocale( dateSettings.l10n.locale, {\n\t\t// Inherit anything missing from the default locale.\n\t\tparentLocale: currentLocale,\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\t// @ts-ignore Forcing this to `null`\n\t\t\tLTS: null,\n\t\t\t// @ts-ignore Forcing this to `null`\n\t\t\tL: null,\n\t\t\tLL: dateSettings.formats.date,\n\t\t\tLLL: dateSettings.formats.datetime,\n\t\t\t// @ts-ignore Forcing this to `null`\n\t\t\tLLLL: null,\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\tmomentLib.locale( currentLocale );\n\n\tsetupWPTimezone();\n}\n\n/**\n * Returns the currently defined date settings.\n *\n * @return {Object} 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\tr: 'ddd, D MMM YYYY HH:mm:ss ZZ',\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 | 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 | 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 | 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( 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","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","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","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;;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,M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AAgB,uEAAL,EAAK;AAChD,QAAMgG,UAAU,GAAGnI,SAAS,CAAE2H,SAAF,CAA5B;;AAEA,MAAKxF,QAAQ,IAAI,CAAE8G,WAAW,CAAE9G,QAAF,CAA9B,EAA6C;AAC5C,WAAOgG,UAAU,CAACvE,EAAX,CAAezB,QAAf,CAAP;AACA;;AAED,MAAKA,QAAQ,IAAI8G,WAAW,CAAE9G,QAAF,CAA5B,EAA2C;AAC1C,WAAOgG,UAAU,CAAClC,SAAX,CAAsB9D,QAAtB,CAAP;AACA;;AAED,MAAKhC,QAAQ,CAACgC,QAAT,CAAkBE,MAAvB,EAAgC;AAC/B,WAAO8F,UAAU,CAACvE,EAAX,CAAezD,QAAQ,CAACgC,QAAT,CAAkBE,MAAjC,CAAP;AACA;;AAED,SAAO8F,UAAU,CAAClC,SAAX,CAAsB,CAAC9F,QAAQ,CAACgC,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,SAAOlC,gBAAgB,CAACgJ,IAAjB,CAAuB9G,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 */\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},\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 {Object} 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 | 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 | 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 | 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( 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 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAkIA;;;;GAIG;AACH,0CAFW,YAAY,QA0CtB;AAED;;;;GAIG;AACH,6CAFY,MAAM,CAIjB;AA4LD;;;;;;;;;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,SAAS,YAElC,MAAM,GAAG,SAAS,GAOjB,MAAM,CAKjB;AAED;;;;;;;;;GASG;AACH,mCAPW,MAAM,cAEN,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,GAGjC,MAAM,CAKjB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qCAfW,MAAM,aAEN,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,YAElC,MAAM,GAAG,OAAO,GAAG,SAAS,GAS3B,MAAM,CAcjB;AAED;;;;;;;;;;GAUG;AACH,uCAPW,MAAM,cAEN,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,GAGjC,MAAM,CAMjB;AAED;;;;;;GAMG;AACH,yCAJW,MAAM,GAEL,OAAO,CAOlB;AAED;;;;;;GAMG;AACH,oCAJW,MAAM,UAEL,IAAI,CA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I,GAAG,MAAM,GAAG,SAAS,GAGjC,MAAM,CAMjB;AAED;;;;;;GAMG;AACH,yCAJW,MAAM,GAEL,OAAO,CAOlB;AAED;;;;;;GAMG;AACH,oCAJW,MAAM,UAEL,IAAI,CAQf;qBAziBa,OAAO,QAAQ,EAAE,MAAM;wCACvB,OAAO,QAAQ,EAAE,mBAAmB;;;;;QAIpC,MAAM;;;;QACN,MAAM;;;;QACN,MAAM;;;;QACN,MAAM;;;;;;UAKN,MAAM;;;;UACN,MAAM;;;;cACN,MAAM;;;;yBACN,MAAM;;;;;;YAKN,MAAM;;;;YACN,MAAM;;;;UACN,MAAM;;;;;;YAMN,MAAM;;;;YACN,yBAAyB,CAAC,QAAQ,CAAC;;;;iBACnC,yBAAyB,CAAC,aAAa,CAAC;;;;cACxC,yBAAyB,CAAC,UAAU,CAAC;;;;mBACrC,yBAAyB,CAAC,eAAe,CAAC;;;;cAC1C,cAAc;;;;cACd,yBAAyB,CAAC,cAAc,CAAC;;;;;;UAMzC,YAAY;;;;aACZ,aAAa;;;;cACb,cAAc"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/date",
3
- "version": "4.5.0",
3
+ "version": "4.7.0",
4
4
  "description": "Date module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -33,5 +33,5 @@
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
- "gitHead": "aa003c3634016cc4ab6348b2106907e371c648e1"
36
+ "gitHead": "1ba52312b56db563df2d8d4fba5b00613fb46d8c"
37
37
  }
package/src/index.js CHANGED
@@ -136,11 +136,34 @@ let settings = {
136
136
  export function setSettings( dateSettings ) {
137
137
  settings = dateSettings;
138
138
 
139
- // Backup and restore current locale.
139
+ setupWPTimezone();
140
+
141
+ // Does moment already have a locale with the right name?
142
+ if ( momentLib.locales().includes( dateSettings.l10n.locale ) ) {
143
+ // Is that locale misconfigured, e.g. because we are on a site running
144
+ // WordPress < 6.0?
145
+ if (
146
+ momentLib
147
+ .localeData( dateSettings.l10n.locale )
148
+ .longDateFormat( 'LTS' ) === null
149
+ ) {
150
+ // Delete the misconfigured locale.
151
+ // @ts-ignore Type definitions are incorrect - null is permitted.
152
+ momentLib.defineLocale( dateSettings.l10n.locale, null );
153
+ } else {
154
+ // We have a properly configured locale, so no need to create one.
155
+ return;
156
+ }
157
+ }
158
+
159
+ // defineLocale() will modify the current locale, so back it up.
140
160
  const currentLocale = momentLib.locale();
141
- momentLib.updateLocale( dateSettings.l10n.locale, {
142
- // Inherit anything missing from the default locale.
143
- parentLocale: currentLocale,
161
+
162
+ // Create locale.
163
+ momentLib.defineLocale( dateSettings.l10n.locale, {
164
+ // Inherit anything missing from English. We don't load
165
+ // moment-with-locales.js so English is all there is.
166
+ parentLocale: 'en',
144
167
  months: dateSettings.l10n.months,
145
168
  monthsShort: dateSettings.l10n.monthsShort,
146
169
  weekdays: dateSettings.l10n.weekdays,
@@ -157,22 +180,19 @@ export function setSettings( dateSettings ) {
157
180
  },
158
181
  longDateFormat: {
159
182
  LT: dateSettings.formats.time,
160
- // @ts-ignore Forcing this to `null`
161
- LTS: null,
162
- // @ts-ignore Forcing this to `null`
163
- L: null,
183
+ LTS: momentLib.localeData( 'en' ).longDateFormat( 'LTS' ),
184
+ L: momentLib.localeData( 'en' ).longDateFormat( 'L' ),
164
185
  LL: dateSettings.formats.date,
165
186
  LLL: dateSettings.formats.datetime,
166
- // @ts-ignore Forcing this to `null`
167
- LLLL: null,
187
+ LLLL: momentLib.localeData( 'en' ).longDateFormat( 'LLLL' ),
168
188
  },
169
189
  // From human_time_diff?
170
190
  // Set to `(number, withoutSuffix, key, isFuture) => {}` instead.
171
191
  relativeTime: dateSettings.l10n.relative,
172
192
  } );
173
- momentLib.locale( currentLocale );
174
193
 
175
- setupWPTimezone();
194
+ // Restore the locale to what it was.
195
+ momentLib.locale( currentLocale );
176
196
  }
177
197
 
178
198
  /**
@@ -366,7 +386,18 @@ const formatMap = {
366
386
  },
367
387
  // Full date/time.
368
388
  c: 'YYYY-MM-DDTHH:mm:ssZ', // .toISOString.
369
- r: 'ddd, D MMM YYYY HH:mm:ss ZZ',
389
+ /**
390
+ * Formats the date as RFC2822.
391
+ *
392
+ * @param {Moment} momentDate Moment instance.
393
+ *
394
+ * @return {string} Formatted date.
395
+ */
396
+ r( momentDate ) {
397
+ return momentDate
398
+ .locale( 'en' )
399
+ .format( 'ddd, DD MMM YYYY HH:mm:ss ZZ' );
400
+ },
370
401
  U: 'X',
371
402
  };
372
403
 
@@ -558,7 +589,7 @@ function buildMoment( dateValue, timezone = '' ) {
558
589
  return dateMoment.tz( settings.timezone.string );
559
590
  }
560
591
 
561
- return dateMoment.utcOffset( settings.timezone.offset );
592
+ return dateMoment.utcOffset( +settings.timezone.offset );
562
593
  }
563
594
 
564
595
  /**
package/src/test/index.js CHANGED
@@ -49,37 +49,65 @@ describe( 'isInTheFuture', () => {
49
49
  } );
50
50
 
51
51
  describe( 'Function date', () => {
52
- it( 'should format date in English, ignoring locale settings', () => {
53
- const settings = __experimentalGetSettings();
52
+ test.each( [
53
+ [ 'j/n/y', '18/6/19' ],
54
+ [ 'd/m/y', '18/06/19' ],
55
+ [ 'D j M Y', 'Tue 18 Jun 2019' ],
56
+ [ 'l jS F Y', 'Tuesday 18th June 2019' ],
57
+ [ 'N w', '2 2' ],
58
+ [ 'z', '168' ],
59
+ [ 'W', '25' ],
60
+ [ 't', '30' ],
61
+ [ 'L', '0' ],
62
+ [ 'o', '2019' ],
63
+ [ 'g:i a', '11:00 am' ],
64
+ [ 'h:i A', '11:00 AM' ],
65
+ [ 'G:i:s', '11:00:00' ],
66
+ [ 'H:i:s', '11:00:00' ],
67
+ [ 'B', '499' ],
68
+ [ 'u', '000000' ],
69
+ [ 'v', '000' ],
70
+ [ 'e I T', 'Coordinated Universal Time 0 UTC' ],
71
+ [ 'O P Z', '+0000 +00:00 0' ],
72
+ [ 'c', '2019-06-18T11:00:00+00:00' ],
73
+ [ 'r', 'Tue, 18 Jun 2019 11:00:00 +0000' ],
74
+ [ 'U', '1560855600' ],
75
+ ] )(
76
+ 'should format date as "%s", ignoring locale settings',
77
+ ( formatString, expected ) => {
78
+ const settings = __experimentalGetSettings();
79
+
80
+ // Simulate different locale.
81
+ const l10n = settings.l10n;
82
+ setSettings( {
83
+ ...settings,
84
+ l10n: {
85
+ ...l10n,
86
+ locale: 'es',
87
+ months: l10n.months.map( ( month ) => `es_${ month }` ),
88
+ monthsShort: l10n.monthsShort.map(
89
+ ( month ) => `es_${ month }`
90
+ ),
91
+ weekdays: l10n.weekdays.map(
92
+ ( weekday ) => `es_${ weekday }`
93
+ ),
94
+ weekdaysShort: l10n.weekdaysShort.map(
95
+ ( weekday ) => `es_${ weekday }`
96
+ ),
97
+ },
98
+ } );
54
99
 
55
- // Simulate different locale.
56
- const l10n = settings.l10n;
57
- setSettings( {
58
- ...settings,
59
- l10n: {
60
- ...l10n,
61
- locale: 'es',
62
- months: l10n.months.map( ( month ) => `es_${ month }` ),
63
- monthsShort: l10n.monthsShort.map(
64
- ( month ) => `es_${ month }`
65
- ),
66
- weekdays: l10n.weekdays.map( ( weekday ) => `es_${ weekday }` ),
67
- weekdaysShort: l10n.weekdaysShort.map(
68
- ( weekday ) => `es_${ weekday }`
69
- ),
70
- },
71
- } );
100
+ // Check.
101
+ const formattedDate = dateNoI18n(
102
+ formatString,
103
+ '2019-06-18T11:00:00.000Z'
104
+ );
105
+ expect( formattedDate ).toBe( expected );
72
106
 
73
- // Check.
74
- const formattedDate = dateNoI18n(
75
- 'F M l D',
76
- '2019-06-18T11:00:00.000Z'
77
- );
78
- expect( formattedDate ).toBe( 'June Jun Tuesday Tue' );
79
-
80
- // Restore default settings.
81
- setSettings( settings );
82
- } );
107
+ // Restore default settings.
108
+ setSettings( settings );
109
+ }
110
+ );
83
111
 
84
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', () => {
85
113
  const settings = __experimentalGetSettings();
@@ -192,34 +220,65 @@ describe( 'Function date', () => {
192
220
  } );
193
221
 
194
222
  describe( 'Function gmdate', () => {
195
- it( 'should format date in English, ignoring locale settings', () => {
196
- const settings = __experimentalGetSettings();
223
+ test.each( [
224
+ [ 'j/n/y', '18/6/19' ],
225
+ [ 'd/m/y', '18/06/19' ],
226
+ [ 'D j M Y', 'Tue 18 Jun 2019' ],
227
+ [ 'l jS F Y', 'Tuesday 18th June 2019' ],
228
+ [ 'N w', '2 2' ],
229
+ [ 'z', '168' ],
230
+ [ 'W', '25' ],
231
+ [ 't', '30' ],
232
+ [ 'L', '0' ],
233
+ [ 'o', '2019' ],
234
+ [ 'g:i a', '11:00 am' ],
235
+ [ 'h:i A', '11:00 AM' ],
236
+ [ 'G:i:s', '11:00:00' ],
237
+ [ 'H:i:s', '11:00:00' ],
238
+ [ 'B', '499' ],
239
+ [ 'u', '000000' ],
240
+ [ 'v', '000' ],
241
+ [ 'e I T', 'Coordinated Universal Time 0 UTC' ],
242
+ [ 'O P Z', '+0000 +00:00 0' ],
243
+ [ 'c', '2019-06-18T11:00:00+00:00' ],
244
+ [ 'r', 'Tue, 18 Jun 2019 11:00:00 +0000' ],
245
+ [ 'U', '1560855600' ],
246
+ ] )(
247
+ 'should format date as "%s", ignoring locale settings',
248
+ ( formatString, expected ) => {
249
+ const settings = __experimentalGetSettings();
250
+
251
+ // Simulate different locale.
252
+ const l10n = settings.l10n;
253
+ setSettings( {
254
+ ...settings,
255
+ l10n: {
256
+ ...l10n,
257
+ locale: 'es',
258
+ months: l10n.months.map( ( month ) => `es_${ month }` ),
259
+ monthsShort: l10n.monthsShort.map(
260
+ ( month ) => `es_${ month }`
261
+ ),
262
+ weekdays: l10n.weekdays.map(
263
+ ( weekday ) => `es_${ weekday }`
264
+ ),
265
+ weekdaysShort: l10n.weekdaysShort.map(
266
+ ( weekday ) => `es_${ weekday }`
267
+ ),
268
+ },
269
+ } );
197
270
 
198
- // Simulate different locale.
199
- const l10n = settings.l10n;
200
- setSettings( {
201
- ...settings,
202
- l10n: {
203
- ...l10n,
204
- locale: 'es',
205
- months: l10n.months.map( ( month ) => `es_${ month }` ),
206
- monthsShort: l10n.monthsShort.map(
207
- ( month ) => `es_${ month }`
208
- ),
209
- weekdays: l10n.weekdays.map( ( weekday ) => `es_${ weekday }` ),
210
- weekdaysShort: l10n.weekdaysShort.map(
211
- ( weekday ) => `es_${ weekday }`
212
- ),
213
- },
214
- } );
271
+ // Check.
272
+ const formattedDate = gmdate(
273
+ formatString,
274
+ '2019-06-18T11:00:00.000Z'
275
+ );
276
+ expect( formattedDate ).toBe( expected );
215
277
 
216
- // Check.
217
- const formattedDate = gmdate( 'F M l D', '2019-06-18T11:00:00.000Z' );
218
- expect( formattedDate ).toBe( 'June Jun Tuesday Tue' );
219
-
220
- // Restore default settings.
221
- setSettings( settings );
222
- } );
278
+ // Restore default settings.
279
+ setSettings( settings );
280
+ }
281
+ );
223
282
 
224
283
  it( 'should format date into a UTC date', () => {
225
284
  const settings = __experimentalGetSettings();
@@ -240,38 +299,66 @@ describe( 'Function gmdate', () => {
240
299
  } );
241
300
 
242
301
  describe( 'Function dateI18n', () => {
243
- it( 'should format date using locale settings', () => {
244
- const settings = __experimentalGetSettings();
245
-
246
- // Simulate different locale.
247
- const l10n = settings.l10n;
248
- setSettings( {
249
- ...settings,
250
- l10n: {
251
- ...l10n,
252
- locale: 'es',
253
- months: l10n.months.map( ( month ) => `es_${ month }` ),
254
- monthsShort: l10n.monthsShort.map(
255
- ( month ) => `es_${ month }`
256
- ),
257
- weekdays: l10n.weekdays.map( ( weekday ) => `es_${ weekday }` ),
258
- weekdaysShort: l10n.weekdaysShort.map(
259
- ( weekday ) => `es_${ weekday }`
260
- ),
261
- },
262
- } );
302
+ test.each( [
303
+ [ 'j/n/y', '18/6/19' ],
304
+ [ 'd/m/y', '18/06/19' ],
305
+ [ 'D j M Y', 'es_Tue 18 es_Jun 2019' ],
306
+ [ 'l jS F Y', 'es_Tuesday 18th es_June 2019' ], // Day ordinal should be in English, matching wp_date().
307
+ [ 'N w', '2 2' ],
308
+ [ 'z', '168' ],
309
+ [ 'W', '25' ],
310
+ [ 't', '30' ],
311
+ [ 'L', '0' ],
312
+ [ 'o', '2019' ],
313
+ [ 'g:i a', '11:00 am' ],
314
+ [ 'h:i A', '11:00 AM' ],
315
+ [ 'G:i:s', '11:00:00' ],
316
+ [ 'H:i:s', '11:00:00' ],
317
+ [ 'B', '499' ],
318
+ [ 'u', '000000' ],
319
+ [ 'v', '000' ],
320
+ [ 'e I T', 'Coordinated Universal Time 0 UTC' ],
321
+ [ 'O P Z', '+0000 +00:00 0' ],
322
+ [ 'c', '2019-06-18T11:00:00+00:00' ],
323
+ [ 'r', 'Tue, 18 Jun 2019 11:00:00 +0000' ], // Day and month should be in English, as per RFC 2822.
324
+ [ 'U', '1560855600' ],
325
+ ] )(
326
+ 'should format date as "%s", using locale settings',
327
+ ( formatString, expected ) => {
328
+ const settings = __experimentalGetSettings();
329
+
330
+ // Simulate different locale.
331
+ const l10n = settings.l10n;
332
+ setSettings( {
333
+ ...settings,
334
+ l10n: {
335
+ ...l10n,
336
+ locale: 'es',
337
+ months: l10n.months.map( ( month ) => `es_${ month }` ),
338
+ monthsShort: l10n.monthsShort.map(
339
+ ( month ) => `es_${ month }`
340
+ ),
341
+ weekdays: l10n.weekdays.map(
342
+ ( weekday ) => `es_${ weekday }`
343
+ ),
344
+ weekdaysShort: l10n.weekdaysShort.map(
345
+ ( weekday ) => `es_${ weekday }`
346
+ ),
347
+ },
348
+ } );
263
349
 
264
- // Check.
265
- const formattedDate = dateI18n(
266
- 'F M l D',
267
- '2019-06-18T11:00:00.000Z',
268
- true
269
- );
270
- expect( formattedDate ).toBe( 'es_June es_Jun es_Tuesday es_Tue' );
350
+ // Check.
351
+ const formattedDate = dateI18n(
352
+ formatString,
353
+ '2019-06-18T11:00:00.000Z',
354
+ true
355
+ );
356
+ expect( formattedDate ).toBe( expected );
271
357
 
272
- // Restore default settings.
273
- setSettings( settings );
274
- } );
358
+ // Restore default settings.
359
+ setSettings( settings );
360
+ }
361
+ );
275
362
 
276
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', () => {
277
364
  const settings = __experimentalGetSettings();
@@ -422,37 +509,65 @@ describe( 'Function dateI18n', () => {
422
509
  } );
423
510
 
424
511
  describe( 'Function gmdateI18n', () => {
425
- it( 'should format date using locale settings', () => {
426
- const settings = __experimentalGetSettings();
427
-
428
- // Simulate different locale.
429
- const l10n = settings.l10n;
430
- setSettings( {
431
- ...settings,
432
- l10n: {
433
- ...l10n,
434
- locale: 'es',
435
- months: l10n.months.map( ( month ) => `es_${ month }` ),
436
- monthsShort: l10n.monthsShort.map(
437
- ( month ) => `es_${ month }`
438
- ),
439
- weekdays: l10n.weekdays.map( ( weekday ) => `es_${ weekday }` ),
440
- weekdaysShort: l10n.weekdaysShort.map(
441
- ( weekday ) => `es_${ weekday }`
442
- ),
443
- },
444
- } );
445
-
446
- // Check.
447
- const formattedDate = gmdateI18n(
448
- 'F M l D',
449
- '2019-06-18T11:00:00.000Z'
450
- );
451
- expect( formattedDate ).toBe( 'es_June es_Jun es_Tuesday es_Tue' );
452
-
453
- // Restore default settings.
454
- setSettings( settings );
455
- } );
512
+ test.each( [
513
+ [ 'j/n/y', '18/6/19' ],
514
+ [ 'd/m/y', '18/06/19' ],
515
+ [ 'D j M Y', 'es_Tue 18 es_Jun 2019' ],
516
+ [ 'l jS F Y', 'es_Tuesday 18th es_June 2019' ], // Day ordinal should be in English, matching wp_date().
517
+ [ 'N w', '2 2' ],
518
+ [ 'z', '168' ],
519
+ [ 'W', '25' ],
520
+ [ 't', '30' ],
521
+ [ 'L', '0' ],
522
+ [ 'o', '2019' ],
523
+ [ 'g:i a', '11:00 am' ],
524
+ [ 'h:i A', '11:00 AM' ],
525
+ [ 'G:i:s', '11:00:00' ],
526
+ [ 'H:i:s', '11:00:00' ],
527
+ [ 'B', '499' ],
528
+ [ 'u', '000000' ],
529
+ [ 'v', '000' ],
530
+ [ 'e I T', 'Coordinated Universal Time 0 UTC' ],
531
+ [ 'O P Z', '+0000 +00:00 0' ],
532
+ [ 'c', '2019-06-18T11:00:00+00:00' ],
533
+ [ 'r', 'Tue, 18 Jun 2019 11:00:00 +0000' ], // Day and month should be in English, as per RFC 2822.
534
+ [ 'U', '1560855600' ],
535
+ ] )(
536
+ 'should format date as "%s", using locale settings',
537
+ ( formatString, expected ) => {
538
+ const settings = __experimentalGetSettings();
539
+
540
+ // Simulate different locale.
541
+ const l10n = settings.l10n;
542
+ setSettings( {
543
+ ...settings,
544
+ l10n: {
545
+ ...l10n,
546
+ locale: 'es',
547
+ months: l10n.months.map( ( month ) => `es_${ month }` ),
548
+ monthsShort: l10n.monthsShort.map(
549
+ ( month ) => `es_${ month }`
550
+ ),
551
+ weekdays: l10n.weekdays.map(
552
+ ( weekday ) => `es_${ weekday }`
553
+ ),
554
+ weekdaysShort: l10n.weekdaysShort.map(
555
+ ( weekday ) => `es_${ weekday }`
556
+ ),
557
+ },
558
+ } );
559
+
560
+ // Check.
561
+ const formattedDate = gmdateI18n(
562
+ formatString,
563
+ '2019-06-18T11:00:00.000Z'
564
+ );
565
+ expect( formattedDate ).toBe( expected );
566
+
567
+ // Restore default settings.
568
+ setSettings( settings );
569
+ }
570
+ );
456
571
 
457
572
  it( 'should format date into a UTC date', () => {
458
573
  const settings = __experimentalGetSettings();
@@ -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","84ae6e80ce1f6c8d00397ddbb6909b4d01164f804706bd09ed1de481ed01a57e"],"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]],"referencedMap":[[46,1],[47,2],[48,1]],"exportedModulesMap":[[46,1],[47,2],[48,1]],"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]},"version":"4.4.2"}
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","0a6705094ed34ba4926f1cc17ca503434739218e3bc13cba8c2ecc8df1758fcd"],"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]],"referencedMap":[[46,1],[47,2],[48,1]],"exportedModulesMap":[[46,1],[47,2],[48,1]],"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]},"version":"4.4.2"}