@wordpress/date 4.15.0 → 4.16.1-next.957ca95e4c.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 4.16.0 (2022-08-24)
6
+
5
7
  ## 4.15.0 (2022-08-10)
6
8
 
7
9
  ## 4.14.0 (2022-07-27)
package/README.md CHANGED
@@ -29,7 +29,7 @@ _Parameters_
29
29
 
30
30
  - _dateFormat_ `string`: PHP-style formatting string. See php.net/date.
31
31
  - _dateValue_ `Moment | Date | string | undefined`: Date object or string, parsable by moment.js.
32
- - _timezone_ `string | undefined`: Timezone to output result in or a UTC offset. Defaults to timezone from site.
32
+ - _timezone_ `string | number | undefined`: Timezone to output result in or a UTC offset. Defaults to timezone from site.
33
33
 
34
34
  _Returns_
35
35
 
@@ -51,7 +51,7 @@ _Parameters_
51
51
 
52
52
  - _dateFormat_ `string`: PHP-style formatting string. See php.net/date.
53
53
  - _dateValue_ `Moment | Date | string | undefined`: Date object or string, parsable by moment.js.
54
- - _timezone_ `string | boolean | undefined`: Timezone to output result in or a UTC offset. Defaults to timezone from site. Notice: `boolean` is effectively deprecated, but still supported for backward compatibility reasons.
54
+ - _timezone_ `string | number | boolean | undefined`: Timezone to output result in or a UTC offset. Defaults to timezone from site. Notice: `boolean` is effectively deprecated, but still supported for backward compatibility reasons.
55
55
 
56
56
  _Returns_
57
57
 
package/build/index.js CHANGED
@@ -443,7 +443,7 @@ function format(dateFormat) {
443
443
  * See php.net/date.
444
444
  * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable
445
445
  * by moment.js.
446
- * @param {string | undefined} timezone Timezone to output result in or a
446
+ * @param {string | number | undefined} timezone Timezone to output result in or a
447
447
  * UTC offset. Defaults to timezone from
448
448
  * site.
449
449
  *
@@ -483,15 +483,15 @@ function gmdate(dateFormat) {
483
483
  * Backward Compatibility Notice: if `timezone` is set to `true`, the function
484
484
  * behaves like `gmdateI18n`.
485
485
  *
486
- * @param {string} dateFormat PHP-style formatting string.
487
- * See php.net/date.
488
- * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable by
489
- * moment.js.
490
- * @param {string | boolean | undefined} timezone Timezone to output result in or a
491
- * UTC offset. Defaults to timezone from
492
- * site. Notice: `boolean` is effectively
493
- * deprecated, but still supported for
494
- * backward compatibility reasons.
486
+ * @param {string} dateFormat PHP-style formatting string.
487
+ * See php.net/date.
488
+ * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable by
489
+ * moment.js.
490
+ * @param {string | number | boolean | undefined} timezone Timezone to output result in or a
491
+ * UTC offset. Defaults to timezone from
492
+ * site. Notice: `boolean` is effectively
493
+ * deprecated, but still supported for
494
+ * backward compatibility reasons.
495
495
  *
496
496
  * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
497
497
  * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC
@@ -572,7 +572,7 @@ function getDate(dateString) {
572
572
  *
573
573
  * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable
574
574
  * by moment.js.
575
- * @param {string | undefined} timezone Timezone to output result in or a
575
+ * @param {string | number | undefined} timezone Timezone to output result in or a
576
576
  * UTC offset. Defaults to timezone from
577
577
  * site.
578
578
  *
@@ -588,7 +588,10 @@ function buildMoment(dateValue) {
588
588
  const dateMoment = (0, _moment.default)(dateValue);
589
589
 
590
590
  if (timezone && !isUTCOffset(timezone)) {
591
- return dateMoment.tz(timezone);
591
+ // The ! isUTCOffset() check guarantees that timezone is a string.
592
+ return dateMoment.tz(
593
+ /** @type {string} */
594
+ timezone);
592
595
  }
593
596
 
594
597
  if (timezone && isUTCOffset(timezone)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/date/src/index.js"],"names":["WP_ZONE","VALID_UTC_OFFSET","settings","l10n","locale","months","monthsShort","weekdays","weekdaysShort","meridiem","am","pm","AM","PM","relative","future","past","s","ss","m","mm","h","hh","d","dd","M","MM","y","yy","startOfWeek","formats","time","date","datetime","datetimeAbbreviated","timezone","offset","string","abbr","setSettings","dateSettings","setupWPTimezone","momentLib","locales","includes","localeData","longDateFormat","defineLocale","currentLocale","parentLocale","hour","minute","isLowercase","LT","LTS","L","LL","LLL","LLLL","relativeTime","__experimentalGetSettings","tz","add","pack","name","abbrs","untils","offsets","MINUTE_IN_SECONDS","HOUR_IN_MINUTES","HOUR_IN_SECONDS","formatMap","D","j","l","N","S","momentDate","num","format","withOrdinal","replace","w","z","parseInt","toString","W","F","n","t","daysInMonth","isLeapYear","o","Y","a","A","B","timezoned","utcOffset","seconds","minutes","hours","g","G","H","i","u","v","e","I","isDST","O","P","T","Z","sign","parts","substring","split","map","c","r","U","dateFormat","dateValue","Date","char","newFormat","length","push","formatter","join","dateMoment","buildMoment","gmdate","utc","dateI18n","gmdateI18n","undefined","isInTheFuture","now","momentObject","isAfter","getDate","dateString","toDate","isUTCOffset","test"],"mappings":";;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMA,OAAO,GAAG,IAAhB,C,CAEA;AACA;;AACA,MAAMC,gBAAgB,GAAG,iCAAzB,C,CAEA;AACA;;AACA;;AACA,IAAIC,QAAQ,GAAG;AACdC,EAAAA,IAAI,EAAE;AACLC,IAAAA,MAAM,EAAE,IADH;AAELC,IAAAA,MAAM,EAAE,CACP,SADO,EAEP,UAFO,EAGP,OAHO,EAIP,OAJO,EAKP,KALO,EAMP,MANO,EAOP,MAPO,EAQP,QARO,EASP,WATO,EAUP,SAVO,EAWP,UAXO,EAYP,UAZO,C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AAI+G,WAAW,CAAE/G,QAAF,CAA5B,EAA2C;AAC1C,WAAOiG,UAAU,CAAClC,SAAX,CAAsB/D,QAAtB,CAAP;AACA;;AAED,MAAKjC,QAAQ,CAACiC,QAAT,CAAkBE,MAAvB,EAAgC;AAC/B,WAAO+F,UAAU,CAACvE,EAAX,CAAe3D,QAAQ,CAACiC,QAAT,CAAkBE,MAAjC,CAAP;AACA;;AAED,SAAO+F,UAAU,CAAClC,SAAX,CAAsB,CAAChG,QAAQ,CAACiC,QAAT,CAAkBC,MAAzC,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS8G,WAAT,CAAsB9G,MAAtB,EAA+B;AAC9B,MAAK,aAAa,OAAOA,MAAzB,EAAkC;AACjC,WAAO,IAAP;AACA;;AAED,SAAOnC,gBAAgB,CAACkJ,IAAjB,CAAuB/G,MAAvB,CAAP;AACA;;AAEDK,eAAe","sourcesContent":["/**\n * External dependencies\n */\nimport momentLib from 'moment';\nimport 'moment-timezone/moment-timezone';\nimport 'moment-timezone/moment-timezone-utils';\n\n/** @typedef {import('moment').Moment} Moment */\n/** @typedef {import('moment').LocaleSpecification} MomentLocaleSpecification */\n\n/**\n * @typedef MeridiemConfig\n * @property {string} am Lowercase AM.\n * @property {string} AM Uppercase AM.\n * @property {string} pm Lowercase PM.\n * @property {string} PM Uppercase PM.\n */\n\n/**\n * @typedef FormatsConfig\n * @property {string} time Time format.\n * @property {string} date Date format.\n * @property {string} datetime Datetime format.\n * @property {string} datetimeAbbreviated Abbreviated datetime format.\n */\n\n/**\n * @typedef TimezoneConfig\n * @property {string} offset Offset setting.\n * @property {string} string The timezone as a string (e.g., `'America/Los_Angeles'`).\n * @property {string} abbr Abbreviation for the timezone.\n */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @typedef L10nSettings\n * @property {string} locale Moment locale.\n * @property {MomentLocaleSpecification['months']} months Locale months.\n * @property {MomentLocaleSpecification['monthsShort']} monthsShort Locale months short.\n * @property {MomentLocaleSpecification['weekdays']} weekdays Locale weekdays.\n * @property {MomentLocaleSpecification['weekdaysShort']} weekdaysShort Locale weekdays short.\n * @property {MeridiemConfig} meridiem Meridiem config.\n * @property {MomentLocaleSpecification['relativeTime']} relative Relative time config.\n * @property {0|1|2|3|4|5|6} startOfWeek Day that the week starts on.\n */\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * @typedef DateSettings\n * @property {L10nSettings} l10n Localization settings.\n * @property {FormatsConfig} formats Date/time formats config.\n * @property {TimezoneConfig} timezone Timezone settings.\n */\n\nconst WP_ZONE = 'WP';\n\n// This regular expression tests positive for UTC offsets as described in ISO 8601.\n// See: https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\nconst VALID_UTC_OFFSET = /^[+-][0-1][0-9](:?[0-9][0-9])?$/;\n\n// Changes made here will likely need to be made in `lib/client-assets.php` as\n// well because it uses the `setSettings()` function to change these settings.\n/** @type {DateSettings} */\nlet settings = {\n\tl10n: {\n\t\tlocale: 'en',\n\t\tmonths: [\n\t\t\t'January',\n\t\t\t'February',\n\t\t\t'March',\n\t\t\t'April',\n\t\t\t'May',\n\t\t\t'June',\n\t\t\t'July',\n\t\t\t'August',\n\t\t\t'September',\n\t\t\t'October',\n\t\t\t'November',\n\t\t\t'December',\n\t\t],\n\t\tmonthsShort: [\n\t\t\t'Jan',\n\t\t\t'Feb',\n\t\t\t'Mar',\n\t\t\t'Apr',\n\t\t\t'May',\n\t\t\t'Jun',\n\t\t\t'Jul',\n\t\t\t'Aug',\n\t\t\t'Sep',\n\t\t\t'Oct',\n\t\t\t'Nov',\n\t\t\t'Dec',\n\t\t],\n\t\tweekdays: [\n\t\t\t'Sunday',\n\t\t\t'Monday',\n\t\t\t'Tuesday',\n\t\t\t'Wednesday',\n\t\t\t'Thursday',\n\t\t\t'Friday',\n\t\t\t'Saturday',\n\t\t],\n\t\tweekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],\n\t\tmeridiem: { am: 'am', pm: 'pm', AM: 'AM', PM: 'PM' },\n\t\trelative: {\n\t\t\tfuture: '%s from now',\n\t\t\tpast: '%s ago',\n\t\t\ts: 'a few seconds',\n\t\t\tss: '%d seconds',\n\t\t\tm: 'a minute',\n\t\t\tmm: '%d minutes',\n\t\t\th: 'an hour',\n\t\t\thh: '%d hours',\n\t\t\td: 'a day',\n\t\t\tdd: '%d days',\n\t\t\tM: 'a month',\n\t\t\tMM: '%d months',\n\t\t\ty: 'a year',\n\t\t\tyy: '%d years',\n\t\t},\n\t\tstartOfWeek: 0,\n\t},\n\tformats: {\n\t\ttime: 'g: i a',\n\t\tdate: 'F j, Y',\n\t\tdatetime: 'F j, Y g: i a',\n\t\tdatetimeAbbreviated: 'M j, Y g: i a',\n\t},\n\ttimezone: { offset: '0', string: '', abbr: '' },\n};\n\n/**\n * Adds a locale to moment, using the format supplied by `wp_localize_script()`.\n *\n * @param {DateSettings} dateSettings Settings, including locale data.\n */\nexport function setSettings( dateSettings ) {\n\tsettings = dateSettings;\n\n\tsetupWPTimezone();\n\n\t// Does moment already have a locale with the right name?\n\tif ( momentLib.locales().includes( dateSettings.l10n.locale ) ) {\n\t\t// Is that locale misconfigured, e.g. because we are on a site running\n\t\t// WordPress < 6.0?\n\t\tif (\n\t\t\tmomentLib\n\t\t\t\t.localeData( dateSettings.l10n.locale )\n\t\t\t\t.longDateFormat( 'LTS' ) === null\n\t\t) {\n\t\t\t// Delete the misconfigured locale.\n\t\t\t// @ts-ignore Type definitions are incorrect - null is permitted.\n\t\t\tmomentLib.defineLocale( dateSettings.l10n.locale, null );\n\t\t} else {\n\t\t\t// We have a properly configured locale, so no need to create one.\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// defineLocale() will modify the current locale, so back it up.\n\tconst currentLocale = momentLib.locale();\n\n\t// Create locale.\n\tmomentLib.defineLocale( dateSettings.l10n.locale, {\n\t\t// Inherit anything missing from English. We don't load\n\t\t// moment-with-locales.js so English is all there is.\n\t\tparentLocale: 'en',\n\t\tmonths: dateSettings.l10n.months,\n\t\tmonthsShort: dateSettings.l10n.monthsShort,\n\t\tweekdays: dateSettings.l10n.weekdays,\n\t\tweekdaysShort: dateSettings.l10n.weekdaysShort,\n\t\tmeridiem( hour, minute, isLowercase ) {\n\t\t\tif ( hour < 12 ) {\n\t\t\t\treturn isLowercase\n\t\t\t\t\t? dateSettings.l10n.meridiem.am\n\t\t\t\t\t: dateSettings.l10n.meridiem.AM;\n\t\t\t}\n\t\t\treturn isLowercase\n\t\t\t\t? dateSettings.l10n.meridiem.pm\n\t\t\t\t: dateSettings.l10n.meridiem.PM;\n\t\t},\n\t\tlongDateFormat: {\n\t\t\tLT: dateSettings.formats.time,\n\t\t\tLTS: momentLib.localeData( 'en' ).longDateFormat( 'LTS' ),\n\t\t\tL: momentLib.localeData( 'en' ).longDateFormat( 'L' ),\n\t\t\tLL: dateSettings.formats.date,\n\t\t\tLLL: dateSettings.formats.datetime,\n\t\t\tLLLL: momentLib.localeData( 'en' ).longDateFormat( 'LLLL' ),\n\t\t},\n\t\t// From human_time_diff?\n\t\t// Set to `(number, withoutSuffix, key, isFuture) => {}` instead.\n\t\trelativeTime: dateSettings.l10n.relative,\n\t} );\n\n\t// Restore the locale to what it was.\n\tmomentLib.locale( currentLocale );\n}\n\n/**\n * Returns the currently defined date settings.\n *\n * @return {DateSettings} Settings, including locale data.\n */\nexport function __experimentalGetSettings() {\n\treturn settings;\n}\n\nfunction setupWPTimezone() {\n\t// Create WP timezone based off dateSettings.\n\tmomentLib.tz.add(\n\t\tmomentLib.tz.pack( {\n\t\t\tname: WP_ZONE,\n\t\t\tabbrs: [ WP_ZONE ],\n\t\t\tuntils: [ null ],\n\t\t\toffsets: [ -settings.timezone.offset * 60 || 0 ],\n\t\t} )\n\t);\n}\n\n// Date constants.\n/**\n * Number of seconds in one minute.\n *\n * @type {number}\n */\nconst MINUTE_IN_SECONDS = 60;\n/**\n * Number of minutes in one hour.\n *\n * @type {number}\n */\nconst HOUR_IN_MINUTES = 60;\n/**\n * Number of seconds in one hour.\n *\n * @type {number}\n */\nconst HOUR_IN_SECONDS = 60 * MINUTE_IN_SECONDS;\n\n/**\n * Map of PHP formats to Moment.js formats.\n *\n * These are used internally by {@link wp.date.format}, and are either\n * a string representing the corresponding Moment.js format code, or a\n * function which returns the formatted string.\n *\n * This should only be used through {@link wp.date.format}, not\n * directly.\n */\nconst formatMap = {\n\t// Day.\n\td: 'DD',\n\tD: 'ddd',\n\tj: 'D',\n\tl: 'dddd',\n\tN: 'E',\n\n\t/**\n\t * Gets the ordinal suffix.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tS( momentDate ) {\n\t\t// Do - D.\n\t\tconst num = momentDate.format( 'D' );\n\t\tconst withOrdinal = momentDate.format( 'Do' );\n\t\treturn withOrdinal.replace( num, '' );\n\t},\n\n\tw: 'd',\n\t/**\n\t * Gets the day of the year (zero-indexed).\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tz( momentDate ) {\n\t\t// DDD - 1.\n\t\treturn ( parseInt( momentDate.format( 'DDD' ), 10 ) - 1 ).toString();\n\t},\n\n\t// Week.\n\tW: 'W',\n\n\t// Month.\n\tF: 'MMMM',\n\tm: 'MM',\n\tM: 'MMM',\n\tn: 'M',\n\t/**\n\t * Gets the days in the month.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tt( momentDate ) {\n\t\treturn momentDate.daysInMonth();\n\t},\n\n\t// Year.\n\t/**\n\t * Gets whether the current year is a leap year.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tL( momentDate ) {\n\t\treturn momentDate.isLeapYear() ? '1' : '0';\n\t},\n\to: 'GGGG',\n\tY: 'YYYY',\n\ty: 'YY',\n\n\t// Time.\n\ta: 'a',\n\tA: 'A',\n\t/**\n\t * Gets the current time in Swatch Internet Time (.beats).\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tB( momentDate ) {\n\t\tconst timezoned = momentLib( momentDate ).utcOffset( 60 );\n\t\tconst seconds = parseInt( timezoned.format( 's' ), 10 ),\n\t\t\tminutes = parseInt( timezoned.format( 'm' ), 10 ),\n\t\t\thours = parseInt( timezoned.format( 'H' ), 10 );\n\t\treturn parseInt(\n\t\t\t(\n\t\t\t\t( seconds +\n\t\t\t\t\tminutes * MINUTE_IN_SECONDS +\n\t\t\t\t\thours * HOUR_IN_SECONDS ) /\n\t\t\t\t86.4\n\t\t\t).toString(),\n\t\t\t10\n\t\t);\n\t},\n\tg: 'h',\n\tG: 'H',\n\th: 'hh',\n\tH: 'HH',\n\ti: 'mm',\n\ts: 'ss',\n\tu: 'SSSSSS',\n\tv: 'SSS',\n\t// Timezone.\n\te: 'zz',\n\t/**\n\t * Gets whether the timezone is in DST currently.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tI( momentDate ) {\n\t\treturn momentDate.isDST() ? '1' : '0';\n\t},\n\tO: 'ZZ',\n\tP: 'Z',\n\tT: 'z',\n\t/**\n\t * Gets the timezone offset in seconds.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tZ( momentDate ) {\n\t\t// Timezone offset in seconds.\n\t\tconst offset = momentDate.format( 'Z' );\n\t\tconst sign = offset[ 0 ] === '-' ? -1 : 1;\n\t\tconst parts = offset\n\t\t\t.substring( 1 )\n\t\t\t.split( ':' )\n\t\t\t.map( ( n ) => parseInt( n, 10 ) );\n\t\treturn (\n\t\t\tsign *\n\t\t\t( parts[ 0 ] * HOUR_IN_MINUTES + parts[ 1 ] ) *\n\t\t\tMINUTE_IN_SECONDS\n\t\t);\n\t},\n\t// Full date/time.\n\tc: 'YYYY-MM-DDTHH:mm:ssZ', // .toISOString.\n\t/**\n\t * Formats the date as RFC2822.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tr( momentDate ) {\n\t\treturn momentDate\n\t\t\t.locale( 'en' )\n\t\t\t.format( 'ddd, DD MMM YYYY HH:mm:ss ZZ' );\n\t},\n\tU: 'X',\n};\n\n/**\n * Formats a date. Does not alter the date's timezone.\n *\n * @param {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date.\n */\nexport function format( dateFormat, dateValue = new Date() ) {\n\tlet i, char;\n\tconst newFormat = [];\n\tconst momentDate = momentLib( dateValue );\n\tfor ( i = 0; i < dateFormat.length; i++ ) {\n\t\tchar = dateFormat[ i ];\n\t\t// Is this an escape?\n\t\tif ( '\\\\' === char ) {\n\t\t\t// Add next character, then move on.\n\t\t\ti++;\n\t\t\tnewFormat.push( '[' + dateFormat[ i ] + ']' );\n\t\t\tcontinue;\n\t\t}\n\t\tif ( char in formatMap ) {\n\t\t\tconst formatter =\n\t\t\t\tformatMap[ /** @type {keyof formatMap} */ ( char ) ];\n\t\t\tif ( typeof formatter !== 'string' ) {\n\t\t\t\t// If the format is a function, call it.\n\t\t\t\tnewFormat.push( '[' + formatter( momentDate ) + ']' );\n\t\t\t} else {\n\t\t\t\t// Otherwise, add as a formatting string.\n\t\t\t\tnewFormat.push( formatter );\n\t\t\t}\n\t\t} else {\n\t\t\tnewFormat.push( '[' + char + ']' );\n\t\t}\n\t}\n\t// Join with [] between to separate characters, and replace\n\t// unneeded separators with static text.\n\treturn momentDate.format( newFormat.join( '[]' ) );\n}\n\n/**\n * Formats a date (like `date()` in PHP).\n *\n * @param {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable\n * by moment.js.\n * @param {string | 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","startOfWeek","formats","time","date","datetime","datetimeAbbreviated","timezone","offset","string","abbr","setSettings","dateSettings","setupWPTimezone","momentLib","locales","includes","localeData","longDateFormat","defineLocale","currentLocale","parentLocale","hour","minute","isLowercase","LT","LTS","L","LL","LLL","LLLL","relativeTime","__experimentalGetSettings","tz","add","pack","name","abbrs","untils","offsets","MINUTE_IN_SECONDS","HOUR_IN_MINUTES","HOUR_IN_SECONDS","formatMap","D","j","l","N","S","momentDate","num","format","withOrdinal","replace","w","z","parseInt","toString","W","F","n","t","daysInMonth","isLeapYear","o","Y","a","A","B","timezoned","utcOffset","seconds","minutes","hours","g","G","H","i","u","v","e","I","isDST","O","P","T","Z","sign","parts","substring","split","map","c","r","U","dateFormat","dateValue","Date","char","newFormat","length","push","formatter","join","dateMoment","buildMoment","gmdate","utc","dateI18n","gmdateI18n","undefined","isInTheFuture","now","momentObject","isAfter","getDate","dateString","toDate","isUTCOffset","test"],"mappings":";;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMA,OAAO,GAAG,I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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASZ,WAAT,CAAsBT,SAAtB,EAAiD;AAAA,MAAhBzF,QAAgB,uEAAL,EAAK;AAChD,QAAMiG,UAAU,GAAG,qBAAWR,SAAX,CAAnB;;AAEA,MAAKzF,QAAQ,IAAI,CAAE+G,WAAW,CAAE/G,QAAF,CAA9B,EAA6C;AAC5C;AACA,WAAOiG,UAAU,CAACvE,EAAX;AAAe;AAAwB1B,IAAAA,QAAvC,CAAP;AACA;;AAED,MAAKA,QAAQ,IAAI+G,WAAW,CAAE/G,QAAF,CAA5B,EAA2C;AAC1C,WAAOiG,UAAU,CAAClC,SAAX,CAAsB/D,QAAtB,CAAP;AACA;;AAED,MAAKjC,QAAQ,CAACiC,QAAT,CAAkBE,MAAvB,EAAgC;AAC/B,WAAO+F,UAAU,CAACvE,EAAX,CAAe3D,QAAQ,CAACiC,QAAT,CAAkBE,MAAjC,CAAP;AACA;;AAED,SAAO+F,UAAU,CAAClC,SAAX,CAAsB,CAAChG,QAAQ,CAACiC,QAAT,CAAkBC,MAAzC,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS8G,WAAT,CAAsB9G,MAAtB,EAA+B;AAC9B,MAAK,aAAa,OAAOA,MAAzB,EAAkC;AACjC,WAAO,IAAP;AACA;;AAED,SAAOnC,gBAAgB,CAACkJ,IAAjB,CAAuB/G,MAAvB,CAAP;AACA;;AAEDK,eAAe","sourcesContent":["/**\n * External dependencies\n */\nimport momentLib from 'moment';\nimport 'moment-timezone/moment-timezone';\nimport 'moment-timezone/moment-timezone-utils';\n\n/** @typedef {import('moment').Moment} Moment */\n/** @typedef {import('moment').LocaleSpecification} MomentLocaleSpecification */\n\n/**\n * @typedef MeridiemConfig\n * @property {string} am Lowercase AM.\n * @property {string} AM Uppercase AM.\n * @property {string} pm Lowercase PM.\n * @property {string} PM Uppercase PM.\n */\n\n/**\n * @typedef FormatsConfig\n * @property {string} time Time format.\n * @property {string} date Date format.\n * @property {string} datetime Datetime format.\n * @property {string} datetimeAbbreviated Abbreviated datetime format.\n */\n\n/**\n * @typedef TimezoneConfig\n * @property {string} offset Offset setting.\n * @property {string} string The timezone as a string (e.g., `'America/Los_Angeles'`).\n * @property {string} abbr Abbreviation for the timezone.\n */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @typedef L10nSettings\n * @property {string} locale Moment locale.\n * @property {MomentLocaleSpecification['months']} months Locale months.\n * @property {MomentLocaleSpecification['monthsShort']} monthsShort Locale months short.\n * @property {MomentLocaleSpecification['weekdays']} weekdays Locale weekdays.\n * @property {MomentLocaleSpecification['weekdaysShort']} weekdaysShort Locale weekdays short.\n * @property {MeridiemConfig} meridiem Meridiem config.\n * @property {MomentLocaleSpecification['relativeTime']} relative Relative time config.\n * @property {0|1|2|3|4|5|6} startOfWeek Day that the week starts on.\n */\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * @typedef DateSettings\n * @property {L10nSettings} l10n Localization settings.\n * @property {FormatsConfig} formats Date/time formats config.\n * @property {TimezoneConfig} timezone Timezone settings.\n */\n\nconst WP_ZONE = 'WP';\n\n// This regular expression tests positive for UTC offsets as described in ISO 8601.\n// See: https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\nconst VALID_UTC_OFFSET = /^[+-][0-1][0-9](:?[0-9][0-9])?$/;\n\n// Changes made here will likely need to be made in `lib/client-assets.php` as\n// well because it uses the `setSettings()` function to change these settings.\n/** @type {DateSettings} */\nlet settings = {\n\tl10n: {\n\t\tlocale: 'en',\n\t\tmonths: [\n\t\t\t'January',\n\t\t\t'February',\n\t\t\t'March',\n\t\t\t'April',\n\t\t\t'May',\n\t\t\t'June',\n\t\t\t'July',\n\t\t\t'August',\n\t\t\t'September',\n\t\t\t'October',\n\t\t\t'November',\n\t\t\t'December',\n\t\t],\n\t\tmonthsShort: [\n\t\t\t'Jan',\n\t\t\t'Feb',\n\t\t\t'Mar',\n\t\t\t'Apr',\n\t\t\t'May',\n\t\t\t'Jun',\n\t\t\t'Jul',\n\t\t\t'Aug',\n\t\t\t'Sep',\n\t\t\t'Oct',\n\t\t\t'Nov',\n\t\t\t'Dec',\n\t\t],\n\t\tweekdays: [\n\t\t\t'Sunday',\n\t\t\t'Monday',\n\t\t\t'Tuesday',\n\t\t\t'Wednesday',\n\t\t\t'Thursday',\n\t\t\t'Friday',\n\t\t\t'Saturday',\n\t\t],\n\t\tweekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],\n\t\tmeridiem: { am: 'am', pm: 'pm', AM: 'AM', PM: 'PM' },\n\t\trelative: {\n\t\t\tfuture: '%s from now',\n\t\t\tpast: '%s ago',\n\t\t\ts: 'a few seconds',\n\t\t\tss: '%d seconds',\n\t\t\tm: 'a minute',\n\t\t\tmm: '%d minutes',\n\t\t\th: 'an hour',\n\t\t\thh: '%d hours',\n\t\t\td: 'a day',\n\t\t\tdd: '%d days',\n\t\t\tM: 'a month',\n\t\t\tMM: '%d months',\n\t\t\ty: 'a year',\n\t\t\tyy: '%d years',\n\t\t},\n\t\tstartOfWeek: 0,\n\t},\n\tformats: {\n\t\ttime: 'g: i a',\n\t\tdate: 'F j, Y',\n\t\tdatetime: 'F j, Y g: i a',\n\t\tdatetimeAbbreviated: 'M j, Y g: i a',\n\t},\n\ttimezone: { offset: '0', string: '', abbr: '' },\n};\n\n/**\n * Adds a locale to moment, using the format supplied by `wp_localize_script()`.\n *\n * @param {DateSettings} dateSettings Settings, including locale data.\n */\nexport function setSettings( dateSettings ) {\n\tsettings = dateSettings;\n\n\tsetupWPTimezone();\n\n\t// Does moment already have a locale with the right name?\n\tif ( momentLib.locales().includes( dateSettings.l10n.locale ) ) {\n\t\t// Is that locale misconfigured, e.g. because we are on a site running\n\t\t// WordPress < 6.0?\n\t\tif (\n\t\t\tmomentLib\n\t\t\t\t.localeData( dateSettings.l10n.locale )\n\t\t\t\t.longDateFormat( 'LTS' ) === null\n\t\t) {\n\t\t\t// Delete the misconfigured locale.\n\t\t\t// @ts-ignore Type definitions are incorrect - null is permitted.\n\t\t\tmomentLib.defineLocale( dateSettings.l10n.locale, null );\n\t\t} else {\n\t\t\t// We have a properly configured locale, so no need to create one.\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// defineLocale() will modify the current locale, so back it up.\n\tconst currentLocale = momentLib.locale();\n\n\t// Create locale.\n\tmomentLib.defineLocale( dateSettings.l10n.locale, {\n\t\t// Inherit anything missing from English. We don't load\n\t\t// moment-with-locales.js so English is all there is.\n\t\tparentLocale: 'en',\n\t\tmonths: dateSettings.l10n.months,\n\t\tmonthsShort: dateSettings.l10n.monthsShort,\n\t\tweekdays: dateSettings.l10n.weekdays,\n\t\tweekdaysShort: dateSettings.l10n.weekdaysShort,\n\t\tmeridiem( hour, minute, isLowercase ) {\n\t\t\tif ( hour < 12 ) {\n\t\t\t\treturn isLowercase\n\t\t\t\t\t? dateSettings.l10n.meridiem.am\n\t\t\t\t\t: dateSettings.l10n.meridiem.AM;\n\t\t\t}\n\t\t\treturn isLowercase\n\t\t\t\t? dateSettings.l10n.meridiem.pm\n\t\t\t\t: dateSettings.l10n.meridiem.PM;\n\t\t},\n\t\tlongDateFormat: {\n\t\t\tLT: dateSettings.formats.time,\n\t\t\tLTS: momentLib.localeData( 'en' ).longDateFormat( 'LTS' ),\n\t\t\tL: momentLib.localeData( 'en' ).longDateFormat( 'L' ),\n\t\t\tLL: dateSettings.formats.date,\n\t\t\tLLL: dateSettings.formats.datetime,\n\t\t\tLLLL: momentLib.localeData( 'en' ).longDateFormat( 'LLLL' ),\n\t\t},\n\t\t// From human_time_diff?\n\t\t// Set to `(number, withoutSuffix, key, isFuture) => {}` instead.\n\t\trelativeTime: dateSettings.l10n.relative,\n\t} );\n\n\t// Restore the locale to what it was.\n\tmomentLib.locale( currentLocale );\n}\n\n/**\n * Returns the currently defined date settings.\n *\n * @return {DateSettings} Settings, including locale data.\n */\nexport function __experimentalGetSettings() {\n\treturn settings;\n}\n\nfunction setupWPTimezone() {\n\t// Create WP timezone based off dateSettings.\n\tmomentLib.tz.add(\n\t\tmomentLib.tz.pack( {\n\t\t\tname: WP_ZONE,\n\t\t\tabbrs: [ WP_ZONE ],\n\t\t\tuntils: [ null ],\n\t\t\toffsets: [ -settings.timezone.offset * 60 || 0 ],\n\t\t} )\n\t);\n}\n\n// Date constants.\n/**\n * Number of seconds in one minute.\n *\n * @type {number}\n */\nconst MINUTE_IN_SECONDS = 60;\n/**\n * Number of minutes in one hour.\n *\n * @type {number}\n */\nconst HOUR_IN_MINUTES = 60;\n/**\n * Number of seconds in one hour.\n *\n * @type {number}\n */\nconst HOUR_IN_SECONDS = 60 * MINUTE_IN_SECONDS;\n\n/**\n * Map of PHP formats to Moment.js formats.\n *\n * These are used internally by {@link wp.date.format}, and are either\n * a string representing the corresponding Moment.js format code, or a\n * function which returns the formatted string.\n *\n * This should only be used through {@link wp.date.format}, not\n * directly.\n */\nconst formatMap = {\n\t// Day.\n\td: 'DD',\n\tD: 'ddd',\n\tj: 'D',\n\tl: 'dddd',\n\tN: 'E',\n\n\t/**\n\t * Gets the ordinal suffix.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tS( momentDate ) {\n\t\t// Do - D.\n\t\tconst num = momentDate.format( 'D' );\n\t\tconst withOrdinal = momentDate.format( 'Do' );\n\t\treturn withOrdinal.replace( num, '' );\n\t},\n\n\tw: 'd',\n\t/**\n\t * Gets the day of the year (zero-indexed).\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tz( momentDate ) {\n\t\t// DDD - 1.\n\t\treturn ( parseInt( momentDate.format( 'DDD' ), 10 ) - 1 ).toString();\n\t},\n\n\t// Week.\n\tW: 'W',\n\n\t// Month.\n\tF: 'MMMM',\n\tm: 'MM',\n\tM: 'MMM',\n\tn: 'M',\n\t/**\n\t * Gets the days in the month.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tt( momentDate ) {\n\t\treturn momentDate.daysInMonth();\n\t},\n\n\t// Year.\n\t/**\n\t * Gets whether the current year is a leap year.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tL( momentDate ) {\n\t\treturn momentDate.isLeapYear() ? '1' : '0';\n\t},\n\to: 'GGGG',\n\tY: 'YYYY',\n\ty: 'YY',\n\n\t// Time.\n\ta: 'a',\n\tA: 'A',\n\t/**\n\t * Gets the current time in Swatch Internet Time (.beats).\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tB( momentDate ) {\n\t\tconst timezoned = momentLib( momentDate ).utcOffset( 60 );\n\t\tconst seconds = parseInt( timezoned.format( 's' ), 10 ),\n\t\t\tminutes = parseInt( timezoned.format( 'm' ), 10 ),\n\t\t\thours = parseInt( timezoned.format( 'H' ), 10 );\n\t\treturn parseInt(\n\t\t\t(\n\t\t\t\t( seconds +\n\t\t\t\t\tminutes * MINUTE_IN_SECONDS +\n\t\t\t\t\thours * HOUR_IN_SECONDS ) /\n\t\t\t\t86.4\n\t\t\t).toString(),\n\t\t\t10\n\t\t);\n\t},\n\tg: 'h',\n\tG: 'H',\n\th: 'hh',\n\tH: 'HH',\n\ti: 'mm',\n\ts: 'ss',\n\tu: 'SSSSSS',\n\tv: 'SSS',\n\t// Timezone.\n\te: 'zz',\n\t/**\n\t * Gets whether the timezone is in DST currently.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tI( momentDate ) {\n\t\treturn momentDate.isDST() ? '1' : '0';\n\t},\n\tO: 'ZZ',\n\tP: 'Z',\n\tT: 'z',\n\t/**\n\t * Gets the timezone offset in seconds.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tZ( momentDate ) {\n\t\t// Timezone offset in seconds.\n\t\tconst offset = momentDate.format( 'Z' );\n\t\tconst sign = offset[ 0 ] === '-' ? -1 : 1;\n\t\tconst parts = offset\n\t\t\t.substring( 1 )\n\t\t\t.split( ':' )\n\t\t\t.map( ( n ) => parseInt( n, 10 ) );\n\t\treturn (\n\t\t\tsign *\n\t\t\t( parts[ 0 ] * HOUR_IN_MINUTES + parts[ 1 ] ) *\n\t\t\tMINUTE_IN_SECONDS\n\t\t);\n\t},\n\t// Full date/time.\n\tc: 'YYYY-MM-DDTHH:mm:ssZ', // .toISOString.\n\t/**\n\t * Formats the date as RFC2822.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tr( momentDate ) {\n\t\treturn momentDate\n\t\t\t.locale( 'en' )\n\t\t\t.format( 'ddd, DD MMM YYYY HH:mm:ss ZZ' );\n\t},\n\tU: 'X',\n};\n\n/**\n * Formats a date. Does not alter the date's timezone.\n *\n * @param {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date.\n */\nexport function format( dateFormat, dateValue = new Date() ) {\n\tlet i, char;\n\tconst newFormat = [];\n\tconst momentDate = momentLib( dateValue );\n\tfor ( i = 0; i < dateFormat.length; i++ ) {\n\t\tchar = dateFormat[ i ];\n\t\t// Is this an escape?\n\t\tif ( '\\\\' === char ) {\n\t\t\t// Add next character, then move on.\n\t\t\ti++;\n\t\t\tnewFormat.push( '[' + dateFormat[ i ] + ']' );\n\t\t\tcontinue;\n\t\t}\n\t\tif ( char in formatMap ) {\n\t\t\tconst formatter =\n\t\t\t\tformatMap[ /** @type {keyof formatMap} */ ( char ) ];\n\t\t\tif ( typeof formatter !== 'string' ) {\n\t\t\t\t// If the format is a function, call it.\n\t\t\t\tnewFormat.push( '[' + formatter( momentDate ) + ']' );\n\t\t\t} else {\n\t\t\t\t// Otherwise, add as a formatting string.\n\t\t\t\tnewFormat.push( formatter );\n\t\t\t}\n\t\t} else {\n\t\t\tnewFormat.push( '[' + char + ']' );\n\t\t}\n\t}\n\t// Join with [] between to separate characters, and replace\n\t// unneeded separators with static text.\n\treturn momentDate.format( newFormat.join( '[]' ) );\n}\n\n/**\n * Formats a date (like `date()` in PHP).\n *\n * @param {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable\n * by moment.js.\n * @param {string | number | undefined} timezone Timezone to output result in or a\n * UTC offset. Defaults to timezone from\n * site.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return {string} Formatted date in English.\n */\nexport function date( dateFormat, dateValue = new Date(), timezone ) {\n\tconst dateMoment = buildMoment( dateValue, timezone );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `date()` in PHP), in the UTC timezone.\n *\n * @param {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date in English.\n */\nexport function gmdate( dateFormat, dateValue = new Date() ) {\n\tconst dateMoment = momentLib( dateValue ).utc();\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `wp_date()` in PHP), translating it into site's locale.\n *\n * Backward Compatibility Notice: if `timezone` is set to `true`, the function\n * behaves like `gmdateI18n`.\n *\n * @param {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable by\n * moment.js.\n * @param {string | number | boolean | undefined} timezone Timezone to output result in or a\n * UTC offset. Defaults to timezone from\n * site. Notice: `boolean` is effectively\n * deprecated, but still supported for\n * backward compatibility reasons.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return {string} Formatted date.\n */\nexport function dateI18n( dateFormat, dateValue = new Date(), timezone ) {\n\tif ( true === timezone ) {\n\t\treturn gmdateI18n( dateFormat, dateValue );\n\t}\n\n\tif ( false === timezone ) {\n\t\ttimezone = undefined;\n\t}\n\n\tconst dateMoment = buildMoment( dateValue, timezone );\n\tdateMoment.locale( settings.l10n.locale );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `wp_date()` in PHP), translating it into site's locale\n * and using the UTC timezone.\n *\n * @param {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date.\n */\nexport function gmdateI18n( dateFormat, dateValue = new Date() ) {\n\tconst dateMoment = momentLib( dateValue ).utc();\n\tdateMoment.locale( settings.l10n.locale );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Check whether a date is considered in the future according to the WordPress settings.\n *\n * @param {string} dateValue Date String or Date object in the Defined WP Timezone.\n *\n * @return {boolean} Is in the future.\n */\nexport function isInTheFuture( dateValue ) {\n\tconst now = momentLib.tz( WP_ZONE );\n\tconst momentObject = momentLib.tz( dateValue, WP_ZONE );\n\n\treturn momentObject.isAfter( now );\n}\n\n/**\n * Create and return a JavaScript Date Object from a date string in the WP timezone.\n *\n * @param {string?} dateString Date formatted in the WP timezone.\n *\n * @return {Date} Date\n */\nexport function getDate( dateString ) {\n\tif ( ! dateString ) {\n\t\treturn momentLib.tz( WP_ZONE ).toDate();\n\t}\n\n\treturn momentLib.tz( dateString, WP_ZONE ).toDate();\n}\n\n/**\n * Creates a moment instance using the given timezone or, if none is provided, using global settings.\n *\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable\n * by moment.js.\n * @param {string | number | undefined} timezone Timezone to output result in or a\n * UTC offset. Defaults to timezone from\n * site.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return {Moment} a moment instance.\n */\nfunction buildMoment( dateValue, timezone = '' ) {\n\tconst dateMoment = momentLib( dateValue );\n\n\tif ( timezone && ! isUTCOffset( timezone ) ) {\n\t\t// The ! isUTCOffset() check guarantees that timezone is a string.\n\t\treturn dateMoment.tz( /** @type {string} */ ( timezone ) );\n\t}\n\n\tif ( timezone && isUTCOffset( timezone ) ) {\n\t\treturn dateMoment.utcOffset( timezone );\n\t}\n\n\tif ( settings.timezone.string ) {\n\t\treturn dateMoment.tz( settings.timezone.string );\n\t}\n\n\treturn dateMoment.utcOffset( +settings.timezone.offset );\n}\n\n/**\n * Returns whether a certain UTC offset is valid or not.\n *\n * @param {number|string} offset a UTC offset.\n *\n * @return {boolean} whether a certain UTC offset is valid or not.\n */\nfunction isUTCOffset( offset ) {\n\tif ( 'number' === typeof offset ) {\n\t\treturn true;\n\t}\n\n\treturn VALID_UTC_OFFSET.test( offset );\n}\n\nsetupWPTimezone();\n"]}
@@ -420,7 +420,7 @@ export function format(dateFormat) {
420
420
  * See php.net/date.
421
421
  * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable
422
422
  * by moment.js.
423
- * @param {string | undefined} timezone Timezone to output result in or a
423
+ * @param {string | number | undefined} timezone Timezone to output result in or a
424
424
  * UTC offset. Defaults to timezone from
425
425
  * site.
426
426
  *
@@ -458,15 +458,15 @@ export function gmdate(dateFormat) {
458
458
  * Backward Compatibility Notice: if `timezone` is set to `true`, the function
459
459
  * behaves like `gmdateI18n`.
460
460
  *
461
- * @param {string} dateFormat PHP-style formatting string.
462
- * See php.net/date.
463
- * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable by
464
- * moment.js.
465
- * @param {string | boolean | undefined} timezone Timezone to output result in or a
466
- * UTC offset. Defaults to timezone from
467
- * site. Notice: `boolean` is effectively
468
- * deprecated, but still supported for
469
- * backward compatibility reasons.
461
+ * @param {string} dateFormat PHP-style formatting string.
462
+ * See php.net/date.
463
+ * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable by
464
+ * moment.js.
465
+ * @param {string | number | boolean | undefined} timezone Timezone to output result in or a
466
+ * UTC offset. Defaults to timezone from
467
+ * site. Notice: `boolean` is effectively
468
+ * deprecated, but still supported for
469
+ * backward compatibility reasons.
470
470
  *
471
471
  * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
472
472
  * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC
@@ -541,7 +541,7 @@ export function getDate(dateString) {
541
541
  *
542
542
  * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable
543
543
  * by moment.js.
544
- * @param {string | undefined} timezone Timezone to output result in or a
544
+ * @param {string | number | undefined} timezone Timezone to output result in or a
545
545
  * UTC offset. Defaults to timezone from
546
546
  * site.
547
547
  *
@@ -556,7 +556,10 @@ function buildMoment(dateValue) {
556
556
  const dateMoment = momentLib(dateValue);
557
557
 
558
558
  if (timezone && !isUTCOffset(timezone)) {
559
- return dateMoment.tz(timezone);
559
+ // The ! isUTCOffset() check guarantees that timezone is a string.
560
+ return dateMoment.tz(
561
+ /** @type {string} */
562
+ timezone);
560
563
  }
561
564
 
562
565
  if (timezone && isUTCOffset(timezone)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/date/src/index.js"],"names":["momentLib","WP_ZONE","VALID_UTC_OFFSET","settings","l10n","locale","months","monthsShort","weekdays","weekdaysShort","meridiem","am","pm","AM","PM","relative","future","past","s","ss","m","mm","h","hh","d","dd","M","MM","y","yy","startOfWeek","formats","time","date","datetime","datetimeAbbreviated","timezone","offset","string","abbr","setSettings","dateSettings","setupWPTimezone","locales","includes","localeData","longDateFormat","defineLocale","currentLocale","parentLocale","hour","minute","isLowercase","LT","LTS","L","LL","LLL","LLLL","relativeTime","__experimentalGetSettings","tz","add","pack","name","abbrs","untils","offsets","MINUTE_IN_SECONDS","HOUR_IN_MINUTES","HOUR_IN_SECONDS","formatMap","D","j","l","N","S","momentDate","num","format","withOrdinal","replace","w","z","parseInt","toString","W","F","n","t","daysInMonth","isLeapYear","o","Y","a","A","B","timezoned","utcOffset","seconds","minutes","hours","g","G","H","i","u","v","e","I","isDST","O","P","T","Z","sign","parts","substring","split","map","c","r","U","dateFormat","dateValue","Date","char","newFormat","length","push","formatter","join","dateMoment","buildMoment","gmdate","utc","dateI18n","gmdateI18n","undefined","isInTheFuture","now","momentObject","isAfter","getDate","dateString","toDate","isUTCOffset","test"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,SAAP,MAAsB,QAAtB;AACA,OAAO,iCAAP;AACA,OAAO,uCAAP;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,OAAO,GAAG,IAAhB,C,CAEA;AACA;;AACA,MAAMC,gBAAgB,GAAG,iCAAzB,C,CAEA;AACA;;AACA;;AACA,IAAIC,QAAQ,GAAG;AACdC,EAAAA,IAAI,EAAE;AACLC,IAAAA,MAAM,EAAE,IADH;AAELC,IAAAA,MAAM,EAAE,CACP,SADO,EAEP,UAFO,EAGP,OAHO,EAIP,OAJO,EAKP,KALO,EAMP,MANO,EAOP,MAPO,EAQP,QARO,EASP,WATO,EAUP,SAVO,EAWP,UAXO,EAYP,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,IAAAA,QAAQ,EAAE,CACT,QADS,EAET,QAFS,EAGT,SAHS,EAIT,WAJS,EAKT,UALS,EAMT,QANS,EAOT,UAPS,CA9BL;AAuCLC,IAAAA,aAAa,EAAE,CAAE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C,QAAT,CAAkBE,MAAvB,EAAgC;AAC/B,WAAO8F,UAAU,CAACvE,EAAX,CAAe1D,QAAQ,CAACiC,QAAT,CAAkBE,MAAjC,CAAP;AACA;;AAED,SAAO8F,UAAU,CAAClC,SAAX,CAAsB,CAAC/F,QAAQ,CAACiC,QAAT,CAAkBC,MAAzC,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS6G,WAAT,CAAsB7G,MAAtB,EAA+B;AAC9B,MAAK,aAAa,OAAOA,MAAzB,EAAkC;AACjC,WAAO,IAAP;AACA;;AAED,SAAOnC,gBAAgB,CAACiJ,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 * @property {0|1|2|3|4|5|6} startOfWeek Day that the week starts on.\n */\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * @typedef DateSettings\n * @property {L10nSettings} l10n Localization settings.\n * @property {FormatsConfig} formats Date/time formats config.\n * @property {TimezoneConfig} timezone Timezone settings.\n */\n\nconst WP_ZONE = 'WP';\n\n// This regular expression tests positive for UTC offsets as described in ISO 8601.\n// See: https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\nconst VALID_UTC_OFFSET = /^[+-][0-1][0-9](:?[0-9][0-9])?$/;\n\n// Changes made here will likely need to be made in `lib/client-assets.php` as\n// well because it uses the `setSettings()` function to change these settings.\n/** @type {DateSettings} */\nlet settings = {\n\tl10n: {\n\t\tlocale: 'en',\n\t\tmonths: [\n\t\t\t'January',\n\t\t\t'February',\n\t\t\t'March',\n\t\t\t'April',\n\t\t\t'May',\n\t\t\t'June',\n\t\t\t'July',\n\t\t\t'August',\n\t\t\t'September',\n\t\t\t'October',\n\t\t\t'November',\n\t\t\t'December',\n\t\t],\n\t\tmonthsShort: [\n\t\t\t'Jan',\n\t\t\t'Feb',\n\t\t\t'Mar',\n\t\t\t'Apr',\n\t\t\t'May',\n\t\t\t'Jun',\n\t\t\t'Jul',\n\t\t\t'Aug',\n\t\t\t'Sep',\n\t\t\t'Oct',\n\t\t\t'Nov',\n\t\t\t'Dec',\n\t\t],\n\t\tweekdays: [\n\t\t\t'Sunday',\n\t\t\t'Monday',\n\t\t\t'Tuesday',\n\t\t\t'Wednesday',\n\t\t\t'Thursday',\n\t\t\t'Friday',\n\t\t\t'Saturday',\n\t\t],\n\t\tweekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],\n\t\tmeridiem: { am: 'am', pm: 'pm', AM: 'AM', PM: 'PM' },\n\t\trelative: {\n\t\t\tfuture: '%s from now',\n\t\t\tpast: '%s ago',\n\t\t\ts: 'a few seconds',\n\t\t\tss: '%d seconds',\n\t\t\tm: 'a minute',\n\t\t\tmm: '%d minutes',\n\t\t\th: 'an hour',\n\t\t\thh: '%d hours',\n\t\t\td: 'a day',\n\t\t\tdd: '%d days',\n\t\t\tM: 'a month',\n\t\t\tMM: '%d months',\n\t\t\ty: 'a year',\n\t\t\tyy: '%d years',\n\t\t},\n\t\tstartOfWeek: 0,\n\t},\n\tformats: {\n\t\ttime: 'g: i a',\n\t\tdate: 'F j, Y',\n\t\tdatetime: 'F j, Y g: i a',\n\t\tdatetimeAbbreviated: 'M j, Y g: i a',\n\t},\n\ttimezone: { offset: '0', string: '', abbr: '' },\n};\n\n/**\n * Adds a locale to moment, using the format supplied by `wp_localize_script()`.\n *\n * @param {DateSettings} dateSettings Settings, including locale data.\n */\nexport function setSettings( dateSettings ) {\n\tsettings = dateSettings;\n\n\tsetupWPTimezone();\n\n\t// Does moment already have a locale with the right name?\n\tif ( momentLib.locales().includes( dateSettings.l10n.locale ) ) {\n\t\t// Is that locale misconfigured, e.g. because we are on a site running\n\t\t// WordPress < 6.0?\n\t\tif (\n\t\t\tmomentLib\n\t\t\t\t.localeData( dateSettings.l10n.locale )\n\t\t\t\t.longDateFormat( 'LTS' ) === null\n\t\t) {\n\t\t\t// Delete the misconfigured locale.\n\t\t\t// @ts-ignore Type definitions are incorrect - null is permitted.\n\t\t\tmomentLib.defineLocale( dateSettings.l10n.locale, null );\n\t\t} else {\n\t\t\t// We have a properly configured locale, so no need to create one.\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// defineLocale() will modify the current locale, so back it up.\n\tconst currentLocale = momentLib.locale();\n\n\t// Create locale.\n\tmomentLib.defineLocale( dateSettings.l10n.locale, {\n\t\t// Inherit anything missing from English. We don't load\n\t\t// moment-with-locales.js so English is all there is.\n\t\tparentLocale: 'en',\n\t\tmonths: dateSettings.l10n.months,\n\t\tmonthsShort: dateSettings.l10n.monthsShort,\n\t\tweekdays: dateSettings.l10n.weekdays,\n\t\tweekdaysShort: dateSettings.l10n.weekdaysShort,\n\t\tmeridiem( hour, minute, isLowercase ) {\n\t\t\tif ( hour < 12 ) {\n\t\t\t\treturn isLowercase\n\t\t\t\t\t? dateSettings.l10n.meridiem.am\n\t\t\t\t\t: dateSettings.l10n.meridiem.AM;\n\t\t\t}\n\t\t\treturn isLowercase\n\t\t\t\t? dateSettings.l10n.meridiem.pm\n\t\t\t\t: dateSettings.l10n.meridiem.PM;\n\t\t},\n\t\tlongDateFormat: {\n\t\t\tLT: dateSettings.formats.time,\n\t\t\tLTS: momentLib.localeData( 'en' ).longDateFormat( 'LTS' ),\n\t\t\tL: momentLib.localeData( 'en' ).longDateFormat( 'L' ),\n\t\t\tLL: dateSettings.formats.date,\n\t\t\tLLL: dateSettings.formats.datetime,\n\t\t\tLLLL: momentLib.localeData( 'en' ).longDateFormat( 'LLLL' ),\n\t\t},\n\t\t// From human_time_diff?\n\t\t// Set to `(number, withoutSuffix, key, isFuture) => {}` instead.\n\t\trelativeTime: dateSettings.l10n.relative,\n\t} );\n\n\t// Restore the locale to what it was.\n\tmomentLib.locale( currentLocale );\n}\n\n/**\n * Returns the currently defined date settings.\n *\n * @return {DateSettings} Settings, including locale data.\n */\nexport function __experimentalGetSettings() {\n\treturn settings;\n}\n\nfunction setupWPTimezone() {\n\t// Create WP timezone based off dateSettings.\n\tmomentLib.tz.add(\n\t\tmomentLib.tz.pack( {\n\t\t\tname: WP_ZONE,\n\t\t\tabbrs: [ WP_ZONE ],\n\t\t\tuntils: [ null ],\n\t\t\toffsets: [ -settings.timezone.offset * 60 || 0 ],\n\t\t} )\n\t);\n}\n\n// Date constants.\n/**\n * Number of seconds in one minute.\n *\n * @type {number}\n */\nconst MINUTE_IN_SECONDS = 60;\n/**\n * Number of minutes in one hour.\n *\n * @type {number}\n */\nconst HOUR_IN_MINUTES = 60;\n/**\n * Number of seconds in one hour.\n *\n * @type {number}\n */\nconst HOUR_IN_SECONDS = 60 * MINUTE_IN_SECONDS;\n\n/**\n * Map of PHP formats to Moment.js formats.\n *\n * These are used internally by {@link wp.date.format}, and are either\n * a string representing the corresponding Moment.js format code, or a\n * function which returns the formatted string.\n *\n * This should only be used through {@link wp.date.format}, not\n * directly.\n */\nconst formatMap = {\n\t// Day.\n\td: 'DD',\n\tD: 'ddd',\n\tj: 'D',\n\tl: 'dddd',\n\tN: 'E',\n\n\t/**\n\t * Gets the ordinal suffix.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tS( momentDate ) {\n\t\t// Do - D.\n\t\tconst num = momentDate.format( 'D' );\n\t\tconst withOrdinal = momentDate.format( 'Do' );\n\t\treturn withOrdinal.replace( num, '' );\n\t},\n\n\tw: 'd',\n\t/**\n\t * Gets the day of the year (zero-indexed).\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tz( momentDate ) {\n\t\t// DDD - 1.\n\t\treturn ( parseInt( momentDate.format( 'DDD' ), 10 ) - 1 ).toString();\n\t},\n\n\t// Week.\n\tW: 'W',\n\n\t// Month.\n\tF: 'MMMM',\n\tm: 'MM',\n\tM: 'MMM',\n\tn: 'M',\n\t/**\n\t * Gets the days in the month.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tt( momentDate ) {\n\t\treturn momentDate.daysInMonth();\n\t},\n\n\t// Year.\n\t/**\n\t * Gets whether the current year is a leap year.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tL( momentDate ) {\n\t\treturn momentDate.isLeapYear() ? '1' : '0';\n\t},\n\to: 'GGGG',\n\tY: 'YYYY',\n\ty: 'YY',\n\n\t// Time.\n\ta: 'a',\n\tA: 'A',\n\t/**\n\t * Gets the current time in Swatch Internet Time (.beats).\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tB( momentDate ) {\n\t\tconst timezoned = momentLib( momentDate ).utcOffset( 60 );\n\t\tconst seconds = parseInt( timezoned.format( 's' ), 10 ),\n\t\t\tminutes = parseInt( timezoned.format( 'm' ), 10 ),\n\t\t\thours = parseInt( timezoned.format( 'H' ), 10 );\n\t\treturn parseInt(\n\t\t\t(\n\t\t\t\t( seconds +\n\t\t\t\t\tminutes * MINUTE_IN_SECONDS +\n\t\t\t\t\thours * HOUR_IN_SECONDS ) /\n\t\t\t\t86.4\n\t\t\t).toString(),\n\t\t\t10\n\t\t);\n\t},\n\tg: 'h',\n\tG: 'H',\n\th: 'hh',\n\tH: 'HH',\n\ti: 'mm',\n\ts: 'ss',\n\tu: 'SSSSSS',\n\tv: 'SSS',\n\t// Timezone.\n\te: 'zz',\n\t/**\n\t * Gets whether the timezone is in DST currently.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tI( momentDate ) {\n\t\treturn momentDate.isDST() ? '1' : '0';\n\t},\n\tO: 'ZZ',\n\tP: 'Z',\n\tT: 'z',\n\t/**\n\t * Gets the timezone offset in seconds.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tZ( momentDate ) {\n\t\t// Timezone offset in seconds.\n\t\tconst offset = momentDate.format( 'Z' );\n\t\tconst sign = offset[ 0 ] === '-' ? -1 : 1;\n\t\tconst parts = offset\n\t\t\t.substring( 1 )\n\t\t\t.split( ':' )\n\t\t\t.map( ( n ) => parseInt( n, 10 ) );\n\t\treturn (\n\t\t\tsign *\n\t\t\t( parts[ 0 ] * HOUR_IN_MINUTES + parts[ 1 ] ) *\n\t\t\tMINUTE_IN_SECONDS\n\t\t);\n\t},\n\t// Full date/time.\n\tc: 'YYYY-MM-DDTHH:mm:ssZ', // .toISOString.\n\t/**\n\t * Formats the date as RFC2822.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tr( momentDate ) {\n\t\treturn momentDate\n\t\t\t.locale( 'en' )\n\t\t\t.format( 'ddd, DD MMM YYYY HH:mm:ss ZZ' );\n\t},\n\tU: 'X',\n};\n\n/**\n * Formats a date. Does not alter the date's timezone.\n *\n * @param {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date.\n */\nexport function format( dateFormat, dateValue = new Date() ) {\n\tlet i, char;\n\tconst newFormat = [];\n\tconst momentDate = momentLib( dateValue );\n\tfor ( i = 0; i < dateFormat.length; i++ ) {\n\t\tchar = dateFormat[ i ];\n\t\t// Is this an escape?\n\t\tif ( '\\\\' === char ) {\n\t\t\t// Add next character, then move on.\n\t\t\ti++;\n\t\t\tnewFormat.push( '[' + dateFormat[ i ] + ']' );\n\t\t\tcontinue;\n\t\t}\n\t\tif ( char in formatMap ) {\n\t\t\tconst formatter =\n\t\t\t\tformatMap[ /** @type {keyof formatMap} */ ( char ) ];\n\t\t\tif ( typeof formatter !== 'string' ) {\n\t\t\t\t// If the format is a function, call it.\n\t\t\t\tnewFormat.push( '[' + formatter( momentDate ) + ']' );\n\t\t\t} else {\n\t\t\t\t// Otherwise, add as a formatting string.\n\t\t\t\tnewFormat.push( formatter );\n\t\t\t}\n\t\t} else {\n\t\t\tnewFormat.push( '[' + char + ']' );\n\t\t}\n\t}\n\t// Join with [] between to separate characters, and replace\n\t// unneeded separators with static text.\n\treturn momentDate.format( newFormat.join( '[]' ) );\n}\n\n/**\n * Formats a date (like `date()` in PHP).\n *\n * @param {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable\n * by moment.js.\n * @param {string | 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","startOfWeek","formats","time","date","datetime","datetimeAbbreviated","timezone","offset","string","abbr","setSettings","dateSettings","setupWPTimezone","locales","includes","localeData","longDateFormat","defineLocale","currentLocale","parentLocale","hour","minute","isLowercase","LT","LTS","L","LL","LLL","LLLL","relativeTime","__experimentalGetSettings","tz","add","pack","name","abbrs","untils","offsets","MINUTE_IN_SECONDS","HOUR_IN_MINUTES","HOUR_IN_SECONDS","formatMap","D","j","l","N","S","momentDate","num","format","withOrdinal","replace","w","z","parseInt","toString","W","F","n","t","daysInMonth","isLeapYear","o","Y","a","A","B","timezoned","utcOffset","seconds","minutes","hours","g","G","H","i","u","v","e","I","isDST","O","P","T","Z","sign","parts","substring","split","map","c","r","U","dateFormat","dateValue","Date","char","newFormat","length","push","formatter","join","dateMoment","buildMoment","gmdate","utc","dateI18n","gmdateI18n","undefined","isInTheFuture","now","momentObject","isAfter","getDate","dateString","toDate","isUTCOffset","test"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,SAAP,MAAsB,QAAtB;AACA,OAAO,iCAAP;AACA,OAAO,uCAAP;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,OAAO,GAAG,IAAhB,C,CAEA;AACA;;AACA,MAAMC,gBAAgB,GAAG,iCAAzB,C,CAEA;AACA;;AACA;;AACA,IAAIC,QAAQ,GAA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AC6D,EAAV,CAAcmF,UAAd,EAA0B/I,OAA1B,EAAoCgJ,MAApC,EAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASZ,WAAT,CAAsBT,SAAtB,EAAiD;AAAA,MAAhBxF,QAAgB,uEAAL,EAAK;AAChD,QAAMgG,UAAU,GAAGpI,SAAS,CAAE4H,SAAF,CAA5B;;AAEA,MAAKxF,QAAQ,IAAI,CAAE8G,WAAW,CAAE9G,QAAF,CAA9B,EAA6C;AAC5C;AACA,WAAOgG,UAAU,CAACvE,EAAX;AAAe;AAAwBzB,IAAAA,QAAvC,CAAP;AACA;;AAED,MAAKA,QAAQ,IAAI8G,WAAW,CAAE9G,QAAF,CAA5B,EAA2C;AAC1C,WAAOgG,UAAU,CAAClC,SAAX,CAAsB9D,QAAtB,CAAP;AACA;;AAED,MAAKjC,QAAQ,CAACiC,QAAT,CAAkBE,MAAvB,EAAgC;AAC/B,WAAO8F,UAAU,CAACvE,EAAX,CAAe1D,QAAQ,CAACiC,QAAT,CAAkBE,MAAjC,CAAP;AACA;;AAED,SAAO8F,UAAU,CAAClC,SAAX,CAAsB,CAAC/F,QAAQ,CAACiC,QAAT,CAAkBC,MAAzC,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS6G,WAAT,CAAsB7G,MAAtB,EAA+B;AAC9B,MAAK,aAAa,OAAOA,MAAzB,EAAkC;AACjC,WAAO,IAAP;AACA;;AAED,SAAOnC,gBAAgB,CAACiJ,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 * @property {0|1|2|3|4|5|6} startOfWeek Day that the week starts on.\n */\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * @typedef DateSettings\n * @property {L10nSettings} l10n Localization settings.\n * @property {FormatsConfig} formats Date/time formats config.\n * @property {TimezoneConfig} timezone Timezone settings.\n */\n\nconst WP_ZONE = 'WP';\n\n// This regular expression tests positive for UTC offsets as described in ISO 8601.\n// See: https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\nconst VALID_UTC_OFFSET = /^[+-][0-1][0-9](:?[0-9][0-9])?$/;\n\n// Changes made here will likely need to be made in `lib/client-assets.php` as\n// well because it uses the `setSettings()` function to change these settings.\n/** @type {DateSettings} */\nlet settings = {\n\tl10n: {\n\t\tlocale: 'en',\n\t\tmonths: [\n\t\t\t'January',\n\t\t\t'February',\n\t\t\t'March',\n\t\t\t'April',\n\t\t\t'May',\n\t\t\t'June',\n\t\t\t'July',\n\t\t\t'August',\n\t\t\t'September',\n\t\t\t'October',\n\t\t\t'November',\n\t\t\t'December',\n\t\t],\n\t\tmonthsShort: [\n\t\t\t'Jan',\n\t\t\t'Feb',\n\t\t\t'Mar',\n\t\t\t'Apr',\n\t\t\t'May',\n\t\t\t'Jun',\n\t\t\t'Jul',\n\t\t\t'Aug',\n\t\t\t'Sep',\n\t\t\t'Oct',\n\t\t\t'Nov',\n\t\t\t'Dec',\n\t\t],\n\t\tweekdays: [\n\t\t\t'Sunday',\n\t\t\t'Monday',\n\t\t\t'Tuesday',\n\t\t\t'Wednesday',\n\t\t\t'Thursday',\n\t\t\t'Friday',\n\t\t\t'Saturday',\n\t\t],\n\t\tweekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],\n\t\tmeridiem: { am: 'am', pm: 'pm', AM: 'AM', PM: 'PM' },\n\t\trelative: {\n\t\t\tfuture: '%s from now',\n\t\t\tpast: '%s ago',\n\t\t\ts: 'a few seconds',\n\t\t\tss: '%d seconds',\n\t\t\tm: 'a minute',\n\t\t\tmm: '%d minutes',\n\t\t\th: 'an hour',\n\t\t\thh: '%d hours',\n\t\t\td: 'a day',\n\t\t\tdd: '%d days',\n\t\t\tM: 'a month',\n\t\t\tMM: '%d months',\n\t\t\ty: 'a year',\n\t\t\tyy: '%d years',\n\t\t},\n\t\tstartOfWeek: 0,\n\t},\n\tformats: {\n\t\ttime: 'g: i a',\n\t\tdate: 'F j, Y',\n\t\tdatetime: 'F j, Y g: i a',\n\t\tdatetimeAbbreviated: 'M j, Y g: i a',\n\t},\n\ttimezone: { offset: '0', string: '', abbr: '' },\n};\n\n/**\n * Adds a locale to moment, using the format supplied by `wp_localize_script()`.\n *\n * @param {DateSettings} dateSettings Settings, including locale data.\n */\nexport function setSettings( dateSettings ) {\n\tsettings = dateSettings;\n\n\tsetupWPTimezone();\n\n\t// Does moment already have a locale with the right name?\n\tif ( momentLib.locales().includes( dateSettings.l10n.locale ) ) {\n\t\t// Is that locale misconfigured, e.g. because we are on a site running\n\t\t// WordPress < 6.0?\n\t\tif (\n\t\t\tmomentLib\n\t\t\t\t.localeData( dateSettings.l10n.locale )\n\t\t\t\t.longDateFormat( 'LTS' ) === null\n\t\t) {\n\t\t\t// Delete the misconfigured locale.\n\t\t\t// @ts-ignore Type definitions are incorrect - null is permitted.\n\t\t\tmomentLib.defineLocale( dateSettings.l10n.locale, null );\n\t\t} else {\n\t\t\t// We have a properly configured locale, so no need to create one.\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// defineLocale() will modify the current locale, so back it up.\n\tconst currentLocale = momentLib.locale();\n\n\t// Create locale.\n\tmomentLib.defineLocale( dateSettings.l10n.locale, {\n\t\t// Inherit anything missing from English. We don't load\n\t\t// moment-with-locales.js so English is all there is.\n\t\tparentLocale: 'en',\n\t\tmonths: dateSettings.l10n.months,\n\t\tmonthsShort: dateSettings.l10n.monthsShort,\n\t\tweekdays: dateSettings.l10n.weekdays,\n\t\tweekdaysShort: dateSettings.l10n.weekdaysShort,\n\t\tmeridiem( hour, minute, isLowercase ) {\n\t\t\tif ( hour < 12 ) {\n\t\t\t\treturn isLowercase\n\t\t\t\t\t? dateSettings.l10n.meridiem.am\n\t\t\t\t\t: dateSettings.l10n.meridiem.AM;\n\t\t\t}\n\t\t\treturn isLowercase\n\t\t\t\t? dateSettings.l10n.meridiem.pm\n\t\t\t\t: dateSettings.l10n.meridiem.PM;\n\t\t},\n\t\tlongDateFormat: {\n\t\t\tLT: dateSettings.formats.time,\n\t\t\tLTS: momentLib.localeData( 'en' ).longDateFormat( 'LTS' ),\n\t\t\tL: momentLib.localeData( 'en' ).longDateFormat( 'L' ),\n\t\t\tLL: dateSettings.formats.date,\n\t\t\tLLL: dateSettings.formats.datetime,\n\t\t\tLLLL: momentLib.localeData( 'en' ).longDateFormat( 'LLLL' ),\n\t\t},\n\t\t// From human_time_diff?\n\t\t// Set to `(number, withoutSuffix, key, isFuture) => {}` instead.\n\t\trelativeTime: dateSettings.l10n.relative,\n\t} );\n\n\t// Restore the locale to what it was.\n\tmomentLib.locale( currentLocale );\n}\n\n/**\n * Returns the currently defined date settings.\n *\n * @return {DateSettings} Settings, including locale data.\n */\nexport function __experimentalGetSettings() {\n\treturn settings;\n}\n\nfunction setupWPTimezone() {\n\t// Create WP timezone based off dateSettings.\n\tmomentLib.tz.add(\n\t\tmomentLib.tz.pack( {\n\t\t\tname: WP_ZONE,\n\t\t\tabbrs: [ WP_ZONE ],\n\t\t\tuntils: [ null ],\n\t\t\toffsets: [ -settings.timezone.offset * 60 || 0 ],\n\t\t} )\n\t);\n}\n\n// Date constants.\n/**\n * Number of seconds in one minute.\n *\n * @type {number}\n */\nconst MINUTE_IN_SECONDS = 60;\n/**\n * Number of minutes in one hour.\n *\n * @type {number}\n */\nconst HOUR_IN_MINUTES = 60;\n/**\n * Number of seconds in one hour.\n *\n * @type {number}\n */\nconst HOUR_IN_SECONDS = 60 * MINUTE_IN_SECONDS;\n\n/**\n * Map of PHP formats to Moment.js formats.\n *\n * These are used internally by {@link wp.date.format}, and are either\n * a string representing the corresponding Moment.js format code, or a\n * function which returns the formatted string.\n *\n * This should only be used through {@link wp.date.format}, not\n * directly.\n */\nconst formatMap = {\n\t// Day.\n\td: 'DD',\n\tD: 'ddd',\n\tj: 'D',\n\tl: 'dddd',\n\tN: 'E',\n\n\t/**\n\t * Gets the ordinal suffix.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tS( momentDate ) {\n\t\t// Do - D.\n\t\tconst num = momentDate.format( 'D' );\n\t\tconst withOrdinal = momentDate.format( 'Do' );\n\t\treturn withOrdinal.replace( num, '' );\n\t},\n\n\tw: 'd',\n\t/**\n\t * Gets the day of the year (zero-indexed).\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tz( momentDate ) {\n\t\t// DDD - 1.\n\t\treturn ( parseInt( momentDate.format( 'DDD' ), 10 ) - 1 ).toString();\n\t},\n\n\t// Week.\n\tW: 'W',\n\n\t// Month.\n\tF: 'MMMM',\n\tm: 'MM',\n\tM: 'MMM',\n\tn: 'M',\n\t/**\n\t * Gets the days in the month.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tt( momentDate ) {\n\t\treturn momentDate.daysInMonth();\n\t},\n\n\t// Year.\n\t/**\n\t * Gets whether the current year is a leap year.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tL( momentDate ) {\n\t\treturn momentDate.isLeapYear() ? '1' : '0';\n\t},\n\to: 'GGGG',\n\tY: 'YYYY',\n\ty: 'YY',\n\n\t// Time.\n\ta: 'a',\n\tA: 'A',\n\t/**\n\t * Gets the current time in Swatch Internet Time (.beats).\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tB( momentDate ) {\n\t\tconst timezoned = momentLib( momentDate ).utcOffset( 60 );\n\t\tconst seconds = parseInt( timezoned.format( 's' ), 10 ),\n\t\t\tminutes = parseInt( timezoned.format( 'm' ), 10 ),\n\t\t\thours = parseInt( timezoned.format( 'H' ), 10 );\n\t\treturn parseInt(\n\t\t\t(\n\t\t\t\t( seconds +\n\t\t\t\t\tminutes * MINUTE_IN_SECONDS +\n\t\t\t\t\thours * HOUR_IN_SECONDS ) /\n\t\t\t\t86.4\n\t\t\t).toString(),\n\t\t\t10\n\t\t);\n\t},\n\tg: 'h',\n\tG: 'H',\n\th: 'hh',\n\tH: 'HH',\n\ti: 'mm',\n\ts: 'ss',\n\tu: 'SSSSSS',\n\tv: 'SSS',\n\t// Timezone.\n\te: 'zz',\n\t/**\n\t * Gets whether the timezone is in DST currently.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tI( momentDate ) {\n\t\treturn momentDate.isDST() ? '1' : '0';\n\t},\n\tO: 'ZZ',\n\tP: 'Z',\n\tT: 'z',\n\t/**\n\t * Gets the timezone offset in seconds.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {number} Formatted date.\n\t */\n\tZ( momentDate ) {\n\t\t// Timezone offset in seconds.\n\t\tconst offset = momentDate.format( 'Z' );\n\t\tconst sign = offset[ 0 ] === '-' ? -1 : 1;\n\t\tconst parts = offset\n\t\t\t.substring( 1 )\n\t\t\t.split( ':' )\n\t\t\t.map( ( n ) => parseInt( n, 10 ) );\n\t\treturn (\n\t\t\tsign *\n\t\t\t( parts[ 0 ] * HOUR_IN_MINUTES + parts[ 1 ] ) *\n\t\t\tMINUTE_IN_SECONDS\n\t\t);\n\t},\n\t// Full date/time.\n\tc: 'YYYY-MM-DDTHH:mm:ssZ', // .toISOString.\n\t/**\n\t * Formats the date as RFC2822.\n\t *\n\t * @param {Moment} momentDate Moment instance.\n\t *\n\t * @return {string} Formatted date.\n\t */\n\tr( momentDate ) {\n\t\treturn momentDate\n\t\t\t.locale( 'en' )\n\t\t\t.format( 'ddd, DD MMM YYYY HH:mm:ss ZZ' );\n\t},\n\tU: 'X',\n};\n\n/**\n * Formats a date. Does not alter the date's timezone.\n *\n * @param {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date.\n */\nexport function format( dateFormat, dateValue = new Date() ) {\n\tlet i, char;\n\tconst newFormat = [];\n\tconst momentDate = momentLib( dateValue );\n\tfor ( i = 0; i < dateFormat.length; i++ ) {\n\t\tchar = dateFormat[ i ];\n\t\t// Is this an escape?\n\t\tif ( '\\\\' === char ) {\n\t\t\t// Add next character, then move on.\n\t\t\ti++;\n\t\t\tnewFormat.push( '[' + dateFormat[ i ] + ']' );\n\t\t\tcontinue;\n\t\t}\n\t\tif ( char in formatMap ) {\n\t\t\tconst formatter =\n\t\t\t\tformatMap[ /** @type {keyof formatMap} */ ( char ) ];\n\t\t\tif ( typeof formatter !== 'string' ) {\n\t\t\t\t// If the format is a function, call it.\n\t\t\t\tnewFormat.push( '[' + formatter( momentDate ) + ']' );\n\t\t\t} else {\n\t\t\t\t// Otherwise, add as a formatting string.\n\t\t\t\tnewFormat.push( formatter );\n\t\t\t}\n\t\t} else {\n\t\t\tnewFormat.push( '[' + char + ']' );\n\t\t}\n\t}\n\t// Join with [] between to separate characters, and replace\n\t// unneeded separators with static text.\n\treturn momentDate.format( newFormat.join( '[]' ) );\n}\n\n/**\n * Formats a date (like `date()` in PHP).\n *\n * @param {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable\n * by moment.js.\n * @param {string | number | undefined} timezone Timezone to output result in or a\n * UTC offset. Defaults to timezone from\n * site.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return {string} Formatted date in English.\n */\nexport function date( dateFormat, dateValue = new Date(), timezone ) {\n\tconst dateMoment = buildMoment( dateValue, timezone );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `date()` in PHP), in the UTC timezone.\n *\n * @param {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date in English.\n */\nexport function gmdate( dateFormat, dateValue = new Date() ) {\n\tconst dateMoment = momentLib( dateValue ).utc();\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `wp_date()` in PHP), translating it into site's locale.\n *\n * Backward Compatibility Notice: if `timezone` is set to `true`, the function\n * behaves like `gmdateI18n`.\n *\n * @param {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable by\n * moment.js.\n * @param {string | number | boolean | undefined} timezone Timezone to output result in or a\n * UTC offset. Defaults to timezone from\n * site. Notice: `boolean` is effectively\n * deprecated, but still supported for\n * backward compatibility reasons.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return {string} Formatted date.\n */\nexport function dateI18n( dateFormat, dateValue = new Date(), timezone ) {\n\tif ( true === timezone ) {\n\t\treturn gmdateI18n( dateFormat, dateValue );\n\t}\n\n\tif ( false === timezone ) {\n\t\ttimezone = undefined;\n\t}\n\n\tconst dateMoment = buildMoment( dateValue, timezone );\n\tdateMoment.locale( settings.l10n.locale );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `wp_date()` in PHP), translating it into site's locale\n * and using the UTC timezone.\n *\n * @param {string} dateFormat PHP-style formatting string.\n * See php.net/date.\n * @param {Moment | Date | string | undefined} dateValue Date object or string,\n * parsable by moment.js.\n *\n * @return {string} Formatted date.\n */\nexport function gmdateI18n( dateFormat, dateValue = new Date() ) {\n\tconst dateMoment = momentLib( dateValue ).utc();\n\tdateMoment.locale( settings.l10n.locale );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Check whether a date is considered in the future according to the WordPress settings.\n *\n * @param {string} dateValue Date String or Date object in the Defined WP Timezone.\n *\n * @return {boolean} Is in the future.\n */\nexport function isInTheFuture( dateValue ) {\n\tconst now = momentLib.tz( WP_ZONE );\n\tconst momentObject = momentLib.tz( dateValue, WP_ZONE );\n\n\treturn momentObject.isAfter( now );\n}\n\n/**\n * Create and return a JavaScript Date Object from a date string in the WP timezone.\n *\n * @param {string?} dateString Date formatted in the WP timezone.\n *\n * @return {Date} Date\n */\nexport function getDate( dateString ) {\n\tif ( ! dateString ) {\n\t\treturn momentLib.tz( WP_ZONE ).toDate();\n\t}\n\n\treturn momentLib.tz( dateString, WP_ZONE ).toDate();\n}\n\n/**\n * Creates a moment instance using the given timezone or, if none is provided, using global settings.\n *\n * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable\n * by moment.js.\n * @param {string | number | undefined} timezone Timezone to output result in or a\n * UTC offset. Defaults to timezone from\n * site.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return {Moment} a moment instance.\n */\nfunction buildMoment( dateValue, timezone = '' ) {\n\tconst dateMoment = momentLib( dateValue );\n\n\tif ( timezone && ! isUTCOffset( timezone ) ) {\n\t\t// The ! isUTCOffset() check guarantees that timezone is a string.\n\t\treturn dateMoment.tz( /** @type {string} */ ( timezone ) );\n\t}\n\n\tif ( timezone && isUTCOffset( timezone ) ) {\n\t\treturn dateMoment.utcOffset( timezone );\n\t}\n\n\tif ( settings.timezone.string ) {\n\t\treturn dateMoment.tz( settings.timezone.string );\n\t}\n\n\treturn dateMoment.utcOffset( +settings.timezone.offset );\n}\n\n/**\n * Returns whether a certain UTC offset is valid or not.\n *\n * @param {number|string} offset a UTC offset.\n *\n * @return {boolean} whether a certain UTC offset is valid or not.\n */\nfunction isUTCOffset( offset ) {\n\tif ( 'number' === typeof offset ) {\n\t\treturn true;\n\t}\n\n\treturn VALID_UTC_OFFSET.test( offset );\n}\n\nsetupWPTimezone();\n"]}
@@ -28,7 +28,7 @@ export function format(dateFormat: string, dateValue?: Moment | Date | string |
28
28
  * See php.net/date.
29
29
  * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable
30
30
  * by moment.js.
31
- * @param {string | undefined} timezone Timezone to output result in or a
31
+ * @param {string | number | undefined} timezone Timezone to output result in or a
32
32
  * UTC offset. Defaults to timezone from
33
33
  * site.
34
34
  *
@@ -37,7 +37,7 @@ export function format(dateFormat: string, dateValue?: Moment | Date | string |
37
37
  *
38
38
  * @return {string} Formatted date in English.
39
39
  */
40
- export function date(dateFormat: string, dateValue: Moment | Date | string | undefined, timezone: string | undefined): string;
40
+ export function date(dateFormat: string, dateValue: Moment | Date | string | undefined, timezone: string | number | undefined): string;
41
41
  /**
42
42
  * Formats a date (like `date()` in PHP), in the UTC timezone.
43
43
  *
@@ -55,22 +55,22 @@ export function gmdate(dateFormat: string, dateValue?: Moment | Date | string |
55
55
  * Backward Compatibility Notice: if `timezone` is set to `true`, the function
56
56
  * behaves like `gmdateI18n`.
57
57
  *
58
- * @param {string} dateFormat PHP-style formatting string.
59
- * See php.net/date.
60
- * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable by
61
- * moment.js.
62
- * @param {string | boolean | undefined} timezone Timezone to output result in or a
63
- * UTC offset. Defaults to timezone from
64
- * site. Notice: `boolean` is effectively
65
- * deprecated, but still supported for
66
- * backward compatibility reasons.
58
+ * @param {string} dateFormat PHP-style formatting string.
59
+ * See php.net/date.
60
+ * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable by
61
+ * moment.js.
62
+ * @param {string | number | boolean | undefined} timezone Timezone to output result in or a
63
+ * UTC offset. Defaults to timezone from
64
+ * site. Notice: `boolean` is effectively
65
+ * deprecated, but still supported for
66
+ * backward compatibility reasons.
67
67
  *
68
68
  * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
69
69
  * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC
70
70
  *
71
71
  * @return {string} Formatted date.
72
72
  */
73
- export function dateI18n(dateFormat: string, dateValue: Moment | Date | string | undefined, timezone: string | boolean | undefined): string;
73
+ export function dateI18n(dateFormat: string, dateValue: Moment | Date | string | undefined, timezone: string | number | boolean | undefined): string;
74
74
  /**
75
75
  * Formats a date (like `wp_date()` in PHP), translating it into site's locale
76
76
  * and using the UTC timezone.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAoIA;;;;GAIG;AACH,0CAFW,YAAY,QA8DtB;AAED;;;;GAIG;AACH,6CAFY,YAAY,CAIvB;AAuMD;;;;;;;;;GASG;AACH,mCAPW,MAAM,cAEN,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,GAGjC,MAAM,CAgCjB;AAED;;;;;;;;;;;;;;;GAeG;AACH,iCAbW,MAAM,aAEN,MAAM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AC1C,cAAc;;;;cACd,yBAAyB,CAAC,cAAc,CAAC;;;;iBACzC,CAAC,GAAC,CAAC,GAAC,CAAC,GAAC,CAAC,GAAC,CAAC,GAAC,CAAC,GAAC,CAAC;;;;;;UAMb,YAAY;;;;aACZ,aAAa;;;;cACb,cAAc"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/date",
3
- "version": "4.15.0",
3
+ "version": "4.16.1-next.957ca95e4c.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": "08358f53b627a15148c3a3e433cdf58cf8714aa4"
36
+ "gitHead": "272a74bbbaab10ee24424eafe9578e705fbfbbb4"
37
37
  }
package/src/index.js CHANGED
@@ -452,7 +452,7 @@ export function format( dateFormat, dateValue = new Date() ) {
452
452
  * See php.net/date.
453
453
  * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable
454
454
  * by moment.js.
455
- * @param {string | undefined} timezone Timezone to output result in or a
455
+ * @param {string | number | undefined} timezone Timezone to output result in or a
456
456
  * UTC offset. Defaults to timezone from
457
457
  * site.
458
458
  *
@@ -487,15 +487,15 @@ export function gmdate( dateFormat, dateValue = new Date() ) {
487
487
  * Backward Compatibility Notice: if `timezone` is set to `true`, the function
488
488
  * behaves like `gmdateI18n`.
489
489
  *
490
- * @param {string} dateFormat PHP-style formatting string.
491
- * See php.net/date.
492
- * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable by
493
- * moment.js.
494
- * @param {string | boolean | undefined} timezone Timezone to output result in or a
495
- * UTC offset. Defaults to timezone from
496
- * site. Notice: `boolean` is effectively
497
- * deprecated, but still supported for
498
- * backward compatibility reasons.
490
+ * @param {string} dateFormat PHP-style formatting string.
491
+ * See php.net/date.
492
+ * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable by
493
+ * moment.js.
494
+ * @param {string | number | boolean | undefined} timezone Timezone to output result in or a
495
+ * UTC offset. Defaults to timezone from
496
+ * site. Notice: `boolean` is effectively
497
+ * deprecated, but still supported for
498
+ * backward compatibility reasons.
499
499
  *
500
500
  * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
501
501
  * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC
@@ -567,7 +567,7 @@ export function getDate( dateString ) {
567
567
  *
568
568
  * @param {Moment | Date | string | undefined} dateValue Date object or string, parsable
569
569
  * by moment.js.
570
- * @param {string | undefined} timezone Timezone to output result in or a
570
+ * @param {string | number | undefined} timezone Timezone to output result in or a
571
571
  * UTC offset. Defaults to timezone from
572
572
  * site.
573
573
  *
@@ -580,7 +580,8 @@ function buildMoment( dateValue, timezone = '' ) {
580
580
  const dateMoment = momentLib( dateValue );
581
581
 
582
582
  if ( timezone && ! isUTCOffset( timezone ) ) {
583
- return dateMoment.tz( timezone );
583
+ // The ! isUTCOffset() check guarantees that timezone is a string.
584
+ return dateMoment.tz( /** @type {string} */ ( timezone ) );
584
585
  }
585
586
 
586
587
  if ( timezone && isUTCOffset( timezone ) ) {
@@ -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","b25440f90d4947c8beeded8927359e5998c737c6122a05db266c02e72e790d9e"],"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","02935167af9113e82d9f136ee9aa49be075b125c1cee2f6796cdadc5fbaf5c64"],"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"}