@hero-design/rn 8.94.0 → 8.96.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.
Files changed (61) hide show
  1. package/.turbo/turbo-build.log +7 -2
  2. package/CHANGELOG.md +12 -0
  3. package/es/index.js +1319 -966
  4. package/lib/index.js +1319 -965
  5. package/locales/en_AU.js +10 -0
  6. package/locales/en_AU.mjs +8 -0
  7. package/locales/en_CA.js +10 -0
  8. package/locales/en_CA.mjs +8 -0
  9. package/locales/index.js +11 -0
  10. package/locales/index.mjs +9 -0
  11. package/locales/types.js +2 -0
  12. package/locales/types.mjs +1 -0
  13. package/package.json +4 -3
  14. package/rollup.config.mjs +97 -58
  15. package/src/components/DatePicker/DatePickerAndroid.tsx +27 -7
  16. package/src/components/DatePicker/DatePickerCalendar.tsx +23 -4
  17. package/src/components/DatePicker/DatePickerIOS.tsx +27 -8
  18. package/src/components/DatePicker/__tests__/DatePicker.spec.tsx +30 -1
  19. package/src/components/DatePicker/__tests__/DatePickerAndroid.spec.tsx +27 -0
  20. package/src/components/DatePicker/__tests__/DatePickerCalendar.spec.tsx +27 -0
  21. package/src/components/DatePicker/__tests__/DatePickerIOS.spec.tsx +28 -1
  22. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +1 -0
  23. package/src/components/DatePicker/hooks/__tests__/useFormatDate.spec.ts +61 -0
  24. package/src/components/DatePicker/{useCalculateDate.tsx → hooks/useCalculateDate.tsx} +1 -1
  25. package/src/components/DatePicker/hooks/useFormatDate.ts +25 -0
  26. package/src/components/DatePicker/hooks/utils.ts +30 -0
  27. package/src/components/DatePicker/types.ts +15 -1
  28. package/src/components/HeroDesignProvider/index.tsx +19 -6
  29. package/src/components/LocaleProvider/__tests__/utils.specs.ts +12 -0
  30. package/src/components/LocaleProvider/context.ts +7 -0
  31. package/src/components/LocaleProvider/hooks.ts +19 -0
  32. package/src/components/LocaleProvider/index.tsx +27 -0
  33. package/src/components/LocaleProvider/utils.ts +14 -0
  34. package/src/index.ts +2 -0
  35. package/src/locales/en_AU.ts +10 -0
  36. package/src/locales/en_CA.ts +10 -0
  37. package/src/locales/index.ts +7 -0
  38. package/src/locales/types.ts +12 -0
  39. package/src/testHelpers/renderWithTheme.tsx +7 -1
  40. package/src/types.ts +4 -0
  41. package/stats/8.95.0/rn-stats.html +4842 -0
  42. package/stats/8.96.0/rn-stats.html +4842 -0
  43. package/types/components/DatePicker/DatePickerAndroid.d.ts +1 -1
  44. package/types/components/DatePicker/DatePickerCalendar.d.ts +1 -1
  45. package/types/components/DatePicker/DatePickerIOS.d.ts +1 -1
  46. package/types/components/DatePicker/{useCalculateDate.d.ts → hooks/useCalculateDate.d.ts} +1 -1
  47. package/types/components/DatePicker/hooks/useFormatDate.d.ts +10 -0
  48. package/types/components/DatePicker/hooks/utils.d.ts +6 -0
  49. package/types/components/DatePicker/types.d.ts +8 -1
  50. package/types/components/HeroDesignProvider/index.d.ts +5 -1
  51. package/types/components/LocaleProvider/__tests__/utils.specs.d.ts +1 -0
  52. package/types/components/LocaleProvider/context.d.ts +3 -0
  53. package/types/components/LocaleProvider/hooks.d.ts +5 -0
  54. package/types/components/LocaleProvider/index.d.ts +7 -0
  55. package/types/components/LocaleProvider/utils.d.ts +3 -0
  56. package/types/index.d.ts +2 -1
  57. package/types/locales/en_AU.d.ts +3 -0
  58. package/types/locales/en_CA.d.ts +3 -0
  59. package/types/locales/index.d.ts +5 -0
  60. package/types/locales/types.d.ts +10 -0
  61. package/types/types.d.ts +2 -1
package/lib/index.js CHANGED
@@ -586,14 +586,14 @@ function _toPropertyKey(t) {
586
586
  var i = _toPrimitive(t, "string");
587
587
  return "symbol" == typeof i ? i : i + "";
588
588
  }
589
- function _typeof(o) {
589
+ function _typeof$1(o) {
590
590
  "@babel/helpers - typeof";
591
591
 
592
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
592
+ return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
593
593
  return typeof o;
594
594
  } : function (o) {
595
595
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
596
- }, _typeof(o);
596
+ }, _typeof$1(o);
597
597
  }
598
598
  function _unsupportedIterableToArray(r, a) {
599
599
  if (r) {
@@ -6118,7 +6118,7 @@ function requireCamelize() {
6118
6118
  return walk(obj);
6119
6119
  };
6120
6120
  function walk(obj) {
6121
- if (!obj || _typeof(obj) !== 'object') return obj;
6121
+ if (!obj || _typeof$1(obj) !== 'object') return obj;
6122
6122
  if (isDate(obj) || isRegex(obj)) return obj;
6123
6123
  if (isArray(obj)) return map(obj, walk);
6124
6124
  return reduce(objectKeys(obj), function (acc, key) {
@@ -6481,7 +6481,7 @@ function requireCssToReactNative() {
6481
6481
  value: true
6482
6482
  });
6483
6483
  function _interopDefault(ex) {
6484
- return ex && _typeof(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
6484
+ return ex && _typeof$1(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
6485
6485
  }
6486
6486
  var parse = requireLib$1();
6487
6487
  var parse__default = _interopDefault(parse);
@@ -7205,7 +7205,7 @@ var generated = {};
7205
7205
  var buffer = '';
7206
7206
  var lastType;
7207
7207
  function handleInterpolation(interpolation, i, arr) {
7208
- var type = _typeof(interpolation);
7208
+ var type = _typeof$1(interpolation);
7209
7209
  if (type === 'string') {
7210
7210
  // strip comments
7211
7211
  interpolation = interpolation.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '');
@@ -10805,12 +10805,59 @@ var BottomSheet$1 = Object.assign(BottomSheet, {
10805
10805
  ScrollView: BottomSheetScrollView
10806
10806
  });
10807
10807
 
10808
+ function _typeof(o) {
10809
+ "@babel/helpers - typeof";
10810
+
10811
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
10812
+ return typeof o;
10813
+ } : function (o) {
10814
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
10815
+ }, _typeof(o);
10816
+ }
10817
+
10808
10818
  function requiredArgs(required, args) {
10809
10819
  if (args.length < required) {
10810
10820
  throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
10811
10821
  }
10812
10822
  }
10813
10823
 
10824
+ /**
10825
+ * @name isDate
10826
+ * @category Common Helpers
10827
+ * @summary Is the given value a date?
10828
+ *
10829
+ * @description
10830
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
10831
+ *
10832
+ * @param {*} value - the value to check
10833
+ * @returns {boolean} true if the given value is a date
10834
+ * @throws {TypeError} 1 arguments required
10835
+ *
10836
+ * @example
10837
+ * // For a valid date:
10838
+ * const result = isDate(new Date())
10839
+ * //=> true
10840
+ *
10841
+ * @example
10842
+ * // For an invalid date:
10843
+ * const result = isDate(new Date(NaN))
10844
+ * //=> true
10845
+ *
10846
+ * @example
10847
+ * // For some value:
10848
+ * const result = isDate('2014-02-31')
10849
+ * //=> false
10850
+ *
10851
+ * @example
10852
+ * // For an object:
10853
+ * const result = isDate({})
10854
+ * //=> false
10855
+ */
10856
+ function isDate(value) {
10857
+ requiredArgs(1, arguments);
10858
+ return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
10859
+ }
10860
+
10814
10861
  /**
10815
10862
  * @name toDate
10816
10863
  * @category Common Helpers
@@ -10841,11 +10888,11 @@ function requiredArgs(required, args) {
10841
10888
  * const result = toDate(1392098430000)
10842
10889
  * //=> Tue Feb 11 2014 11:30:30
10843
10890
  */
10844
-
10845
10891
  function toDate(argument) {
10846
10892
  requiredArgs(1, arguments);
10847
- var argStr = Object.prototype.toString.call(argument); // Clone the date
10893
+ var argStr = Object.prototype.toString.call(argument);
10848
10894
 
10895
+ // Clone the date
10849
10896
  if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
10850
10897
  // Prevent the date to lose the milliseconds when passed to new Date() in IE10
10851
10898
  return new Date(argument.getTime());
@@ -10854,8 +10901,8 @@ function toDate(argument) {
10854
10901
  } else {
10855
10902
  if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
10856
10903
  // eslint-disable-next-line no-console
10857
- console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"); // eslint-disable-next-line no-console
10858
-
10904
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
10905
+ // eslint-disable-next-line no-console
10859
10906
  console.warn(new Error().stack);
10860
10907
  }
10861
10908
  return new Date(NaN);
@@ -10874,544 +10921,34 @@ function toDate(argument) {
10874
10921
  *
10875
10922
  * Time value of Date: http://es5.github.io/#x15.9.1.1
10876
10923
  *
10877
- * ### v2.0.0 breaking changes:
10878
- *
10879
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
10880
- *
10881
- * - Now `isValid` doesn't throw an exception
10882
- * if the first argument is not an instance of Date.
10883
- * Instead, argument is converted beforehand using `toDate`.
10884
- *
10885
- * Examples:
10886
- *
10887
- * | `isValid` argument | Before v2.0.0 | v2.0.0 onward |
10888
- * |---------------------------|---------------|---------------|
10889
- * | `new Date()` | `true` | `true` |
10890
- * | `new Date('2016-01-01')` | `true` | `true` |
10891
- * | `new Date('')` | `false` | `false` |
10892
- * | `new Date(1488370835081)` | `true` | `true` |
10893
- * | `new Date(NaN)` | `false` | `false` |
10894
- * | `'2016-01-01'` | `TypeError` | `false` |
10895
- * | `''` | `TypeError` | `false` |
10896
- * | `1488370835081` | `TypeError` | `true` |
10897
- * | `NaN` | `TypeError` | `false` |
10898
- *
10899
- * We introduce this change to make *date-fns* consistent with ECMAScript behavior
10900
- * that try to coerce arguments to the expected type
10901
- * (which is also the case with other *date-fns* functions).
10902
- *
10903
10924
  * @param {*} date - the date to check
10904
10925
  * @returns {Boolean} the date is valid
10905
10926
  * @throws {TypeError} 1 argument required
10906
10927
  *
10907
10928
  * @example
10908
10929
  * // For the valid date:
10909
- * var result = isValid(new Date(2014, 1, 31))
10930
+ * const result = isValid(new Date(2014, 1, 31))
10910
10931
  * //=> true
10911
10932
  *
10912
10933
  * @example
10913
10934
  * // For the value, convertable into a date:
10914
- * var result = isValid(1393804800000)
10935
+ * const result = isValid(1393804800000)
10915
10936
  * //=> true
10916
10937
  *
10917
10938
  * @example
10918
10939
  * // For the invalid date:
10919
- * var result = isValid(new Date(''))
10940
+ * const result = isValid(new Date(''))
10920
10941
  * //=> false
10921
10942
  */
10922
-
10923
10943
  function isValid(dirtyDate) {
10924
10944
  requiredArgs(1, arguments);
10925
- var date = toDate(dirtyDate);
10926
- return !isNaN(date);
10927
- }
10928
-
10929
- var formatDistanceLocale = {
10930
- lessThanXSeconds: {
10931
- one: 'less than a second',
10932
- other: 'less than {{count}} seconds'
10933
- },
10934
- xSeconds: {
10935
- one: '1 second',
10936
- other: '{{count}} seconds'
10937
- },
10938
- halfAMinute: 'half a minute',
10939
- lessThanXMinutes: {
10940
- one: 'less than a minute',
10941
- other: 'less than {{count}} minutes'
10942
- },
10943
- xMinutes: {
10944
- one: '1 minute',
10945
- other: '{{count}} minutes'
10946
- },
10947
- aboutXHours: {
10948
- one: 'about 1 hour',
10949
- other: 'about {{count}} hours'
10950
- },
10951
- xHours: {
10952
- one: '1 hour',
10953
- other: '{{count}} hours'
10954
- },
10955
- xDays: {
10956
- one: '1 day',
10957
- other: '{{count}} days'
10958
- },
10959
- aboutXWeeks: {
10960
- one: 'about 1 week',
10961
- other: 'about {{count}} weeks'
10962
- },
10963
- xWeeks: {
10964
- one: '1 week',
10965
- other: '{{count}} weeks'
10966
- },
10967
- aboutXMonths: {
10968
- one: 'about 1 month',
10969
- other: 'about {{count}} months'
10970
- },
10971
- xMonths: {
10972
- one: '1 month',
10973
- other: '{{count}} months'
10974
- },
10975
- aboutXYears: {
10976
- one: 'about 1 year',
10977
- other: 'about {{count}} years'
10978
- },
10979
- xYears: {
10980
- one: '1 year',
10981
- other: '{{count}} years'
10982
- },
10983
- overXYears: {
10984
- one: 'over 1 year',
10985
- other: 'over {{count}} years'
10986
- },
10987
- almostXYears: {
10988
- one: 'almost 1 year',
10989
- other: 'almost {{count}} years'
10990
- }
10991
- };
10992
- function formatDistance(token, count, options) {
10993
- options = options || {};
10994
- var result;
10995
- if (typeof formatDistanceLocale[token] === 'string') {
10996
- result = formatDistanceLocale[token];
10997
- } else if (count === 1) {
10998
- result = formatDistanceLocale[token].one;
10999
- } else {
11000
- result = formatDistanceLocale[token].other.replace('{{count}}', count);
11001
- }
11002
- if (options.addSuffix) {
11003
- if (options.comparison > 0) {
11004
- return 'in ' + result;
11005
- } else {
11006
- return result + ' ago';
11007
- }
11008
- }
11009
- return result;
11010
- }
11011
-
11012
- function buildFormatLongFn(args) {
11013
- return function (dirtyOptions) {
11014
- var options = dirtyOptions || {};
11015
- var width = options.width ? String(options.width) : args.defaultWidth;
11016
- var format = args.formats[width] || args.formats[args.defaultWidth];
11017
- return format;
11018
- };
11019
- }
11020
-
11021
- var dateFormats = {
11022
- full: 'EEEE, MMMM do, y',
11023
- "long": 'MMMM do, y',
11024
- medium: 'MMM d, y',
11025
- "short": 'MM/dd/yyyy'
11026
- };
11027
- var timeFormats = {
11028
- full: 'h:mm:ss a zzzz',
11029
- "long": 'h:mm:ss a z',
11030
- medium: 'h:mm:ss a',
11031
- "short": 'h:mm a'
11032
- };
11033
- var dateTimeFormats = {
11034
- full: "{{date}} 'at' {{time}}",
11035
- "long": "{{date}} 'at' {{time}}",
11036
- medium: '{{date}}, {{time}}',
11037
- "short": '{{date}}, {{time}}'
11038
- };
11039
- var formatLong = {
11040
- date: buildFormatLongFn({
11041
- formats: dateFormats,
11042
- defaultWidth: 'full'
11043
- }),
11044
- time: buildFormatLongFn({
11045
- formats: timeFormats,
11046
- defaultWidth: 'full'
11047
- }),
11048
- dateTime: buildFormatLongFn({
11049
- formats: dateTimeFormats,
11050
- defaultWidth: 'full'
11051
- })
11052
- };
11053
-
11054
- var formatRelativeLocale = {
11055
- lastWeek: "'last' eeee 'at' p",
11056
- yesterday: "'yesterday at' p",
11057
- today: "'today at' p",
11058
- tomorrow: "'tomorrow at' p",
11059
- nextWeek: "eeee 'at' p",
11060
- other: 'P'
11061
- };
11062
- function formatRelative(token, _date, _baseDate, _options) {
11063
- return formatRelativeLocale[token];
11064
- }
11065
-
11066
- function buildLocalizeFn(args) {
11067
- return function (dirtyIndex, dirtyOptions) {
11068
- var options = dirtyOptions || {};
11069
- var context = options.context ? String(options.context) : 'standalone';
11070
- var valuesArray;
11071
- if (context === 'formatting' && args.formattingValues) {
11072
- var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
11073
- var width = options.width ? String(options.width) : defaultWidth;
11074
- valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
11075
- } else {
11076
- var _defaultWidth = args.defaultWidth;
11077
- var _width = options.width ? String(options.width) : args.defaultWidth;
11078
- valuesArray = args.values[_width] || args.values[_defaultWidth];
11079
- }
11080
- var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
11081
- return valuesArray[index];
11082
- };
11083
- }
11084
-
11085
- var eraValues = {
11086
- narrow: ['B', 'A'],
11087
- abbreviated: ['BC', 'AD'],
11088
- wide: ['Before Christ', 'Anno Domini']
11089
- };
11090
- var quarterValues = {
11091
- narrow: ['1', '2', '3', '4'],
11092
- abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
11093
- wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter'] // Note: in English, the names of days of the week and months are capitalized.
11094
- // If you are making a new locale based on this one, check if the same is true for the language you're working on.
11095
- // Generally, formatted dates should look like they are in the middle of a sentence,
11096
- // e.g. in Spanish language the weekdays and months should be in the lowercase.
11097
- };
11098
-
11099
- var monthValues = {
11100
- narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
11101
- abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
11102
- wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
11103
- };
11104
- var dayValues = {
11105
- narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
11106
- "short": ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
11107
- abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
11108
- wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
11109
- };
11110
- var dayPeriodValues = {
11111
- narrow: {
11112
- am: 'a',
11113
- pm: 'p',
11114
- midnight: 'mi',
11115
- noon: 'n',
11116
- morning: 'morning',
11117
- afternoon: 'afternoon',
11118
- evening: 'evening',
11119
- night: 'night'
11120
- },
11121
- abbreviated: {
11122
- am: 'AM',
11123
- pm: 'PM',
11124
- midnight: 'midnight',
11125
- noon: 'noon',
11126
- morning: 'morning',
11127
- afternoon: 'afternoon',
11128
- evening: 'evening',
11129
- night: 'night'
11130
- },
11131
- wide: {
11132
- am: 'a.m.',
11133
- pm: 'p.m.',
11134
- midnight: 'midnight',
11135
- noon: 'noon',
11136
- morning: 'morning',
11137
- afternoon: 'afternoon',
11138
- evening: 'evening',
11139
- night: 'night'
11140
- }
11141
- };
11142
- var formattingDayPeriodValues = {
11143
- narrow: {
11144
- am: 'a',
11145
- pm: 'p',
11146
- midnight: 'mi',
11147
- noon: 'n',
11148
- morning: 'in the morning',
11149
- afternoon: 'in the afternoon',
11150
- evening: 'in the evening',
11151
- night: 'at night'
11152
- },
11153
- abbreviated: {
11154
- am: 'AM',
11155
- pm: 'PM',
11156
- midnight: 'midnight',
11157
- noon: 'noon',
11158
- morning: 'in the morning',
11159
- afternoon: 'in the afternoon',
11160
- evening: 'in the evening',
11161
- night: 'at night'
11162
- },
11163
- wide: {
11164
- am: 'a.m.',
11165
- pm: 'p.m.',
11166
- midnight: 'midnight',
11167
- noon: 'noon',
11168
- morning: 'in the morning',
11169
- afternoon: 'in the afternoon',
11170
- evening: 'in the evening',
11171
- night: 'at night'
11172
- }
11173
- };
11174
- function ordinalNumber(dirtyNumber, _dirtyOptions) {
11175
- var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
11176
- // if they are different for different grammatical genders,
11177
- // use `options.unit`:
11178
- //
11179
- // var options = dirtyOptions || {}
11180
- // var unit = String(options.unit)
11181
- //
11182
- // where `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
11183
- // 'day', 'hour', 'minute', 'second'
11184
-
11185
- var rem100 = number % 100;
11186
- if (rem100 > 20 || rem100 < 10) {
11187
- switch (rem100 % 10) {
11188
- case 1:
11189
- return number + 'st';
11190
- case 2:
11191
- return number + 'nd';
11192
- case 3:
11193
- return number + 'rd';
11194
- }
11195
- }
11196
- return number + 'th';
11197
- }
11198
- var localize = {
11199
- ordinalNumber: ordinalNumber,
11200
- era: buildLocalizeFn({
11201
- values: eraValues,
11202
- defaultWidth: 'wide'
11203
- }),
11204
- quarter: buildLocalizeFn({
11205
- values: quarterValues,
11206
- defaultWidth: 'wide',
11207
- argumentCallback: function argumentCallback(quarter) {
11208
- return Number(quarter) - 1;
11209
- }
11210
- }),
11211
- month: buildLocalizeFn({
11212
- values: monthValues,
11213
- defaultWidth: 'wide'
11214
- }),
11215
- day: buildLocalizeFn({
11216
- values: dayValues,
11217
- defaultWidth: 'wide'
11218
- }),
11219
- dayPeriod: buildLocalizeFn({
11220
- values: dayPeriodValues,
11221
- defaultWidth: 'wide',
11222
- formattingValues: formattingDayPeriodValues,
11223
- defaultFormattingWidth: 'wide'
11224
- })
11225
- };
11226
-
11227
- function buildMatchPatternFn(args) {
11228
- return function (dirtyString, dirtyOptions) {
11229
- var string = String(dirtyString);
11230
- var options = dirtyOptions || {};
11231
- var matchResult = string.match(args.matchPattern);
11232
- if (!matchResult) {
11233
- return null;
11234
- }
11235
- var matchedString = matchResult[0];
11236
- var parseResult = string.match(args.parsePattern);
11237
- if (!parseResult) {
11238
- return null;
11239
- }
11240
- var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
11241
- value = options.valueCallback ? options.valueCallback(value) : value;
11242
- return {
11243
- value: value,
11244
- rest: string.slice(matchedString.length)
11245
- };
11246
- };
11247
- }
11248
-
11249
- function buildMatchFn(args) {
11250
- return function (dirtyString, dirtyOptions) {
11251
- var string = String(dirtyString);
11252
- var options = dirtyOptions || {};
11253
- var width = options.width;
11254
- var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
11255
- var matchResult = string.match(matchPattern);
11256
- if (!matchResult) {
11257
- return null;
11258
- }
11259
- var matchedString = matchResult[0];
11260
- var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
11261
- var value;
11262
- if (Object.prototype.toString.call(parsePatterns) === '[object Array]') {
11263
- value = findIndex(parsePatterns, function (pattern) {
11264
- return pattern.test(matchedString);
11265
- });
11266
- } else {
11267
- value = findKey(parsePatterns, function (pattern) {
11268
- return pattern.test(matchedString);
11269
- });
11270
- }
11271
- value = args.valueCallback ? args.valueCallback(value) : value;
11272
- value = options.valueCallback ? options.valueCallback(value) : value;
11273
- return {
11274
- value: value,
11275
- rest: string.slice(matchedString.length)
11276
- };
11277
- };
11278
- }
11279
- function findKey(object, predicate) {
11280
- for (var key in object) {
11281
- if (object.hasOwnProperty(key) && predicate(object[key])) {
11282
- return key;
11283
- }
11284
- }
11285
- }
11286
- function findIndex(array, predicate) {
11287
- for (var key = 0; key < array.length; key++) {
11288
- if (predicate(array[key])) {
11289
- return key;
11290
- }
10945
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
10946
+ return false;
11291
10947
  }
10948
+ var date = toDate(dirtyDate);
10949
+ return !isNaN(Number(date));
11292
10950
  }
11293
10951
 
11294
- var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
11295
- var parseOrdinalNumberPattern = /\d+/i;
11296
- var matchEraPatterns = {
11297
- narrow: /^(b|a)/i,
11298
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
11299
- wide: /^(before christ|before common era|anno domini|common era)/i
11300
- };
11301
- var parseEraPatterns = {
11302
- any: [/^b/i, /^(a|c)/i]
11303
- };
11304
- var matchQuarterPatterns = {
11305
- narrow: /^[1234]/i,
11306
- abbreviated: /^q[1234]/i,
11307
- wide: /^[1234](th|st|nd|rd)? quarter/i
11308
- };
11309
- var parseQuarterPatterns = {
11310
- any: [/1/i, /2/i, /3/i, /4/i]
11311
- };
11312
- var matchMonthPatterns = {
11313
- narrow: /^[jfmasond]/i,
11314
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
11315
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
11316
- };
11317
- var parseMonthPatterns = {
11318
- narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
11319
- any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
11320
- };
11321
- var matchDayPatterns = {
11322
- narrow: /^[smtwf]/i,
11323
- "short": /^(su|mo|tu|we|th|fr|sa)/i,
11324
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
11325
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
11326
- };
11327
- var parseDayPatterns = {
11328
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
11329
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
11330
- };
11331
- var matchDayPeriodPatterns = {
11332
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
11333
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
11334
- };
11335
- var parseDayPeriodPatterns = {
11336
- any: {
11337
- am: /^a/i,
11338
- pm: /^p/i,
11339
- midnight: /^mi/i,
11340
- noon: /^no/i,
11341
- morning: /morning/i,
11342
- afternoon: /afternoon/i,
11343
- evening: /evening/i,
11344
- night: /night/i
11345
- }
11346
- };
11347
- var match = {
11348
- ordinalNumber: buildMatchPatternFn({
11349
- matchPattern: matchOrdinalNumberPattern,
11350
- parsePattern: parseOrdinalNumberPattern,
11351
- valueCallback: function valueCallback(value) {
11352
- return parseInt(value, 10);
11353
- }
11354
- }),
11355
- era: buildMatchFn({
11356
- matchPatterns: matchEraPatterns,
11357
- defaultMatchWidth: 'wide',
11358
- parsePatterns: parseEraPatterns,
11359
- defaultParseWidth: 'any'
11360
- }),
11361
- quarter: buildMatchFn({
11362
- matchPatterns: matchQuarterPatterns,
11363
- defaultMatchWidth: 'wide',
11364
- parsePatterns: parseQuarterPatterns,
11365
- defaultParseWidth: 'any',
11366
- valueCallback: function valueCallback(index) {
11367
- return index + 1;
11368
- }
11369
- }),
11370
- month: buildMatchFn({
11371
- matchPatterns: matchMonthPatterns,
11372
- defaultMatchWidth: 'wide',
11373
- parsePatterns: parseMonthPatterns,
11374
- defaultParseWidth: 'any'
11375
- }),
11376
- day: buildMatchFn({
11377
- matchPatterns: matchDayPatterns,
11378
- defaultMatchWidth: 'wide',
11379
- parsePatterns: parseDayPatterns,
11380
- defaultParseWidth: 'any'
11381
- }),
11382
- dayPeriod: buildMatchFn({
11383
- matchPatterns: matchDayPeriodPatterns,
11384
- defaultMatchWidth: 'any',
11385
- parsePatterns: parseDayPeriodPatterns,
11386
- defaultParseWidth: 'any'
11387
- })
11388
- };
11389
-
11390
- /**
11391
- * @type {Locale}
11392
- * @category Locales
11393
- * @summary English locale (United States).
11394
- * @language English
11395
- * @iso-639-2 eng
11396
- * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
11397
- * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
11398
- */
11399
-
11400
- var locale = {
11401
- code: 'en-US',
11402
- formatDistance: formatDistance,
11403
- formatLong: formatLong,
11404
- formatRelative: formatRelative,
11405
- localize: localize,
11406
- match: match,
11407
- options: {
11408
- weekStartsOn: 0
11409
- /* Sunday */,
11410
-
11411
- firstWeekContainsDate: 1
11412
- }
11413
- };
11414
-
11415
10952
  function toInteger(dirtyNumber) {
11416
10953
  if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
11417
10954
  return NaN;
@@ -11431,10 +10968,6 @@ function toInteger(dirtyNumber) {
11431
10968
  * @description
11432
10969
  * Add the specified number of milliseconds to the given date.
11433
10970
  *
11434
- * ### v2.0.0 breaking changes:
11435
- *
11436
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
11437
- *
11438
10971
  * @param {Date|Number} date - the date to be changed
11439
10972
  * @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
11440
10973
  * @returns {Date} the new date with the milliseconds added
@@ -11442,10 +10975,9 @@ function toInteger(dirtyNumber) {
11442
10975
  *
11443
10976
  * @example
11444
10977
  * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
11445
- * var result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
10978
+ * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
11446
10979
  * //=> Thu Jul 10 2014 12:45:30.750
11447
10980
  */
11448
-
11449
10981
  function addMilliseconds(dirtyDate, dirtyAmount) {
11450
10982
  requiredArgs(2, arguments);
11451
10983
  var timestamp = toDate(dirtyDate).getTime();
@@ -11461,10 +10993,6 @@ function addMilliseconds(dirtyDate, dirtyAmount) {
11461
10993
  * @description
11462
10994
  * Subtract the specified number of milliseconds from the given date.
11463
10995
  *
11464
- * ### v2.0.0 breaking changes:
11465
- *
11466
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
11467
- *
11468
10996
  * @param {Date|Number} date - the date to be changed
11469
10997
  * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
11470
10998
  * @returns {Date} the new date with the milliseconds subtracted
@@ -11472,119 +11000,27 @@ function addMilliseconds(dirtyDate, dirtyAmount) {
11472
11000
  *
11473
11001
  * @example
11474
11002
  * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
11475
- * var result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
11003
+ * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
11476
11004
  * //=> Thu Jul 10 2014 12:45:29.250
11477
11005
  */
11478
-
11479
11006
  function subMilliseconds(dirtyDate, dirtyAmount) {
11480
11007
  requiredArgs(2, arguments);
11481
11008
  var amount = toInteger(dirtyAmount);
11482
11009
  return addMilliseconds(dirtyDate, -amount);
11483
11010
  }
11484
11011
 
11485
- function addLeadingZeros(number, targetLength) {
11486
- var sign = number < 0 ? '-' : '';
11487
- var output = Math.abs(number).toString();
11488
- while (output.length < targetLength) {
11489
- output = '0' + output;
11490
- }
11491
- return sign + output;
11012
+ var MILLISECONDS_IN_DAY = 86400000;
11013
+ function getUTCDayOfYear(dirtyDate) {
11014
+ requiredArgs(1, arguments);
11015
+ var date = toDate(dirtyDate);
11016
+ var timestamp = date.getTime();
11017
+ date.setUTCMonth(0, 1);
11018
+ date.setUTCHours(0, 0, 0, 0);
11019
+ var startOfYearTimestamp = date.getTime();
11020
+ var difference = timestamp - startOfYearTimestamp;
11021
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
11492
11022
  }
11493
11023
 
11494
- /*
11495
- * | | Unit | | Unit |
11496
- * |-----|--------------------------------|-----|--------------------------------|
11497
- * | a | AM, PM | A* | |
11498
- * | d | Day of month | D | |
11499
- * | h | Hour [1-12] | H | Hour [0-23] |
11500
- * | m | Minute | M | Month |
11501
- * | s | Second | S | Fraction of second |
11502
- * | y | Year (abs) | Y | |
11503
- *
11504
- * Letters marked by * are not implemented but reserved by Unicode standard.
11505
- */
11506
-
11507
- var formatters$1 = {
11508
- // Year
11509
- y: function y(date, token) {
11510
- // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
11511
- // | Year | y | yy | yyy | yyyy | yyyyy |
11512
- // |----------|-------|----|-------|-------|-------|
11513
- // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
11514
- // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
11515
- // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
11516
- // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
11517
- // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
11518
- var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
11519
-
11520
- var year = signedYear > 0 ? signedYear : 1 - signedYear;
11521
- return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
11522
- },
11523
- // Month
11524
- M: function M(date, token) {
11525
- var month = date.getUTCMonth();
11526
- return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
11527
- },
11528
- // Day of the month
11529
- d: function d(date, token) {
11530
- return addLeadingZeros(date.getUTCDate(), token.length);
11531
- },
11532
- // AM or PM
11533
- a: function a(date, token) {
11534
- var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
11535
- switch (token) {
11536
- case 'a':
11537
- case 'aa':
11538
- case 'aaa':
11539
- return dayPeriodEnumValue.toUpperCase();
11540
- case 'aaaaa':
11541
- return dayPeriodEnumValue[0];
11542
- case 'aaaa':
11543
- default:
11544
- return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
11545
- }
11546
- },
11547
- // Hour [1-12]
11548
- h: function h(date, token) {
11549
- return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
11550
- },
11551
- // Hour [0-23]
11552
- H: function H(date, token) {
11553
- return addLeadingZeros(date.getUTCHours(), token.length);
11554
- },
11555
- // Minute
11556
- m: function m(date, token) {
11557
- return addLeadingZeros(date.getUTCMinutes(), token.length);
11558
- },
11559
- // Second
11560
- s: function s(date, token) {
11561
- return addLeadingZeros(date.getUTCSeconds(), token.length);
11562
- },
11563
- // Fraction of second
11564
- S: function S(date, token) {
11565
- var numberOfDigits = token.length;
11566
- var milliseconds = date.getUTCMilliseconds();
11567
- var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
11568
- return addLeadingZeros(fractionalSeconds, token.length);
11569
- }
11570
- };
11571
-
11572
- var MILLISECONDS_IN_DAY = 86400000; // This function will be a part of public API when UTC function will be implemented.
11573
- // See issue: https://github.com/date-fns/date-fns/issues/376
11574
-
11575
- function getUTCDayOfYear(dirtyDate) {
11576
- requiredArgs(1, arguments);
11577
- var date = toDate(dirtyDate);
11578
- var timestamp = date.getTime();
11579
- date.setUTCMonth(0, 1);
11580
- date.setUTCHours(0, 0, 0, 0);
11581
- var startOfYearTimestamp = date.getTime();
11582
- var difference = timestamp - startOfYearTimestamp;
11583
- return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
11584
- }
11585
-
11586
- // See issue: https://github.com/date-fns/date-fns/issues/376
11587
-
11588
11024
  function startOfUTCISOWeek(dirtyDate) {
11589
11025
  requiredArgs(1, arguments);
11590
11026
  var weekStartsOn = 1;
@@ -11596,8 +11032,6 @@ function startOfUTCISOWeek(dirtyDate) {
11596
11032
  return date;
11597
11033
  }
11598
11034
 
11599
- // See issue: https://github.com/date-fns/date-fns/issues/376
11600
-
11601
11035
  function getUTCISOWeekYear(dirtyDate) {
11602
11036
  requiredArgs(1, arguments);
11603
11037
  var date = toDate(dirtyDate);
@@ -11619,8 +11053,6 @@ function getUTCISOWeekYear(dirtyDate) {
11619
11053
  }
11620
11054
  }
11621
11055
 
11622
- // See issue: https://github.com/date-fns/date-fns/issues/376
11623
-
11624
11056
  function startOfUTCISOWeekYear(dirtyDate) {
11625
11057
  requiredArgs(1, arguments);
11626
11058
  var year = getUTCISOWeekYear(dirtyDate);
@@ -11631,29 +11063,33 @@ function startOfUTCISOWeekYear(dirtyDate) {
11631
11063
  return date;
11632
11064
  }
11633
11065
 
11634
- var MILLISECONDS_IN_WEEK$1 = 604800000; // This function will be a part of public API when UTC function will be implemented.
11635
- // See issue: https://github.com/date-fns/date-fns/issues/376
11636
-
11066
+ var MILLISECONDS_IN_WEEK$1 = 604800000;
11637
11067
  function getUTCISOWeek(dirtyDate) {
11638
11068
  requiredArgs(1, arguments);
11639
11069
  var date = toDate(dirtyDate);
11640
- var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer
11070
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
11071
+
11072
+ // Round the number of days to the nearest integer
11641
11073
  // because the number of milliseconds in a week is not constant
11642
11074
  // (e.g. it's different in the week of the daylight saving time clock shift)
11643
-
11644
11075
  return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
11645
11076
  }
11646
11077
 
11647
- // See issue: https://github.com/date-fns/date-fns/issues/376
11078
+ var defaultOptions = {};
11079
+ function getDefaultOptions() {
11080
+ return defaultOptions;
11081
+ }
11082
+ function setDefaultOptions$1(newOptions) {
11083
+ defaultOptions = newOptions;
11084
+ }
11648
11085
 
11649
- function startOfUTCWeek(dirtyDate, dirtyOptions) {
11086
+ function startOfUTCWeek(dirtyDate, options) {
11087
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
11650
11088
  requiredArgs(1, arguments);
11651
- var options = dirtyOptions || {};
11652
- var locale = options.locale;
11653
- var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;
11654
- var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
11655
- var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
11089
+ var defaultOptions = getDefaultOptions();
11090
+ var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
11656
11091
 
11092
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
11657
11093
  if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
11658
11094
  throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
11659
11095
  }
@@ -11665,29 +11101,26 @@ function startOfUTCWeek(dirtyDate, dirtyOptions) {
11665
11101
  return date;
11666
11102
  }
11667
11103
 
11668
- // See issue: https://github.com/date-fns/date-fns/issues/376
11669
-
11670
- function getUTCWeekYear(dirtyDate, dirtyOptions) {
11104
+ function getUTCWeekYear(dirtyDate, options) {
11105
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
11671
11106
  requiredArgs(1, arguments);
11672
- var date = toDate(dirtyDate, dirtyOptions);
11107
+ var date = toDate(dirtyDate);
11673
11108
  var year = date.getUTCFullYear();
11674
- var options = dirtyOptions || {};
11675
- var locale = options.locale;
11676
- var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
11677
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
11678
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
11109
+ var defaultOptions = getDefaultOptions();
11110
+ var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
11679
11111
 
11112
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
11680
11113
  if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
11681
11114
  throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
11682
11115
  }
11683
11116
  var firstWeekOfNextYear = new Date(0);
11684
11117
  firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
11685
11118
  firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
11686
- var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, dirtyOptions);
11119
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
11687
11120
  var firstWeekOfThisYear = new Date(0);
11688
11121
  firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
11689
11122
  firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
11690
- var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, dirtyOptions);
11123
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
11691
11124
  if (date.getTime() >= startOfNextYear.getTime()) {
11692
11125
  return year + 1;
11693
11126
  } else if (date.getTime() >= startOfThisYear.getTime()) {
@@ -11697,36 +11130,119 @@ function getUTCWeekYear(dirtyDate, dirtyOptions) {
11697
11130
  }
11698
11131
  }
11699
11132
 
11700
- // See issue: https://github.com/date-fns/date-fns/issues/376
11701
-
11702
- function startOfUTCWeekYear(dirtyDate, dirtyOptions) {
11133
+ function startOfUTCWeekYear(dirtyDate, options) {
11134
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
11703
11135
  requiredArgs(1, arguments);
11704
- var options = dirtyOptions || {};
11705
- var locale = options.locale;
11706
- var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
11707
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
11708
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
11709
- var year = getUTCWeekYear(dirtyDate, dirtyOptions);
11136
+ var defaultOptions = getDefaultOptions();
11137
+ var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
11138
+ var year = getUTCWeekYear(dirtyDate, options);
11710
11139
  var firstWeek = new Date(0);
11711
11140
  firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
11712
11141
  firstWeek.setUTCHours(0, 0, 0, 0);
11713
- var date = startOfUTCWeek(firstWeek, dirtyOptions);
11142
+ var date = startOfUTCWeek(firstWeek, options);
11714
11143
  return date;
11715
11144
  }
11716
11145
 
11717
- var MILLISECONDS_IN_WEEK = 604800000; // This function will be a part of public API when UTC function will be implemented.
11718
- // See issue: https://github.com/date-fns/date-fns/issues/376
11719
-
11146
+ var MILLISECONDS_IN_WEEK = 604800000;
11720
11147
  function getUTCWeek(dirtyDate, options) {
11721
11148
  requiredArgs(1, arguments);
11722
11149
  var date = toDate(dirtyDate);
11723
- var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer
11150
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
11151
+
11152
+ // Round the number of days to the nearest integer
11724
11153
  // because the number of milliseconds in a week is not constant
11725
11154
  // (e.g. it's different in the week of the daylight saving time clock shift)
11726
-
11727
11155
  return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
11728
11156
  }
11729
11157
 
11158
+ function addLeadingZeros(number, targetLength) {
11159
+ var sign = number < 0 ? '-' : '';
11160
+ var output = Math.abs(number).toString();
11161
+ while (output.length < targetLength) {
11162
+ output = '0' + output;
11163
+ }
11164
+ return sign + output;
11165
+ }
11166
+
11167
+ /*
11168
+ * | | Unit | | Unit |
11169
+ * |-----|--------------------------------|-----|--------------------------------|
11170
+ * | a | AM, PM | A* | |
11171
+ * | d | Day of month | D | |
11172
+ * | h | Hour [1-12] | H | Hour [0-23] |
11173
+ * | m | Minute | M | Month |
11174
+ * | s | Second | S | Fraction of second |
11175
+ * | y | Year (abs) | Y | |
11176
+ *
11177
+ * Letters marked by * are not implemented but reserved by Unicode standard.
11178
+ */
11179
+ var formatters$1 = {
11180
+ // Year
11181
+ y: function y(date, token) {
11182
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
11183
+ // | Year | y | yy | yyy | yyyy | yyyyy |
11184
+ // |----------|-------|----|-------|-------|-------|
11185
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
11186
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
11187
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
11188
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
11189
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
11190
+
11191
+ var signedYear = date.getUTCFullYear();
11192
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
11193
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
11194
+ return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
11195
+ },
11196
+ // Month
11197
+ M: function M(date, token) {
11198
+ var month = date.getUTCMonth();
11199
+ return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
11200
+ },
11201
+ // Day of the month
11202
+ d: function d(date, token) {
11203
+ return addLeadingZeros(date.getUTCDate(), token.length);
11204
+ },
11205
+ // AM or PM
11206
+ a: function a(date, token) {
11207
+ var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
11208
+ switch (token) {
11209
+ case 'a':
11210
+ case 'aa':
11211
+ return dayPeriodEnumValue.toUpperCase();
11212
+ case 'aaa':
11213
+ return dayPeriodEnumValue;
11214
+ case 'aaaaa':
11215
+ return dayPeriodEnumValue[0];
11216
+ case 'aaaa':
11217
+ default:
11218
+ return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
11219
+ }
11220
+ },
11221
+ // Hour [1-12]
11222
+ h: function h(date, token) {
11223
+ return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
11224
+ },
11225
+ // Hour [0-23]
11226
+ H: function H(date, token) {
11227
+ return addLeadingZeros(date.getUTCHours(), token.length);
11228
+ },
11229
+ // Minute
11230
+ m: function m(date, token) {
11231
+ return addLeadingZeros(date.getUTCMinutes(), token.length);
11232
+ },
11233
+ // Second
11234
+ s: function s(date, token) {
11235
+ return addLeadingZeros(date.getUTCSeconds(), token.length);
11236
+ },
11237
+ // Fraction of second
11238
+ S: function S(date, token) {
11239
+ var numberOfDigits = token.length;
11240
+ var milliseconds = date.getUTCMilliseconds();
11241
+ var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
11242
+ return addLeadingZeros(fractionalSeconds, token.length);
11243
+ }
11244
+ };
11245
+
11730
11246
  var dayPeriodEnum = {
11731
11247
  am: 'am',
11732
11248
  pm: 'pm',
@@ -11736,52 +11252,52 @@ var dayPeriodEnum = {
11736
11252
  afternoon: 'afternoon',
11737
11253
  evening: 'evening',
11738
11254
  night: 'night'
11739
- /*
11740
- * | | Unit | | Unit |
11741
- * |-----|--------------------------------|-----|--------------------------------|
11742
- * | a | AM, PM | A* | Milliseconds in day |
11743
- * | b | AM, PM, noon, midnight | B | Flexible day period |
11744
- * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
11745
- * | d | Day of month | D | Day of year |
11746
- * | e | Local day of week | E | Day of week |
11747
- * | f | | F* | Day of week in month |
11748
- * | g* | Modified Julian day | G | Era |
11749
- * | h | Hour [1-12] | H | Hour [0-23] |
11750
- * | i! | ISO day of week | I! | ISO week of year |
11751
- * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
11752
- * | k | Hour [1-24] | K | Hour [0-11] |
11753
- * | l* | (deprecated) | L | Stand-alone month |
11754
- * | m | Minute | M | Month |
11755
- * | n | | N | |
11756
- * | o! | Ordinal number modifier | O | Timezone (GMT) |
11757
- * | p! | Long localized time | P! | Long localized date |
11758
- * | q | Stand-alone quarter | Q | Quarter |
11759
- * | r* | Related Gregorian year | R! | ISO week-numbering year |
11760
- * | s | Second | S | Fraction of second |
11761
- * | t! | Seconds timestamp | T! | Milliseconds timestamp |
11762
- * | u | Extended year | U* | Cyclic year |
11763
- * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
11764
- * | w | Local week of year | W* | Week of month |
11765
- * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
11766
- * | y | Year (abs) | Y | Local week-numbering year |
11767
- * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
11768
- *
11769
- * Letters marked by * are not implemented but reserved by Unicode standard.
11770
- *
11771
- * Letters marked by ! are non-standard, but implemented by date-fns:
11772
- * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
11773
- * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
11774
- * i.e. 7 for Sunday, 1 for Monday, etc.
11775
- * - `I` is ISO week of year, as opposed to `w` which is local week of year.
11776
- * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
11777
- * `R` is supposed to be used in conjunction with `I` and `i`
11778
- * for universal ISO week-numbering date, whereas
11779
- * `Y` is supposed to be used in conjunction with `w` and `e`
11780
- * for week-numbering date specific to the locale.
11781
- * - `P` is long localized date format
11782
- * - `p` is long localized time format
11783
- */
11784
11255
  };
11256
+ /*
11257
+ * | | Unit | | Unit |
11258
+ * |-----|--------------------------------|-----|--------------------------------|
11259
+ * | a | AM, PM | A* | Milliseconds in day |
11260
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
11261
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
11262
+ * | d | Day of month | D | Day of year |
11263
+ * | e | Local day of week | E | Day of week |
11264
+ * | f | | F* | Day of week in month |
11265
+ * | g* | Modified Julian day | G | Era |
11266
+ * | h | Hour [1-12] | H | Hour [0-23] |
11267
+ * | i! | ISO day of week | I! | ISO week of year |
11268
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
11269
+ * | k | Hour [1-24] | K | Hour [0-11] |
11270
+ * | l* | (deprecated) | L | Stand-alone month |
11271
+ * | m | Minute | M | Month |
11272
+ * | n | | N | |
11273
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
11274
+ * | p! | Long localized time | P! | Long localized date |
11275
+ * | q | Stand-alone quarter | Q | Quarter |
11276
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
11277
+ * | s | Second | S | Fraction of second |
11278
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
11279
+ * | u | Extended year | U* | Cyclic year |
11280
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
11281
+ * | w | Local week of year | W* | Week of month |
11282
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
11283
+ * | y | Year (abs) | Y | Local week-numbering year |
11284
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
11285
+ *
11286
+ * Letters marked by * are not implemented but reserved by Unicode standard.
11287
+ *
11288
+ * Letters marked by ! are non-standard, but implemented by date-fns:
11289
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
11290
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
11291
+ * i.e. 7 for Sunday, 1 for Monday, etc.
11292
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
11293
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
11294
+ * `R` is supposed to be used in conjunction with `I` and `i`
11295
+ * for universal ISO week-numbering date, whereas
11296
+ * `Y` is supposed to be used in conjunction with `w` and `e`
11297
+ * for week-numbering date specific to the locale.
11298
+ * - `P` is long localized date format
11299
+ * - `p` is long localized time format
11300
+ */
11785
11301
 
11786
11302
  var formatters = {
11787
11303
  // Era
@@ -11796,13 +11312,11 @@ var formatters = {
11796
11312
  width: 'abbreviated'
11797
11313
  });
11798
11314
  // A, B
11799
-
11800
11315
  case 'GGGGG':
11801
11316
  return localize.era(era, {
11802
11317
  width: 'narrow'
11803
11318
  });
11804
11319
  // Anno Domini, Before Christ
11805
-
11806
11320
  case 'GGGG':
11807
11321
  default:
11808
11322
  return localize.era(era, {
@@ -11814,8 +11328,8 @@ var formatters = {
11814
11328
  y: function y(date, token, localize) {
11815
11329
  // Ordinal number
11816
11330
  if (token === 'yo') {
11817
- var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
11818
-
11331
+ var signedYear = date.getUTCFullYear();
11332
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
11819
11333
  var year = signedYear > 0 ? signedYear : 1 - signedYear;
11820
11334
  return localize.ordinalNumber(year, {
11821
11335
  unit: 'year'
@@ -11825,27 +11339,31 @@ var formatters = {
11825
11339
  },
11826
11340
  // Local week-numbering year
11827
11341
  Y: function Y(date, token, localize, options) {
11828
- var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)
11829
-
11830
- var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year
11342
+ var signedWeekYear = getUTCWeekYear(date, options);
11343
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
11344
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
11831
11345
 
11346
+ // Two digit year
11832
11347
  if (token === 'YY') {
11833
11348
  var twoDigitYear = weekYear % 100;
11834
11349
  return addLeadingZeros(twoDigitYear, 2);
11835
- } // Ordinal number
11350
+ }
11836
11351
 
11352
+ // Ordinal number
11837
11353
  if (token === 'Yo') {
11838
11354
  return localize.ordinalNumber(weekYear, {
11839
11355
  unit: 'year'
11840
11356
  });
11841
- } // Padding
11357
+ }
11842
11358
 
11359
+ // Padding
11843
11360
  return addLeadingZeros(weekYear, token.length);
11844
11361
  },
11845
11362
  // ISO week-numbering year
11846
11363
  R: function R(date, token) {
11847
- var isoWeekYear = getUTCISOWeekYear(date); // Padding
11364
+ var isoWeekYear = getUTCISOWeekYear(date);
11848
11365
 
11366
+ // Padding
11849
11367
  return addLeadingZeros(isoWeekYear, token.length);
11850
11368
  },
11851
11369
  // Extended year. This is a single number designating the year of this calendar system.
@@ -11869,31 +11387,26 @@ var formatters = {
11869
11387
  case 'Q':
11870
11388
  return String(quarter);
11871
11389
  // 01, 02, 03, 04
11872
-
11873
11390
  case 'QQ':
11874
11391
  return addLeadingZeros(quarter, 2);
11875
11392
  // 1st, 2nd, 3rd, 4th
11876
-
11877
11393
  case 'Qo':
11878
11394
  return localize.ordinalNumber(quarter, {
11879
11395
  unit: 'quarter'
11880
11396
  });
11881
11397
  // Q1, Q2, Q3, Q4
11882
-
11883
11398
  case 'QQQ':
11884
11399
  return localize.quarter(quarter, {
11885
11400
  width: 'abbreviated',
11886
11401
  context: 'formatting'
11887
11402
  });
11888
11403
  // 1, 2, 3, 4 (narrow quarter; could be not numerical)
11889
-
11890
11404
  case 'QQQQQ':
11891
11405
  return localize.quarter(quarter, {
11892
11406
  width: 'narrow',
11893
11407
  context: 'formatting'
11894
11408
  });
11895
11409
  // 1st quarter, 2nd quarter, ...
11896
-
11897
11410
  case 'QQQQ':
11898
11411
  default:
11899
11412
  return localize.quarter(quarter, {
@@ -11910,31 +11423,26 @@ var formatters = {
11910
11423
  case 'q':
11911
11424
  return String(quarter);
11912
11425
  // 01, 02, 03, 04
11913
-
11914
11426
  case 'qq':
11915
11427
  return addLeadingZeros(quarter, 2);
11916
11428
  // 1st, 2nd, 3rd, 4th
11917
-
11918
11429
  case 'qo':
11919
11430
  return localize.ordinalNumber(quarter, {
11920
11431
  unit: 'quarter'
11921
11432
  });
11922
11433
  // Q1, Q2, Q3, Q4
11923
-
11924
11434
  case 'qqq':
11925
11435
  return localize.quarter(quarter, {
11926
11436
  width: 'abbreviated',
11927
11437
  context: 'standalone'
11928
11438
  });
11929
11439
  // 1, 2, 3, 4 (narrow quarter; could be not numerical)
11930
-
11931
11440
  case 'qqqqq':
11932
11441
  return localize.quarter(quarter, {
11933
11442
  width: 'narrow',
11934
11443
  context: 'standalone'
11935
11444
  });
11936
11445
  // 1st quarter, 2nd quarter, ...
11937
-
11938
11446
  case 'qqqq':
11939
11447
  default:
11940
11448
  return localize.quarter(quarter, {
@@ -11951,27 +11459,23 @@ var formatters = {
11951
11459
  case 'MM':
11952
11460
  return formatters$1.M(date, token);
11953
11461
  // 1st, 2nd, ..., 12th
11954
-
11955
11462
  case 'Mo':
11956
11463
  return localize.ordinalNumber(month + 1, {
11957
11464
  unit: 'month'
11958
11465
  });
11959
11466
  // Jan, Feb, ..., Dec
11960
-
11961
11467
  case 'MMM':
11962
11468
  return localize.month(month, {
11963
11469
  width: 'abbreviated',
11964
11470
  context: 'formatting'
11965
11471
  });
11966
11472
  // J, F, ..., D
11967
-
11968
11473
  case 'MMMMM':
11969
11474
  return localize.month(month, {
11970
11475
  width: 'narrow',
11971
11476
  context: 'formatting'
11972
11477
  });
11973
11478
  // January, February, ..., December
11974
-
11975
11479
  case 'MMMM':
11976
11480
  default:
11977
11481
  return localize.month(month, {
@@ -11988,31 +11492,26 @@ var formatters = {
11988
11492
  case 'L':
11989
11493
  return String(month + 1);
11990
11494
  // 01, 02, ..., 12
11991
-
11992
11495
  case 'LL':
11993
11496
  return addLeadingZeros(month + 1, 2);
11994
11497
  // 1st, 2nd, ..., 12th
11995
-
11996
11498
  case 'Lo':
11997
11499
  return localize.ordinalNumber(month + 1, {
11998
11500
  unit: 'month'
11999
11501
  });
12000
11502
  // Jan, Feb, ..., Dec
12001
-
12002
11503
  case 'LLL':
12003
11504
  return localize.month(month, {
12004
11505
  width: 'abbreviated',
12005
11506
  context: 'standalone'
12006
11507
  });
12007
11508
  // J, F, ..., D
12008
-
12009
11509
  case 'LLLLL':
12010
11510
  return localize.month(month, {
12011
11511
  width: 'narrow',
12012
11512
  context: 'standalone'
12013
11513
  });
12014
11514
  // January, February, ..., December
12015
-
12016
11515
  case 'LLLL':
12017
11516
  default:
12018
11517
  return localize.month(month, {
@@ -12073,21 +11572,18 @@ var formatters = {
12073
11572
  context: 'formatting'
12074
11573
  });
12075
11574
  // T
12076
-
12077
11575
  case 'EEEEE':
12078
11576
  return localize.day(dayOfWeek, {
12079
11577
  width: 'narrow',
12080
11578
  context: 'formatting'
12081
11579
  });
12082
11580
  // Tu
12083
-
12084
11581
  case 'EEEEEE':
12085
11582
  return localize.day(dayOfWeek, {
12086
11583
  width: 'short',
12087
11584
  context: 'formatting'
12088
11585
  });
12089
11586
  // Tuesday
12090
-
12091
11587
  case 'EEEE':
12092
11588
  default:
12093
11589
  return localize.day(dayOfWeek, {
@@ -12105,11 +11601,9 @@ var formatters = {
12105
11601
  case 'e':
12106
11602
  return String(localDayOfWeek);
12107
11603
  // Padded numerical value
12108
-
12109
11604
  case 'ee':
12110
11605
  return addLeadingZeros(localDayOfWeek, 2);
12111
11606
  // 1st, 2nd, ..., 7th
12112
-
12113
11607
  case 'eo':
12114
11608
  return localize.ordinalNumber(localDayOfWeek, {
12115
11609
  unit: 'day'
@@ -12120,21 +11614,18 @@ var formatters = {
12120
11614
  context: 'formatting'
12121
11615
  });
12122
11616
  // T
12123
-
12124
11617
  case 'eeeee':
12125
11618
  return localize.day(dayOfWeek, {
12126
11619
  width: 'narrow',
12127
11620
  context: 'formatting'
12128
11621
  });
12129
11622
  // Tu
12130
-
12131
11623
  case 'eeeeee':
12132
11624
  return localize.day(dayOfWeek, {
12133
11625
  width: 'short',
12134
11626
  context: 'formatting'
12135
11627
  });
12136
11628
  // Tuesday
12137
-
12138
11629
  case 'eeee':
12139
11630
  default:
12140
11631
  return localize.day(dayOfWeek, {
@@ -12152,11 +11643,9 @@ var formatters = {
12152
11643
  case 'c':
12153
11644
  return String(localDayOfWeek);
12154
11645
  // Padded numerical value
12155
-
12156
11646
  case 'cc':
12157
11647
  return addLeadingZeros(localDayOfWeek, token.length);
12158
11648
  // 1st, 2nd, ..., 7th
12159
-
12160
11649
  case 'co':
12161
11650
  return localize.ordinalNumber(localDayOfWeek, {
12162
11651
  unit: 'day'
@@ -12167,21 +11656,18 @@ var formatters = {
12167
11656
  context: 'standalone'
12168
11657
  });
12169
11658
  // T
12170
-
12171
11659
  case 'ccccc':
12172
11660
  return localize.day(dayOfWeek, {
12173
11661
  width: 'narrow',
12174
11662
  context: 'standalone'
12175
11663
  });
12176
11664
  // Tu
12177
-
12178
11665
  case 'cccccc':
12179
11666
  return localize.day(dayOfWeek, {
12180
11667
  width: 'short',
12181
11668
  context: 'standalone'
12182
11669
  });
12183
11670
  // Tuesday
12184
-
12185
11671
  case 'cccc':
12186
11672
  default:
12187
11673
  return localize.day(dayOfWeek, {
@@ -12199,38 +11685,32 @@ var formatters = {
12199
11685
  case 'i':
12200
11686
  return String(isoDayOfWeek);
12201
11687
  // 02
12202
-
12203
11688
  case 'ii':
12204
11689
  return addLeadingZeros(isoDayOfWeek, token.length);
12205
11690
  // 2nd
12206
-
12207
11691
  case 'io':
12208
11692
  return localize.ordinalNumber(isoDayOfWeek, {
12209
11693
  unit: 'day'
12210
11694
  });
12211
11695
  // Tue
12212
-
12213
11696
  case 'iii':
12214
11697
  return localize.day(dayOfWeek, {
12215
11698
  width: 'abbreviated',
12216
11699
  context: 'formatting'
12217
11700
  });
12218
11701
  // T
12219
-
12220
11702
  case 'iiiii':
12221
11703
  return localize.day(dayOfWeek, {
12222
11704
  width: 'narrow',
12223
11705
  context: 'formatting'
12224
11706
  });
12225
11707
  // Tu
12226
-
12227
11708
  case 'iiiiii':
12228
11709
  return localize.day(dayOfWeek, {
12229
11710
  width: 'short',
12230
11711
  context: 'formatting'
12231
11712
  });
12232
11713
  // Tuesday
12233
-
12234
11714
  case 'iiii':
12235
11715
  default:
12236
11716
  return localize.day(dayOfWeek, {
@@ -12246,11 +11726,15 @@ var formatters = {
12246
11726
  switch (token) {
12247
11727
  case 'a':
12248
11728
  case 'aa':
12249
- case 'aaa':
12250
11729
  return localize.dayPeriod(dayPeriodEnumValue, {
12251
11730
  width: 'abbreviated',
12252
11731
  context: 'formatting'
12253
11732
  });
11733
+ case 'aaa':
11734
+ return localize.dayPeriod(dayPeriodEnumValue, {
11735
+ width: 'abbreviated',
11736
+ context: 'formatting'
11737
+ }).toLowerCase();
12254
11738
  case 'aaaaa':
12255
11739
  return localize.dayPeriod(dayPeriodEnumValue, {
12256
11740
  width: 'narrow',
@@ -12278,11 +11762,15 @@ var formatters = {
12278
11762
  switch (token) {
12279
11763
  case 'b':
12280
11764
  case 'bb':
12281
- case 'bbb':
12282
11765
  return localize.dayPeriod(dayPeriodEnumValue, {
12283
11766
  width: 'abbreviated',
12284
11767
  context: 'formatting'
12285
11768
  });
11769
+ case 'bbb':
11770
+ return localize.dayPeriod(dayPeriodEnumValue, {
11771
+ width: 'abbreviated',
11772
+ context: 'formatting'
11773
+ }).toLowerCase();
12286
11774
  case 'bbbbb':
12287
11775
  return localize.dayPeriod(dayPeriodEnumValue, {
12288
11776
  width: 'narrow',
@@ -12404,21 +11892,20 @@ var formatters = {
12404
11892
  // Hours and optional minutes
12405
11893
  case 'X':
12406
11894
  return formatTimezoneWithOptionalMinutes(timezoneOffset);
11895
+
12407
11896
  // Hours, minutes and optional seconds without `:` delimiter
12408
11897
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
12409
11898
  // so this token always has the same output as `XX`
12410
-
12411
11899
  case 'XXXX':
12412
11900
  case 'XX':
12413
11901
  // Hours and minutes without `:` delimiter
12414
11902
  return formatTimezone(timezoneOffset);
11903
+
12415
11904
  // Hours, minutes and optional seconds with `:` delimiter
12416
11905
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
12417
11906
  // so this token always has the same output as `XXX`
12418
-
12419
11907
  case 'XXXXX':
12420
11908
  case 'XXX': // Hours and minutes with `:` delimiter
12421
-
12422
11909
  default:
12423
11910
  return formatTimezone(timezoneOffset, ':');
12424
11911
  }
@@ -12431,21 +11918,20 @@ var formatters = {
12431
11918
  // Hours and optional minutes
12432
11919
  case 'x':
12433
11920
  return formatTimezoneWithOptionalMinutes(timezoneOffset);
11921
+
12434
11922
  // Hours, minutes and optional seconds without `:` delimiter
12435
11923
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
12436
11924
  // so this token always has the same output as `xx`
12437
-
12438
11925
  case 'xxxx':
12439
11926
  case 'xx':
12440
11927
  // Hours and minutes without `:` delimiter
12441
11928
  return formatTimezone(timezoneOffset);
11929
+
12442
11930
  // Hours, minutes and optional seconds with `:` delimiter
12443
11931
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
12444
11932
  // so this token always has the same output as `xxx`
12445
-
12446
11933
  case 'xxxxx':
12447
11934
  case 'xxx': // Hours and minutes with `:` delimiter
12448
-
12449
11935
  default:
12450
11936
  return formatTimezone(timezoneOffset, ':');
12451
11937
  }
@@ -12461,7 +11947,6 @@ var formatters = {
12461
11947
  case 'OOO':
12462
11948
  return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
12463
11949
  // Long
12464
-
12465
11950
  case 'OOOO':
12466
11951
  default:
12467
11952
  return 'GMT' + formatTimezone(timezoneOffset, ':');
@@ -12478,7 +11963,6 @@ var formatters = {
12478
11963
  case 'zzz':
12479
11964
  return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
12480
11965
  // Long
12481
-
12482
11966
  case 'zzzz':
12483
11967
  default:
12484
11968
  return 'GMT' + formatTimezone(timezoneOffset, ':');
@@ -12524,7 +12008,7 @@ function formatTimezone(offset, dirtyDelimiter) {
12524
12008
  return sign + hours + delimiter + minutes;
12525
12009
  }
12526
12010
 
12527
- function dateLongFormatter(pattern, formatLong) {
12011
+ var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
12528
12012
  switch (pattern) {
12529
12013
  case 'P':
12530
12014
  return formatLong.date({
@@ -12544,8 +12028,8 @@ function dateLongFormatter(pattern, formatLong) {
12544
12028
  width: 'full'
12545
12029
  });
12546
12030
  }
12547
- }
12548
- function timeLongFormatter(pattern, formatLong) {
12031
+ };
12032
+ var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
12549
12033
  switch (pattern) {
12550
12034
  case 'p':
12551
12035
  return formatLong.time({
@@ -12565,9 +12049,9 @@ function timeLongFormatter(pattern, formatLong) {
12565
12049
  width: 'full'
12566
12050
  });
12567
12051
  }
12568
- }
12569
- function dateTimeLongFormatter(pattern, formatLong) {
12570
- var matchResult = pattern.match(/(P+)(p+)?/);
12052
+ };
12053
+ var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
12054
+ var matchResult = pattern.match(/(P+)(p+)?/) || [];
12571
12055
  var datePattern = matchResult[1];
12572
12056
  var timePattern = matchResult[2];
12573
12057
  if (!timePattern) {
@@ -12598,16 +12082,12 @@ function dateTimeLongFormatter(pattern, formatLong) {
12598
12082
  break;
12599
12083
  }
12600
12084
  return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
12601
- }
12085
+ };
12602
12086
  var longFormatters = {
12603
12087
  p: timeLongFormatter,
12604
12088
  P: dateTimeLongFormatter
12605
12089
  };
12606
12090
 
12607
- var MILLISECONDS_IN_MINUTE = 60000;
12608
- function getDateMillisecondsPart(date) {
12609
- return date.getTime() % MILLISECONDS_IN_MINUTE;
12610
- }
12611
12091
  /**
12612
12092
  * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
12613
12093
  * They usually appear for dates that denote time before the timezones were introduced
@@ -12619,14 +12099,10 @@ function getDateMillisecondsPart(date) {
12619
12099
  *
12620
12100
  * This function returns the timezone offset in milliseconds that takes seconds in account.
12621
12101
  */
12622
-
12623
- function getTimezoneOffsetInMilliseconds(dirtyDate) {
12624
- var date = new Date(dirtyDate.getTime());
12625
- var baseTimezoneOffset = Math.ceil(date.getTimezoneOffset());
12626
- date.setSeconds(0, 0);
12627
- var hasNegativeUTCOffset = baseTimezoneOffset > 0;
12628
- var millisecondsPartOfTimezoneOffset = hasNegativeUTCOffset ? (MILLISECONDS_IN_MINUTE + getDateMillisecondsPart(date)) % MILLISECONDS_IN_MINUTE : getDateMillisecondsPart(date);
12629
- return baseTimezoneOffset * MILLISECONDS_IN_MINUTE + millisecondsPartOfTimezoneOffset;
12102
+ function getTimezoneOffsetInMilliseconds(date) {
12103
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
12104
+ utcDate.setUTCFullYear(date.getFullYear());
12105
+ return date.getTime() - utcDate.getTime();
12630
12106
  }
12631
12107
 
12632
12108
  var protectedDayOfYearTokens = ['D', 'DD'];
@@ -12639,16 +12115,494 @@ function isProtectedWeekYearToken(token) {
12639
12115
  }
12640
12116
  function throwProtectedError(token, format, input) {
12641
12117
  if (token === 'YYYY') {
12642
- throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
12118
+ throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
12643
12119
  } else if (token === 'YY') {
12644
- throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
12120
+ throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
12645
12121
  } else if (token === 'D') {
12646
- throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
12122
+ throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
12647
12123
  } else if (token === 'DD') {
12648
- throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
12124
+ throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
12125
+ }
12126
+ }
12127
+
12128
+ var formatDistanceLocale$1 = {
12129
+ lessThanXSeconds: {
12130
+ one: 'less than a second',
12131
+ other: 'less than {{count}} seconds'
12132
+ },
12133
+ xSeconds: {
12134
+ one: '1 second',
12135
+ other: '{{count}} seconds'
12136
+ },
12137
+ halfAMinute: 'half a minute',
12138
+ lessThanXMinutes: {
12139
+ one: 'less than a minute',
12140
+ other: 'less than {{count}} minutes'
12141
+ },
12142
+ xMinutes: {
12143
+ one: '1 minute',
12144
+ other: '{{count}} minutes'
12145
+ },
12146
+ aboutXHours: {
12147
+ one: 'about 1 hour',
12148
+ other: 'about {{count}} hours'
12149
+ },
12150
+ xHours: {
12151
+ one: '1 hour',
12152
+ other: '{{count}} hours'
12153
+ },
12154
+ xDays: {
12155
+ one: '1 day',
12156
+ other: '{{count}} days'
12157
+ },
12158
+ aboutXWeeks: {
12159
+ one: 'about 1 week',
12160
+ other: 'about {{count}} weeks'
12161
+ },
12162
+ xWeeks: {
12163
+ one: '1 week',
12164
+ other: '{{count}} weeks'
12165
+ },
12166
+ aboutXMonths: {
12167
+ one: 'about 1 month',
12168
+ other: 'about {{count}} months'
12169
+ },
12170
+ xMonths: {
12171
+ one: '1 month',
12172
+ other: '{{count}} months'
12173
+ },
12174
+ aboutXYears: {
12175
+ one: 'about 1 year',
12176
+ other: 'about {{count}} years'
12177
+ },
12178
+ xYears: {
12179
+ one: '1 year',
12180
+ other: '{{count}} years'
12181
+ },
12182
+ overXYears: {
12183
+ one: 'over 1 year',
12184
+ other: 'over {{count}} years'
12185
+ },
12186
+ almostXYears: {
12187
+ one: 'almost 1 year',
12188
+ other: 'almost {{count}} years'
12189
+ }
12190
+ };
12191
+ var formatDistance$1 = function formatDistance(token, count, options) {
12192
+ var result;
12193
+ var tokenValue = formatDistanceLocale$1[token];
12194
+ if (typeof tokenValue === 'string') {
12195
+ result = tokenValue;
12196
+ } else if (count === 1) {
12197
+ result = tokenValue.one;
12198
+ } else {
12199
+ result = tokenValue.other.replace('{{count}}', count.toString());
12200
+ }
12201
+ if (options !== null && options !== void 0 && options.addSuffix) {
12202
+ if (options.comparison && options.comparison > 0) {
12203
+ return 'in ' + result;
12204
+ } else {
12205
+ return result + ' ago';
12206
+ }
12207
+ }
12208
+ return result;
12209
+ };
12210
+
12211
+ function buildFormatLongFn(args) {
12212
+ return function () {
12213
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12214
+ // TODO: Remove String()
12215
+ var width = options.width ? String(options.width) : args.defaultWidth;
12216
+ var format = args.formats[width] || args.formats[args.defaultWidth];
12217
+ return format;
12218
+ };
12219
+ }
12220
+
12221
+ var dateFormats$2 = {
12222
+ full: 'EEEE, MMMM do, y',
12223
+ "long": 'MMMM do, y',
12224
+ medium: 'MMM d, y',
12225
+ "short": 'MM/dd/yyyy'
12226
+ };
12227
+ var timeFormats$2 = {
12228
+ full: 'h:mm:ss a zzzz',
12229
+ "long": 'h:mm:ss a z',
12230
+ medium: 'h:mm:ss a',
12231
+ "short": 'h:mm a'
12232
+ };
12233
+ var dateTimeFormats$2 = {
12234
+ full: "{{date}} 'at' {{time}}",
12235
+ "long": "{{date}} 'at' {{time}}",
12236
+ medium: '{{date}}, {{time}}',
12237
+ "short": '{{date}}, {{time}}'
12238
+ };
12239
+ var formatLong$2 = {
12240
+ date: buildFormatLongFn({
12241
+ formats: dateFormats$2,
12242
+ defaultWidth: 'full'
12243
+ }),
12244
+ time: buildFormatLongFn({
12245
+ formats: timeFormats$2,
12246
+ defaultWidth: 'full'
12247
+ }),
12248
+ dateTime: buildFormatLongFn({
12249
+ formats: dateTimeFormats$2,
12250
+ defaultWidth: 'full'
12251
+ })
12252
+ };
12253
+
12254
+ var formatRelativeLocale = {
12255
+ lastWeek: "'last' eeee 'at' p",
12256
+ yesterday: "'yesterday at' p",
12257
+ today: "'today at' p",
12258
+ tomorrow: "'tomorrow at' p",
12259
+ nextWeek: "eeee 'at' p",
12260
+ other: 'P'
12261
+ };
12262
+ var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
12263
+ return formatRelativeLocale[token];
12264
+ };
12265
+
12266
+ function buildLocalizeFn(args) {
12267
+ return function (dirtyIndex, options) {
12268
+ var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
12269
+ var valuesArray;
12270
+ if (context === 'formatting' && args.formattingValues) {
12271
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
12272
+ var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
12273
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
12274
+ } else {
12275
+ var _defaultWidth = args.defaultWidth;
12276
+ var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
12277
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
12278
+ }
12279
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
12280
+ // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
12281
+ return valuesArray[index];
12282
+ };
12283
+ }
12284
+
12285
+ var eraValues = {
12286
+ narrow: ['B', 'A'],
12287
+ abbreviated: ['BC', 'AD'],
12288
+ wide: ['Before Christ', 'Anno Domini']
12289
+ };
12290
+ var quarterValues = {
12291
+ narrow: ['1', '2', '3', '4'],
12292
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
12293
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
12294
+ };
12295
+
12296
+ // Note: in English, the names of days of the week and months are capitalized.
12297
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
12298
+ // Generally, formatted dates should look like they are in the middle of a sentence,
12299
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
12300
+ var monthValues = {
12301
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
12302
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
12303
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
12304
+ };
12305
+ var dayValues = {
12306
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
12307
+ "short": ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
12308
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
12309
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
12310
+ };
12311
+ var dayPeriodValues = {
12312
+ narrow: {
12313
+ am: 'a',
12314
+ pm: 'p',
12315
+ midnight: 'mi',
12316
+ noon: 'n',
12317
+ morning: 'morning',
12318
+ afternoon: 'afternoon',
12319
+ evening: 'evening',
12320
+ night: 'night'
12321
+ },
12322
+ abbreviated: {
12323
+ am: 'AM',
12324
+ pm: 'PM',
12325
+ midnight: 'midnight',
12326
+ noon: 'noon',
12327
+ morning: 'morning',
12328
+ afternoon: 'afternoon',
12329
+ evening: 'evening',
12330
+ night: 'night'
12331
+ },
12332
+ wide: {
12333
+ am: 'a.m.',
12334
+ pm: 'p.m.',
12335
+ midnight: 'midnight',
12336
+ noon: 'noon',
12337
+ morning: 'morning',
12338
+ afternoon: 'afternoon',
12339
+ evening: 'evening',
12340
+ night: 'night'
12341
+ }
12342
+ };
12343
+ var formattingDayPeriodValues = {
12344
+ narrow: {
12345
+ am: 'a',
12346
+ pm: 'p',
12347
+ midnight: 'mi',
12348
+ noon: 'n',
12349
+ morning: 'in the morning',
12350
+ afternoon: 'in the afternoon',
12351
+ evening: 'in the evening',
12352
+ night: 'at night'
12353
+ },
12354
+ abbreviated: {
12355
+ am: 'AM',
12356
+ pm: 'PM',
12357
+ midnight: 'midnight',
12358
+ noon: 'noon',
12359
+ morning: 'in the morning',
12360
+ afternoon: 'in the afternoon',
12361
+ evening: 'in the evening',
12362
+ night: 'at night'
12363
+ },
12364
+ wide: {
12365
+ am: 'a.m.',
12366
+ pm: 'p.m.',
12367
+ midnight: 'midnight',
12368
+ noon: 'noon',
12369
+ morning: 'in the morning',
12370
+ afternoon: 'in the afternoon',
12371
+ evening: 'in the evening',
12372
+ night: 'at night'
12373
+ }
12374
+ };
12375
+ var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
12376
+ var number = Number(dirtyNumber);
12377
+
12378
+ // If ordinal numbers depend on context, for example,
12379
+ // if they are different for different grammatical genders,
12380
+ // use `options.unit`.
12381
+ //
12382
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
12383
+ // 'day', 'hour', 'minute', 'second'.
12384
+
12385
+ var rem100 = number % 100;
12386
+ if (rem100 > 20 || rem100 < 10) {
12387
+ switch (rem100 % 10) {
12388
+ case 1:
12389
+ return number + 'st';
12390
+ case 2:
12391
+ return number + 'nd';
12392
+ case 3:
12393
+ return number + 'rd';
12394
+ }
12395
+ }
12396
+ return number + 'th';
12397
+ };
12398
+ var localize = {
12399
+ ordinalNumber: ordinalNumber,
12400
+ era: buildLocalizeFn({
12401
+ values: eraValues,
12402
+ defaultWidth: 'wide'
12403
+ }),
12404
+ quarter: buildLocalizeFn({
12405
+ values: quarterValues,
12406
+ defaultWidth: 'wide',
12407
+ argumentCallback: function argumentCallback(quarter) {
12408
+ return quarter - 1;
12409
+ }
12410
+ }),
12411
+ month: buildLocalizeFn({
12412
+ values: monthValues,
12413
+ defaultWidth: 'wide'
12414
+ }),
12415
+ day: buildLocalizeFn({
12416
+ values: dayValues,
12417
+ defaultWidth: 'wide'
12418
+ }),
12419
+ dayPeriod: buildLocalizeFn({
12420
+ values: dayPeriodValues,
12421
+ defaultWidth: 'wide',
12422
+ formattingValues: formattingDayPeriodValues,
12423
+ defaultFormattingWidth: 'wide'
12424
+ })
12425
+ };
12426
+
12427
+ function buildMatchFn(args) {
12428
+ return function (string) {
12429
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12430
+ var width = options.width;
12431
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
12432
+ var matchResult = string.match(matchPattern);
12433
+ if (!matchResult) {
12434
+ return null;
12435
+ }
12436
+ var matchedString = matchResult[0];
12437
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
12438
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
12439
+ return pattern.test(matchedString);
12440
+ }) : findKey(parsePatterns, function (pattern) {
12441
+ return pattern.test(matchedString);
12442
+ });
12443
+ var value;
12444
+ value = args.valueCallback ? args.valueCallback(key) : key;
12445
+ value = options.valueCallback ? options.valueCallback(value) : value;
12446
+ var rest = string.slice(matchedString.length);
12447
+ return {
12448
+ value: value,
12449
+ rest: rest
12450
+ };
12451
+ };
12452
+ }
12453
+ function findKey(object, predicate) {
12454
+ for (var key in object) {
12455
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
12456
+ return key;
12457
+ }
12458
+ }
12459
+ return undefined;
12460
+ }
12461
+ function findIndex(array, predicate) {
12462
+ for (var key = 0; key < array.length; key++) {
12463
+ if (predicate(array[key])) {
12464
+ return key;
12465
+ }
12649
12466
  }
12467
+ return undefined;
12468
+ }
12469
+
12470
+ function buildMatchPatternFn(args) {
12471
+ return function (string) {
12472
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12473
+ var matchResult = string.match(args.matchPattern);
12474
+ if (!matchResult) return null;
12475
+ var matchedString = matchResult[0];
12476
+ var parseResult = string.match(args.parsePattern);
12477
+ if (!parseResult) return null;
12478
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
12479
+ value = options.valueCallback ? options.valueCallback(value) : value;
12480
+ var rest = string.slice(matchedString.length);
12481
+ return {
12482
+ value: value,
12483
+ rest: rest
12484
+ };
12485
+ };
12650
12486
  }
12651
12487
 
12488
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
12489
+ var parseOrdinalNumberPattern = /\d+/i;
12490
+ var matchEraPatterns = {
12491
+ narrow: /^(b|a)/i,
12492
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
12493
+ wide: /^(before christ|before common era|anno domini|common era)/i
12494
+ };
12495
+ var parseEraPatterns = {
12496
+ any: [/^b/i, /^(a|c)/i]
12497
+ };
12498
+ var matchQuarterPatterns = {
12499
+ narrow: /^[1234]/i,
12500
+ abbreviated: /^q[1234]/i,
12501
+ wide: /^[1234](th|st|nd|rd)? quarter/i
12502
+ };
12503
+ var parseQuarterPatterns = {
12504
+ any: [/1/i, /2/i, /3/i, /4/i]
12505
+ };
12506
+ var matchMonthPatterns = {
12507
+ narrow: /^[jfmasond]/i,
12508
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
12509
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
12510
+ };
12511
+ var parseMonthPatterns = {
12512
+ narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
12513
+ any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
12514
+ };
12515
+ var matchDayPatterns = {
12516
+ narrow: /^[smtwf]/i,
12517
+ "short": /^(su|mo|tu|we|th|fr|sa)/i,
12518
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
12519
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
12520
+ };
12521
+ var parseDayPatterns = {
12522
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
12523
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
12524
+ };
12525
+ var matchDayPeriodPatterns = {
12526
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
12527
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
12528
+ };
12529
+ var parseDayPeriodPatterns = {
12530
+ any: {
12531
+ am: /^a/i,
12532
+ pm: /^p/i,
12533
+ midnight: /^mi/i,
12534
+ noon: /^no/i,
12535
+ morning: /morning/i,
12536
+ afternoon: /afternoon/i,
12537
+ evening: /evening/i,
12538
+ night: /night/i
12539
+ }
12540
+ };
12541
+ var match = {
12542
+ ordinalNumber: buildMatchPatternFn({
12543
+ matchPattern: matchOrdinalNumberPattern,
12544
+ parsePattern: parseOrdinalNumberPattern,
12545
+ valueCallback: function valueCallback(value) {
12546
+ return parseInt(value, 10);
12547
+ }
12548
+ }),
12549
+ era: buildMatchFn({
12550
+ matchPatterns: matchEraPatterns,
12551
+ defaultMatchWidth: 'wide',
12552
+ parsePatterns: parseEraPatterns,
12553
+ defaultParseWidth: 'any'
12554
+ }),
12555
+ quarter: buildMatchFn({
12556
+ matchPatterns: matchQuarterPatterns,
12557
+ defaultMatchWidth: 'wide',
12558
+ parsePatterns: parseQuarterPatterns,
12559
+ defaultParseWidth: 'any',
12560
+ valueCallback: function valueCallback(index) {
12561
+ return index + 1;
12562
+ }
12563
+ }),
12564
+ month: buildMatchFn({
12565
+ matchPatterns: matchMonthPatterns,
12566
+ defaultMatchWidth: 'wide',
12567
+ parsePatterns: parseMonthPatterns,
12568
+ defaultParseWidth: 'any'
12569
+ }),
12570
+ day: buildMatchFn({
12571
+ matchPatterns: matchDayPatterns,
12572
+ defaultMatchWidth: 'wide',
12573
+ parsePatterns: parseDayPatterns,
12574
+ defaultParseWidth: 'any'
12575
+ }),
12576
+ dayPeriod: buildMatchFn({
12577
+ matchPatterns: matchDayPeriodPatterns,
12578
+ defaultMatchWidth: 'any',
12579
+ parsePatterns: parseDayPeriodPatterns,
12580
+ defaultParseWidth: 'any'
12581
+ })
12582
+ };
12583
+
12584
+ /**
12585
+ * @type {Locale}
12586
+ * @category Locales
12587
+ * @summary English locale (United States).
12588
+ * @language English
12589
+ * @iso-639-2 eng
12590
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
12591
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
12592
+ */
12593
+ var locale$4 = {
12594
+ code: 'en-US',
12595
+ formatDistance: formatDistance$1,
12596
+ formatLong: formatLong$2,
12597
+ formatRelative: formatRelative,
12598
+ localize: localize,
12599
+ match: match,
12600
+ options: {
12601
+ weekStartsOn: 0 /* Sunday */,
12602
+ firstWeekContainsDate: 1
12603
+ }
12604
+ };
12605
+
12652
12606
  // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
12653
12607
  // (one of the certain letters followed by `o`)
12654
12608
  // - (\w)\1* matches any sequences of the same letter
@@ -12659,14 +12613,15 @@ function throwProtectedError(token, format, input) {
12659
12613
  // If there is no matching single quote
12660
12614
  // then the sequence will continue until the end of the string.
12661
12615
  // - . matches any single character unmatched by previous parts of the RegExps
12616
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
12662
12617
 
12663
- var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also
12618
+ // This RegExp catches symbols escaped by quotes, and also
12664
12619
  // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
12665
-
12666
12620
  var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
12667
12621
  var escapedStringRegExp = /^'([^]*?)'?$/;
12668
12622
  var doubleQuoteRegExp = /''/g;
12669
12623
  var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12624
+
12670
12625
  /**
12671
12626
  * @name format
12672
12627
  * @category Common Helpers
@@ -12676,7 +12631,7 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12676
12631
  * Return the formatted date string in the given format. The result may vary by locale.
12677
12632
  *
12678
12633
  * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
12679
- * > See: https://git.io/fxCyr
12634
+ * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12680
12635
  *
12681
12636
  * The characters wrapped between two single quotes characters (') are escaped.
12682
12637
  * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
@@ -12755,32 +12710,34 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12755
12710
  * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
12756
12711
  * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
12757
12712
  * | | EEEEE | M, T, W, T, F, S, S | |
12758
- * | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |
12713
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
12759
12714
  * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
12760
12715
  * | | io | 1st, 2nd, ..., 7th | 7 |
12761
12716
  * | | ii | 01, 02, ..., 07 | 7 |
12762
12717
  * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
12763
12718
  * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
12764
12719
  * | | iiiii | M, T, W, T, F, S, S | 7 |
12765
- * | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 |
12720
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
12766
12721
  * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
12767
12722
  * | | eo | 2nd, 3rd, ..., 1st | 7 |
12768
12723
  * | | ee | 02, 03, ..., 01 | |
12769
12724
  * | | eee | Mon, Tue, Wed, ..., Sun | |
12770
12725
  * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
12771
12726
  * | | eeeee | M, T, W, T, F, S, S | |
12772
- * | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |
12727
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
12773
12728
  * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
12774
12729
  * | | co | 2nd, 3rd, ..., 1st | 7 |
12775
12730
  * | | cc | 02, 03, ..., 01 | |
12776
12731
  * | | ccc | Mon, Tue, Wed, ..., Sun | |
12777
12732
  * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
12778
12733
  * | | ccccc | M, T, W, T, F, S, S | |
12779
- * | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |
12780
- * | AM, PM | a..aaa | AM, PM | |
12734
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
12735
+ * | AM, PM | a..aa | AM, PM | |
12736
+ * | | aaa | am, pm | |
12781
12737
  * | | aaaa | a.m., p.m. | 2 |
12782
12738
  * | | aaaaa | a, p | |
12783
- * | AM, PM, noon, midnight | b..bbb | AM, PM, noon, midnight | |
12739
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
12740
+ * | | bbb | am, pm, noon, midnight | |
12784
12741
  * | | bbbb | a.m., p.m., noon, midnight | 2 |
12785
12742
  * | | bbbbb | a, p, n, mi | |
12786
12743
  * | Flexible day period | B..BBB | at night, in the morning, ... | |
@@ -12806,7 +12763,7 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12806
12763
  * | | ss | 00, 01, ..., 59 | |
12807
12764
  * | Fraction of second | S | 0, 1, ..., 9 | |
12808
12765
  * | | SS | 00, 01, ..., 99 | |
12809
- * | | SSS | 000, 0001, ..., 999 | |
12766
+ * | | SSS | 000, 001, ..., 999 | |
12810
12767
  * | | SSSS | ... | 3 |
12811
12768
  * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
12812
12769
  * | | XX | -0800, +0530, Z | |
@@ -12826,18 +12783,18 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12826
12783
  * | | tt | ... | 3,7 |
12827
12784
  * | Milliseconds timestamp | T | 512969520900 | 7 |
12828
12785
  * | | TT | ... | 3,7 |
12829
- * | Long localized date | P | 05/29/1453 | 7 |
12830
- * | | PP | May 29, 1453 | 7 |
12831
- * | | PPP | May 29th, 1453 | 7 |
12832
- * | | PPPP | Sunday, May 29th, 1453 | 2,7 |
12786
+ * | Long localized date | P | 04/29/1453 | 7 |
12787
+ * | | PP | Apr 29, 1453 | 7 |
12788
+ * | | PPP | April 29th, 1453 | 7 |
12789
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
12833
12790
  * | Long localized time | p | 12:00 AM | 7 |
12834
12791
  * | | pp | 12:00:00 AM | 7 |
12835
12792
  * | | ppp | 12:00:00 AM GMT+2 | 7 |
12836
12793
  * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
12837
- * | Combination of date and time | Pp | 05/29/1453, 12:00 AM | 7 |
12838
- * | | PPpp | May 29, 1453, 12:00:00 AM | 7 |
12839
- * | | PPPppp | May 29th, 1453 at ... | 7 |
12840
- * | | PPPPpppp| Sunday, May 29th, 1453 at ... | 2,7 |
12794
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
12795
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
12796
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
12797
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
12841
12798
  * Notes:
12842
12799
  * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
12843
12800
  * are the same as "stand-alone" units, but are different in some languages.
@@ -12910,30 +12867,10 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12910
12867
  * - `p`: long localized time
12911
12868
  *
12912
12869
  * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
12913
- * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://git.io/fxCyr
12914
- *
12915
- * 9. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.
12916
- * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://git.io/fxCyr
12917
- *
12918
- * ### v2.0.0 breaking changes:
12919
- *
12920
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
12921
- *
12922
- * - The second argument is now required for the sake of explicitness.
12923
- *
12924
- * ```javascript
12925
- * // Before v2.0.0
12926
- * format(new Date(2016, 0, 1))
12870
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12927
12871
  *
12928
- * // v2.0.0 onward
12929
- * format(new Date(2016, 0, 1), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")
12930
- * ```
12931
- *
12932
- * - New format string API for `format` function
12933
- * which is based on [Unicode Technical Standard #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).
12934
- * See [this post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.
12935
- *
12936
- * - Characters are now escaped using single quote symbols (`'`) instead of square brackets.
12872
+ * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
12873
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12937
12874
  *
12938
12875
  * @param {Date|Number} date - the original date
12939
12876
  * @param {String} format - the string of tokens
@@ -12942,9 +12879,9 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12942
12879
  * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
12943
12880
  * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
12944
12881
  * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
12945
- * see: https://git.io/fxCyr
12882
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12946
12883
  * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
12947
- * see: https://git.io/fxCyr
12884
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12948
12885
  * @returns {String} the formatted date string
12949
12886
  * @throws {TypeError} 2 arguments required
12950
12887
  * @throws {RangeError} `date` must not be Invalid Date
@@ -12952,76 +12889,76 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12952
12889
  * @throws {RangeError} `options.locale` must contain `formatLong` property
12953
12890
  * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
12954
12891
  * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
12955
- * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
12956
- * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
12957
- * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://git.io/fxCyr
12958
- * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://git.io/fxCyr
12892
+ * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12893
+ * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12894
+ * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12895
+ * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12959
12896
  * @throws {RangeError} format string contains an unescaped latin alphabet character
12960
12897
  *
12961
12898
  * @example
12962
12899
  * // Represent 11 February 2014 in middle-endian format:
12963
- * var result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
12900
+ * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
12964
12901
  * //=> '02/11/2014'
12965
12902
  *
12966
12903
  * @example
12967
12904
  * // Represent 2 July 2014 in Esperanto:
12968
12905
  * import { eoLocale } from 'date-fns/locale/eo'
12969
- * var result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
12906
+ * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
12970
12907
  * locale: eoLocale
12971
12908
  * })
12972
12909
  * //=> '2-a de julio 2014'
12973
12910
  *
12974
12911
  * @example
12975
12912
  * // Escape string by single quote characters:
12976
- * var result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
12913
+ * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
12977
12914
  * //=> "3 o'clock"
12978
12915
  */
12979
12916
 
12980
- function format$1(dirtyDate, dirtyFormatStr, dirtyOptions) {
12917
+ function format(dirtyDate, dirtyFormatStr, options) {
12918
+ var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;
12981
12919
  requiredArgs(2, arguments);
12982
12920
  var formatStr = String(dirtyFormatStr);
12983
- var options = dirtyOptions || {};
12984
- var locale$1 = options.locale || locale;
12985
- var localeFirstWeekContainsDate = locale$1.options && locale$1.options.firstWeekContainsDate;
12986
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
12987
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
12921
+ var defaultOptions = getDefaultOptions();
12922
+ var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : locale$4;
12923
+ var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1);
12988
12924
 
12925
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
12989
12926
  if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
12990
12927
  throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
12991
12928
  }
12992
- var localeWeekStartsOn = locale$1.options && locale$1.options.weekStartsOn;
12993
- var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
12994
- var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
12929
+ var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0);
12995
12930
 
12931
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
12996
12932
  if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
12997
12933
  throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
12998
12934
  }
12999
- if (!locale$1.localize) {
12935
+ if (!locale.localize) {
13000
12936
  throw new RangeError('locale must contain localize property');
13001
12937
  }
13002
- if (!locale$1.formatLong) {
12938
+ if (!locale.formatLong) {
13003
12939
  throw new RangeError('locale must contain formatLong property');
13004
12940
  }
13005
12941
  var originalDate = toDate(dirtyDate);
13006
12942
  if (!isValid(originalDate)) {
13007
12943
  throw new RangeError('Invalid time value');
13008
- } // Convert the date in system timezone to the same date in UTC+00:00 timezone.
12944
+ }
12945
+
12946
+ // Convert the date in system timezone to the same date in UTC+00:00 timezone.
13009
12947
  // This ensures that when UTC functions will be implemented, locales will be compatible with them.
13010
12948
  // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
13011
-
13012
12949
  var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
13013
12950
  var utcDate = subMilliseconds(originalDate, timezoneOffset);
13014
12951
  var formatterOptions = {
13015
12952
  firstWeekContainsDate: firstWeekContainsDate,
13016
12953
  weekStartsOn: weekStartsOn,
13017
- locale: locale$1,
12954
+ locale: locale,
13018
12955
  _originalDate: originalDate
13019
12956
  };
13020
12957
  var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
13021
12958
  var firstCharacter = substring[0];
13022
12959
  if (firstCharacter === 'p' || firstCharacter === 'P') {
13023
12960
  var longFormatter = longFormatters[firstCharacter];
13024
- return longFormatter(substring, locale$1.formatLong, formatterOptions);
12961
+ return longFormatter(substring, locale.formatLong);
13025
12962
  }
13026
12963
  return substring;
13027
12964
  }).join('').match(formattingTokensRegExp).map(function (substring) {
@@ -13035,13 +12972,13 @@ function format$1(dirtyDate, dirtyFormatStr, dirtyOptions) {
13035
12972
  }
13036
12973
  var formatter = formatters[firstCharacter];
13037
12974
  if (formatter) {
13038
- if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
13039
- throwProtectedError(substring, dirtyFormatStr, dirtyDate);
12975
+ if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
12976
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
13040
12977
  }
13041
- if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
13042
- throwProtectedError(substring, dirtyFormatStr, dirtyDate);
12978
+ if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
12979
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
13043
12980
  }
13044
- return formatter(utcDate, substring, locale$1.localize, formatterOptions);
12981
+ return formatter(utcDate, substring, locale.localize, formatterOptions);
13045
12982
  }
13046
12983
  if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
13047
12984
  throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
@@ -13051,22 +12988,28 @@ function format$1(dirtyDate, dirtyFormatStr, dirtyOptions) {
13051
12988
  return result;
13052
12989
  }
13053
12990
  function cleanEscapedString(input) {
13054
- return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
12991
+ var matched = input.match(escapedStringRegExp);
12992
+ if (!matched) {
12993
+ return input;
12994
+ }
12995
+ return matched[1].replace(doubleQuoteRegExp, "'");
13055
12996
  }
13056
12997
 
13057
- function convertToFP(fn, arity, a) {
13058
- a = a || [];
12998
+ function convertToFP(fn, arity) {
12999
+ var a = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
13059
13000
  if (a.length >= arity) {
13060
13001
  return fn.apply(null, a.slice(0, arity).reverse());
13061
13002
  }
13062
13003
  return function () {
13063
- var args = Array.prototype.slice.call(arguments);
13004
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
13005
+ args[_key] = arguments[_key];
13006
+ }
13064
13007
  return convertToFP(fn, arity, a.concat(args));
13065
13008
  };
13066
13009
  }
13067
13010
 
13068
- // This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
13069
- var format = convertToFP(format$1, 2);
13011
+ // This file is generated automatically by `scripts/build/fp.ts`. Please, don't change it.
13012
+ var formatTime = convertToFP(format, 2);
13070
13013
 
13071
13014
  var Wrapper = index$a(reactNative.View)(function () {
13072
13015
  return {
@@ -13486,7 +13429,7 @@ var CalendarRange = function CalendarRange(_ref) {
13486
13429
  return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$7, {
13487
13430
  testID: testID
13488
13431
  }, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__namespace.default.createElement(ContentNavigator, {
13489
- value: !useMonthPicker ? format('MMMM yyyy', visibleDate) : /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
13432
+ value: !useMonthPicker ? formatTime('MMMM yyyy', visibleDate) : /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
13490
13433
  testID: "calendar-month-picker",
13491
13434
  onPress: function onPress() {
13492
13435
  onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(!monthPickerVisible);
@@ -13502,7 +13445,7 @@ var CalendarRange = function CalendarRange(_ref) {
13502
13445
  textAlign: 'center',
13503
13446
  marginRight: theme.__hd__.calendar.space.headerMarginRight
13504
13447
  }
13505
- }, format('MMMM yyyy', visibleDate)), /*#__PURE__*/React__namespace.default.createElement(Icon, {
13448
+ }, formatTime('MMMM yyyy', visibleDate)), /*#__PURE__*/React__namespace.default.createElement(Icon, {
13506
13449
  icon: monthPickerVisible ? 'arrow-up' : 'arrow-down',
13507
13450
  size: "small"
13508
13451
  }))),
@@ -13653,7 +13596,7 @@ var Calendar = function Calendar(_ref) {
13653
13596
  return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$7, {
13654
13597
  testID: testID
13655
13598
  }, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__namespace.default.createElement(ContentNavigator, {
13656
- value: !useMonthPicker ? format('MMMM yyyy', visibleDate) : /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
13599
+ value: !useMonthPicker ? formatTime('MMMM yyyy', visibleDate) : /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
13657
13600
  testID: "calendar-month-picker",
13658
13601
  onPress: function onPress() {
13659
13602
  onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(!monthPickerVisible);
@@ -13669,7 +13612,7 @@ var Calendar = function Calendar(_ref) {
13669
13612
  textAlign: 'center',
13670
13613
  marginRight: theme.__hd__.calendar.space.headerMarginRight
13671
13614
  }
13672
- }, format('MMMM yyyy', visibleDate)), /*#__PURE__*/React__namespace.default.createElement(Icon, {
13615
+ }, formatTime('MMMM yyyy', visibleDate)), /*#__PURE__*/React__namespace.default.createElement(Icon, {
13673
13616
  icon: monthPickerVisible ? 'arrow-up' : 'arrow-down',
13674
13617
  size: "small"
13675
13618
  }))),
@@ -14183,7 +14126,7 @@ var StyledPageControlWrapper = index$a(reactNative.View)(function (_ref7) {
14183
14126
  });
14184
14127
 
14185
14128
  function isCarouselImageProps(image) {
14186
- return _typeof(image) === 'object';
14129
+ return _typeof$1(image) === 'object';
14187
14130
  }
14188
14131
  var CarouselItem = function CarouselItem(_ref) {
14189
14132
  var width = _ref.width,
@@ -15104,6 +15047,82 @@ var useCalculateDate = function useCalculateDate(_ref) {
15104
15047
  }, [maxDate, minDate, value]);
15105
15048
  };
15106
15049
 
15050
+ var locale$3 = {
15051
+ lang: 'en-AU',
15052
+ dateTimeFormats: {
15053
+ fullDate: 'dd/MM/yyyy'
15054
+ }
15055
+ };
15056
+
15057
+ var LocaleContext = /*#__PURE__*/React.createContext(locale$3);
15058
+
15059
+ var useLocale = function useLocale() {
15060
+ var context = React.useContext(LocaleContext);
15061
+ if (!context) return locale$3;
15062
+ return context;
15063
+ };
15064
+ var useDateTimeFormat = function useDateTimeFormat() {
15065
+ var _useLocale = useLocale(),
15066
+ dateTimeFormats = _useLocale.dateTimeFormats;
15067
+ var localizeDateTime = React.useCallback(function (key) {
15068
+ return dateTimeFormats === null || dateTimeFormats === void 0 ? void 0 : dateTimeFormats[key];
15069
+ }, [dateTimeFormats]);
15070
+ return {
15071
+ localizeDateTime: localizeDateTime
15072
+ };
15073
+ };
15074
+
15075
+ var locale$2 = {
15076
+ lang: 'en-CA',
15077
+ dateTimeFormats: {
15078
+ fullDate: 'MMM dd, yyyy'
15079
+ }
15080
+ };
15081
+
15082
+ var locales = {
15083
+ 'en-AU': locale$3,
15084
+ 'en-CA': locale$2
15085
+ };
15086
+
15087
+ // Function to get the date format based on the displayFormat and locale,
15088
+ // if no displayFormat or locale is provided, use the default fullDate format
15089
+ var getDateFormat = function getDateFormat(_ref) {
15090
+ var displayFormat = _ref.displayFormat,
15091
+ locale = _ref.locale,
15092
+ localizeDateTime = _ref.localizeDateTime;
15093
+ // Prioritise displayFormat
15094
+ if (displayFormat) {
15095
+ return displayFormat;
15096
+ }
15097
+ // If locale is provided, find the corresponding locale in the locales object
15098
+ if (locale && locales[locale]) {
15099
+ var localeObject = locales[locale];
15100
+ if (localeObject) {
15101
+ return localeObject.dateTimeFormats.fullDate;
15102
+ }
15103
+ }
15104
+ // If no displayFormat or locale is provided, use the default fullDate format
15105
+ return localizeDateTime('fullDate');
15106
+ };
15107
+
15108
+ var useFormatDate = function useFormatDate(_ref) {
15109
+ var displayFormat = _ref.displayFormat,
15110
+ locale = _ref.locale,
15111
+ value = _ref.value;
15112
+ var _useDateTimeFormat = useDateTimeFormat(),
15113
+ localizeDateTime = _useDateTimeFormat.localizeDateTime;
15114
+ var format = getDateFormat({
15115
+ displayFormat: displayFormat,
15116
+ locale: locale,
15117
+ localizeDateTime: localizeDateTime
15118
+ });
15119
+ var displayValue = value ? formatTime(format, value) : '';
15120
+ return {
15121
+ displayValue: displayValue,
15122
+ format: format
15123
+ };
15124
+ };
15125
+
15107
15126
  var DatePickerAndroid = function DatePickerAndroid(_ref) {
15108
15127
  var value = _ref.value,
15109
15128
  minDate = _ref.minDate,
@@ -15111,8 +15130,7 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
15111
15130
  label = _ref.label,
15112
15131
  placeholder = _ref.placeholder,
15113
15132
  _onChange = _ref.onChange,
15114
- _ref$displayFormat = _ref.displayFormat,
15115
- displayFormat = _ref$displayFormat === void 0 ? 'dd/MM/yyyy' : _ref$displayFormat,
15133
+ displayFormat = _ref.displayFormat,
15116
15134
  _ref$disabled = _ref.disabled,
15117
15135
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
15118
15136
  required = _ref.required,
@@ -15121,19 +15139,27 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
15121
15139
  style = _ref.style,
15122
15140
  testID = _ref.testID,
15123
15141
  _ref$variant = _ref.variant,
15124
- variant = _ref$variant === void 0 ? 'default' : _ref$variant;
15142
+ variant = _ref$variant === void 0 ? 'default' : _ref$variant,
15143
+ renderSelectedValue = _ref.renderSelectedValue,
15144
+ locale = _ref.locale;
15125
15145
  var _useState = React.useState(false),
15126
15146
  _useState2 = _slicedToArray(_useState, 2),
15127
15147
  open = _useState2[0],
15128
15148
  setOpen = _useState2[1];
15129
- var displayValue = value ? format(displayFormat, value) : '';
15130
- var pickerInitValue = value || new Date();
15149
+ var _useFormatDate = useFormatDate({
15150
+ displayFormat: displayFormat,
15151
+ locale: locale,
15152
+ value: value
15153
+ }),
15154
+ displayValue = _useFormatDate.displayValue,
15155
+ format = _useFormatDate.format;
15131
15156
  useCalculateDate({
15132
15157
  minDate: minDate,
15133
15158
  maxDate: maxDate,
15134
15159
  onChange: _onChange,
15135
15160
  value: value
15136
15161
  });
15162
+ var pickerInitValue = value || new Date();
15137
15163
  var theme = useTheme();
15138
15164
  return /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
15139
15165
  onPress: function onPress() {
@@ -15147,13 +15173,19 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
15147
15173
  label: label,
15148
15174
  value: displayValue,
15149
15175
  suffix: "calendar-dates-outlined",
15150
- placeholder: placeholder || displayFormat,
15176
+ placeholder: placeholder || format,
15151
15177
  disabled: disabled,
15152
15178
  error: error,
15153
15179
  required: required,
15154
15180
  helpText: helpText,
15155
15181
  style: style,
15156
- testID: testID
15182
+ testID: testID,
15183
+ renderInputValue: renderSelectedValue !== undefined && !!value ? function (props) {
15184
+ return renderSelectedValue({
15185
+ date: value,
15186
+ formattedDateString: displayValue
15187
+ }, props);
15188
+ } : undefined
15157
15189
  })), open && variant === 'month-year' ? /*#__PURE__*/React__namespace.default.createElement(reactNativeMonthYearPicker.MonthYearPickerDialogueAndroid, {
15158
15190
  themeVariant: theme.themeMode === 'dark' ? 'dark' : 'light',
15159
15191
  value: value,
@@ -15233,8 +15265,7 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
15233
15265
  placeholder = _ref2.placeholder,
15234
15266
  onChange = _ref2.onChange,
15235
15267
  confirmLabel = _ref2.confirmLabel,
15236
- _ref2$displayFormat = _ref2.displayFormat,
15237
- displayFormat = _ref2$displayFormat === void 0 ? 'dd/MM/yyyy' : _ref2$displayFormat,
15268
+ displayFormat = _ref2.displayFormat,
15238
15269
  _ref2$disabled = _ref2.disabled,
15239
15270
  disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
15240
15271
  required = _ref2.required,
@@ -15245,7 +15276,9 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
15245
15276
  monthPickerConfirmLabel = _ref2.monthPickerConfirmLabel,
15246
15277
  monthPickerCancelLabel = _ref2.monthPickerCancelLabel,
15247
15278
  _ref2$supportedOrient = _ref2.supportedOrientations,
15248
- supportedOrientations = _ref2$supportedOrient === void 0 ? ['portrait'] : _ref2$supportedOrient;
15279
+ supportedOrientations = _ref2$supportedOrient === void 0 ? ['portrait'] : _ref2$supportedOrient,
15280
+ renderSelectedValue = _ref2.renderSelectedValue,
15281
+ locale = _ref2.locale;
15249
15282
  var _useState5 = React.useState(false),
15250
15283
  _useState6 = _slicedToArray(_useState5, 2),
15251
15284
  open = _useState6[0],
@@ -15259,7 +15292,12 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
15259
15292
  _useState10 = _slicedToArray(_useState9, 2),
15260
15293
  selectingDate = _useState10[0],
15261
15294
  setSelectingDate = _useState10[1];
15262
- var displayValue = value ? format(displayFormat, value) : '';
15295
+ var _useFormatDate = useFormatDate({
15296
+ value: value,
15297
+ displayFormat: displayFormat,
15298
+ locale: locale
15299
+ }),
15300
+ displayValue = _useFormatDate.displayValue;
15263
15301
  useCalculateDate({
15264
15302
  minDate: minDate,
15265
15303
  maxDate: maxDate,
@@ -15284,7 +15322,13 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
15284
15322
  required: required,
15285
15323
  helpText: helpText,
15286
15324
  testID: testID,
15287
- style: style
15325
+ style: style,
15326
+ renderInputValue: renderSelectedValue !== undefined && !!value ? function (props) {
15327
+ return renderSelectedValue({
15328
+ date: value,
15329
+ formattedDateString: displayValue
15330
+ }, props);
15331
+ } : undefined
15288
15332
  })), /*#__PURE__*/React__namespace.default.createElement(BottomSheet$1, {
15289
15333
  open: open,
15290
15334
  onRequestClose: function onRequestClose() {
@@ -15330,8 +15374,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
15330
15374
  placeholder = _ref.placeholder,
15331
15375
  onChange = _ref.onChange,
15332
15376
  confirmLabel = _ref.confirmLabel,
15333
- _ref$displayFormat = _ref.displayFormat,
15334
- displayFormat = _ref$displayFormat === void 0 ? 'dd/MM/yyyy' : _ref$displayFormat,
15377
+ displayFormat = _ref.displayFormat,
15335
15378
  _ref$disabled = _ref.disabled,
15336
15379
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
15337
15380
  required = _ref.required,
@@ -15343,7 +15386,9 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
15343
15386
  supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta,
15344
15387
  _ref$variant = _ref.variant,
15345
15388
  variant = _ref$variant === void 0 ? 'default' : _ref$variant,
15346
- locale = _ref.locale;
15389
+ locale = _ref.locale,
15390
+ renderSelectedValue = _ref.renderSelectedValue;
15391
+ var theme = useTheme();
15347
15392
  var _useState = React.useState(getDateValue(value || new Date(), minDate, maxDate)),
15348
15393
  _useState2 = _slicedToArray(_useState, 2),
15349
15394
  selectingDate = _useState2[0],
@@ -15352,8 +15397,15 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
15352
15397
  _useState4 = _slicedToArray(_useState3, 2),
15353
15398
  open = _useState4[0],
15354
15399
  setOpen = _useState4[1];
15355
- var displayValue = value ? format(displayFormat, value) : '';
15356
- var theme = useTheme();
15400
+ var _useLocale = useLocale(),
15401
+ defaultLocale = _useLocale.lang;
15402
+ var _useFormatDate = useFormatDate({
15403
+ displayFormat: displayFormat,
15404
+ locale: locale,
15405
+ value: value
15406
+ }),
15407
+ displayValue = _useFormatDate.displayValue,
15408
+ format = _useFormatDate.format;
15357
15409
  useCalculateDate({
15358
15410
  minDate: minDate,
15359
15411
  maxDate: maxDate,
@@ -15372,13 +15424,19 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
15372
15424
  label: label,
15373
15425
  value: displayValue,
15374
15426
  suffix: "calendar-dates-outlined",
15375
- placeholder: placeholder || displayFormat,
15427
+ placeholder: placeholder || format,
15376
15428
  disabled: disabled,
15377
15429
  error: error,
15378
15430
  required: required,
15379
15431
  helpText: helpText,
15380
15432
  testID: testID,
15381
- style: style
15433
+ style: style,
15434
+ renderInputValue: renderSelectedValue !== undefined && !!value ? function (props) {
15435
+ return renderSelectedValue({
15436
+ date: value,
15437
+ formattedDateString: displayValue
15438
+ }, props);
15439
+ } : undefined
15382
15440
  })), /*#__PURE__*/React__namespace.default.createElement(BottomSheet$1, {
15383
15441
  open: open,
15384
15442
  onRequestClose: function onRequestClose() {
@@ -15398,7 +15456,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
15398
15456
  supportedOrientations: supportedOrientations
15399
15457
  }, /*#__PURE__*/React__namespace.default.createElement(StyledPickerWrapper$1, null, variant === 'month-year' ? /*#__PURE__*/React__namespace.default.createElement(reactNativeMonthYearPicker.MonthYearPickerViewIOS, {
15400
15458
  value: value,
15401
- locale: locale,
15459
+ locale: locale || defaultLocale,
15402
15460
  minimumDate: minDate,
15403
15461
  textColor: theme.colors.onDefaultGlobalSurface,
15404
15462
  maximumDate: maxDate,
@@ -15411,7 +15469,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
15411
15469
  flex: 1
15412
15470
  }
15413
15471
  }) : null, variant === 'default' ? /*#__PURE__*/React__namespace.default.createElement(DateTimePicker__default.default, {
15414
- locale: locale,
15472
+ locale: locale || defaultLocale,
15415
15473
  testID: "datePickerIOS",
15416
15474
  value: selectingDate,
15417
15475
  minimumDate: minDate,
@@ -17908,12 +17966,307 @@ var Toast = {
17908
17966
  useToast: useToast
17909
17967
  };
17910
17968
 
17969
+ /**
17970
+ * @name setDefaultOptions
17971
+ * @category Common Helpers
17972
+ * @summary Set default options including locale.
17973
+ * @pure false
17974
+ *
17975
+ * @description
17976
+ * Sets the defaults for
17977
+ * `options.locale`, `options.weekStartsOn` and `options.firstWeekContainsDate`
17978
+ * arguments for all functions.
17979
+ *
17980
+ * @param {Object} newOptions - an object with options.
17981
+ * @param {Locale} [newOptions.locale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
17982
+ * @param {0|1|2|3|4|5|6} [newOptions.weekStartsOn] - the index of the first day of the week (0 - Sunday)
17983
+ * @param {1|2|3|4|5|6|7} [newOptions.firstWeekContainsDate] - the day of January, which is always in the first week of the year
17984
+ * @throws {TypeError} 1 argument required
17985
+ *
17986
+ * @example
17987
+ * // Set global locale:
17988
+ * import { es } from 'date-fns/locale'
17989
+ * setDefaultOptions({ locale: es })
17990
+ * const result = format(new Date(2014, 8, 2), 'PPPP')
17991
+ * //=> 'martes, 2 de septiembre de 2014'
17992
+ *
17993
+ * @example
17994
+ * // Start of the week for 2 September 2014:
17995
+ * const result = startOfWeek(new Date(2014, 8, 2))
17996
+ * //=> Sun Aug 31 2014 00:00:00
17997
+ *
17998
+ * @example
17999
+ * // Start of the week for 2 September 2014,
18000
+ * // when we set that week starts on Monday by default:
18001
+ * setDefaultOptions({ weekStartsOn: 1 })
18002
+ * const result = startOfWeek(new Date(2014, 8, 2))
18003
+ * //=> Mon Sep 01 2014 00:00:00
18004
+ *
18005
+ * @example
18006
+ * // Manually set options take priority over default options:
18007
+ * setDefaultOptions({ weekStartsOn: 1 })
18008
+ * const result = startOfWeek(new Date(2014, 8, 2), { weekStartsOn: 0 })
18009
+ * //=> Sun Aug 31 2014 00:00:00
18010
+ *
18011
+ * @example
18012
+ * // Remove the option by setting it to `undefined`:
18013
+ * setDefaultOptions({ weekStartsOn: 1 })
18014
+ * setDefaultOptions({ weekStartsOn: undefined })
18015
+ * const result = startOfWeek(new Date(2014, 8, 2))
18016
+ * //=> Sun Aug 31 2014 00:00:00
18017
+ */
18018
+ function setDefaultOptions(newOptions) {
18019
+ requiredArgs(1, arguments);
18020
+ var result = {};
18021
+ var defaultOptions = getDefaultOptions();
18022
+ for (var property in defaultOptions) {
18023
+ if (Object.prototype.hasOwnProperty.call(defaultOptions, property)) {
18024
+ result[property] = defaultOptions[property];
18025
+ }
18026
+ }
18027
+ for (var _property in newOptions) {
18028
+ if (Object.prototype.hasOwnProperty.call(newOptions, _property)) {
18029
+ if (newOptions[_property] === undefined) {
18030
+ delete result[_property];
18031
+ } else {
18032
+ result[_property] = newOptions[_property];
18033
+ }
18034
+ }
18035
+ }
18036
+ setDefaultOptions$1(result);
18037
+ }
18038
+
18039
+ var dateFormats$1 = {
18040
+ full: 'EEEE, d MMMM yyyy',
18041
+ "long": 'd MMMM yyyy',
18042
+ medium: 'd MMM yyyy',
18043
+ "short": 'dd/MM/yyyy'
18044
+ };
18045
+ var timeFormats$1 = {
18046
+ full: 'h:mm:ss a zzzz',
18047
+ "long": 'h:mm:ss a z',
18048
+ medium: 'h:mm:ss a',
18049
+ "short": 'h:mm a'
18050
+ };
18051
+ var dateTimeFormats$1 = {
18052
+ full: "{{date}} 'at' {{time}}",
18053
+ "long": "{{date}} 'at' {{time}}",
18054
+ medium: '{{date}}, {{time}}',
18055
+ "short": '{{date}}, {{time}}'
18056
+ };
18057
+ var formatLong$1 = {
18058
+ date: buildFormatLongFn({
18059
+ formats: dateFormats$1,
18060
+ defaultWidth: 'full'
18061
+ }),
18062
+ time: buildFormatLongFn({
18063
+ formats: timeFormats$1,
18064
+ defaultWidth: 'full'
18065
+ }),
18066
+ dateTime: buildFormatLongFn({
18067
+ formats: dateTimeFormats$1,
18068
+ defaultWidth: 'full'
18069
+ })
18070
+ };
18071
+
18072
+ /**
18073
+ * @type {Locale}
18074
+ * @category Locales
18075
+ * @summary English locale (Australia).
18076
+ * @language English
18077
+ * @iso-639-2 eng
18078
+ * @author Julien Malige [@JulienMalige]{@link https://github.com/JulienMalige}
18079
+ */
18080
+ var locale$1 = {
18081
+ code: 'en-AU',
18082
+ formatDistance: formatDistance$1,
18083
+ formatLong: formatLong$1,
18084
+ formatRelative: formatRelative,
18085
+ localize: localize,
18086
+ match: match,
18087
+ options: {
18088
+ weekStartsOn: 1 /* Monday */,
18089
+ firstWeekContainsDate: 4
18090
+ }
18091
+ };
18092
+
18093
+ var formatDistanceLocale = {
18094
+ lessThanXSeconds: {
18095
+ one: 'less than a second',
18096
+ other: 'less than {{count}} seconds'
18097
+ },
18098
+ xSeconds: {
18099
+ one: 'a second',
18100
+ other: '{{count}} seconds'
18101
+ },
18102
+ halfAMinute: 'half a minute',
18103
+ lessThanXMinutes: {
18104
+ one: 'less than a minute',
18105
+ other: 'less than {{count}} minutes'
18106
+ },
18107
+ xMinutes: {
18108
+ one: 'a minute',
18109
+ other: '{{count}} minutes'
18110
+ },
18111
+ aboutXHours: {
18112
+ one: 'about an hour',
18113
+ other: 'about {{count}} hours'
18114
+ },
18115
+ xHours: {
18116
+ one: 'an hour',
18117
+ other: '{{count}} hours'
18118
+ },
18119
+ xDays: {
18120
+ one: 'a day',
18121
+ other: '{{count}} days'
18122
+ },
18123
+ aboutXWeeks: {
18124
+ one: 'about a week',
18125
+ other: 'about {{count}} weeks'
18126
+ },
18127
+ xWeeks: {
18128
+ one: 'a week',
18129
+ other: '{{count}} weeks'
18130
+ },
18131
+ aboutXMonths: {
18132
+ one: 'about a month',
18133
+ other: 'about {{count}} months'
18134
+ },
18135
+ xMonths: {
18136
+ one: 'a month',
18137
+ other: '{{count}} months'
18138
+ },
18139
+ aboutXYears: {
18140
+ one: 'about a year',
18141
+ other: 'about {{count}} years'
18142
+ },
18143
+ xYears: {
18144
+ one: 'a year',
18145
+ other: '{{count}} years'
18146
+ },
18147
+ overXYears: {
18148
+ one: 'over a year',
18149
+ other: 'over {{count}} years'
18150
+ },
18151
+ almostXYears: {
18152
+ one: 'almost a year',
18153
+ other: 'almost {{count}} years'
18154
+ }
18155
+ };
18156
+ var formatDistance = function formatDistance(token, count, options) {
18157
+ var result;
18158
+ var tokenValue = formatDistanceLocale[token];
18159
+ if (typeof tokenValue === 'string') {
18160
+ result = tokenValue;
18161
+ } else if (count === 1) {
18162
+ result = tokenValue.one;
18163
+ } else {
18164
+ result = tokenValue.other.replace('{{count}}', count.toString());
18165
+ }
18166
+ if (options !== null && options !== void 0 && options.addSuffix) {
18167
+ if (options.comparison && options.comparison > 0) {
18168
+ return 'in ' + result;
18169
+ } else {
18170
+ return result + ' ago';
18171
+ }
18172
+ }
18173
+ return result;
18174
+ };
18175
+
18176
+ var dateFormats = {
18177
+ full: 'EEEE, MMMM do, yyyy',
18178
+ "long": 'MMMM do, yyyy',
18179
+ medium: 'MMM d, yyyy',
18180
+ "short": 'yyyy-MM-dd'
18181
+ };
18182
+ var timeFormats = {
18183
+ full: 'h:mm:ss a zzzz',
18184
+ "long": 'h:mm:ss a z',
18185
+ medium: 'h:mm:ss a',
18186
+ "short": 'h:mm a'
18187
+ };
18188
+ var dateTimeFormats = {
18189
+ full: "{{date}} 'at' {{time}}",
18190
+ "long": "{{date}} 'at' {{time}}",
18191
+ medium: '{{date}}, {{time}}',
18192
+ "short": '{{date}}, {{time}}'
18193
+ };
18194
+ var formatLong = {
18195
+ date: buildFormatLongFn({
18196
+ formats: dateFormats,
18197
+ defaultWidth: 'full'
18198
+ }),
18199
+ time: buildFormatLongFn({
18200
+ formats: timeFormats,
18201
+ defaultWidth: 'full'
18202
+ }),
18203
+ dateTime: buildFormatLongFn({
18204
+ formats: dateTimeFormats,
18205
+ defaultWidth: 'full'
18206
+ })
18207
+ };
18208
+
18209
+ /**
18210
+ * @type {Locale}
18211
+ * @category Locales
18212
+ * @summary English locale (Canada).
18213
+ * @language English
18214
+ * @iso-639-2 eng
18215
+ * @author Mark Owsiak [@markowsiak]{@link https://github.com/markowsiak}
18216
+ * @author Marco Imperatore [@mimperatore]{@link https://github.com/mimperatore}
18217
+ */
18218
+ var locale = {
18219
+ code: 'en-CA',
18220
+ formatDistance: formatDistance,
18221
+ formatLong: formatLong,
18222
+ formatRelative: formatRelative,
18223
+ localize: localize,
18224
+ match: match,
18225
+ options: {
18226
+ weekStartsOn: 0 /* Sunday */,
18227
+ firstWeekContainsDate: 1
18228
+ }
18229
+ };
18230
+
18231
+ var Locales = {
18232
+ 'en-AU': locale$1,
18233
+ 'en-CA': locale
18234
+ };
18235
+ function getDateFnsLocale(locale) {
18236
+ var fallbackLocale = Locales['en-AU'];
18237
+ return Locales[locale] || fallbackLocale;
18238
+ }
18239
+
18240
+ var LocaleProvider = function LocaleProvider(props) {
18241
+ var locale = props.locale,
18242
+ children = props.children;
18243
+ var code = (locale === null || locale === void 0 ? void 0 : locale['lang']) || 'en-AU';
18244
+ // setDefaultOptions here instead of inside useEffect for first rendering
18245
+ setDefaultOptions({
18246
+ locale: getDateFnsLocale(code)
18247
+ });
18248
+ React.useEffect(function () {
18249
+ return function () {
18250
+ return setDefaultOptions({
18251
+ locale: getDateFnsLocale('en-AU')
18252
+ });
18253
+ };
18254
+ }, []);
18255
+ return /*#__PURE__*/React__namespace.default.createElement(LocaleContext.Provider, {
18256
+ value: locale
18257
+ }, children);
18258
+ };
18259
+
17911
18260
  var HeroDesignProvider = function HeroDesignProvider(_ref) {
17912
18261
  var theme = _ref.theme,
18262
+ _ref$locale = _ref.locale,
18263
+ locale = _ref$locale === void 0 ? locale$3 : _ref$locale,
17913
18264
  children = _ref.children;
17914
- return /*#__PURE__*/React__namespace.default.createElement(ThemeProvider, {
18265
+ return /*#__PURE__*/React__namespace.default.createElement(LocaleProvider, {
18266
+ locale: locale
18267
+ }, /*#__PURE__*/React__namespace.default.createElement(ThemeProvider, {
17915
18268
  theme: theme
17916
- }, /*#__PURE__*/React__namespace.default.createElement(Toast.Provider, null, /*#__PURE__*/React__namespace.default.createElement(Portal$1.Provider, null, children)));
18269
+ }, /*#__PURE__*/React__namespace.default.createElement(Toast.Provider, null, /*#__PURE__*/React__namespace.default.createElement(Portal$1.Provider, null, children))));
17917
18270
  };
17918
18271
 
17919
18272
  var StyledContainer$3 = index$a(reactNative.View)(function (_ref) {
@@ -19420,7 +19773,7 @@ var deepCompareValue = function deepCompareValue(a, b) {
19420
19773
  // If either is null or undefined (but they are not strictly equal), return false
19421
19774
  if (a == null || b == null) return false;
19422
19775
  // If types don't match, they can't be equal
19423
- if (_typeof(a) !== _typeof(b)) return false;
19776
+ if (_typeof$1(a) !== _typeof$1(b)) return false;
19424
19777
  // Handle array comparison
19425
19778
  if (Array.isArray(a) && Array.isArray(b)) {
19426
19779
  if (a.length !== b.length) return false;
@@ -19431,7 +19784,7 @@ var deepCompareValue = function deepCompareValue(a, b) {
19431
19784
  // If one is array and the other isn't, return false
19432
19785
  if (Array.isArray(a) !== Array.isArray(b)) return false;
19433
19786
  // Handle object comparison
19434
- if (_typeof(a) === 'object' && _typeof(b) === 'object') {
19787
+ if (_typeof$1(a) === 'object' && _typeof$1(b) === 'object') {
19435
19788
  var keysA = Object.keys(a);
19436
19789
  var keysB = Object.keys(b);
19437
19790
  if (keysA.length !== keysB.length) return false;
@@ -21213,7 +21566,7 @@ var TimePickerAndroid = function TimePickerAndroid(_ref) {
21213
21566
  open = _useState2[0],
21214
21567
  setOpen = _useState2[1];
21215
21568
  var is12Hour = displayFormat.includes('hh');
21216
- var displayValue = value ? format(displayFormat, value) : '';
21569
+ var displayValue = value ? formatTime(displayFormat, value) : '';
21217
21570
  var pickerInitValue = value || new Date();
21218
21571
  return /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
21219
21572
  onPress: function onPress() {
@@ -21284,7 +21637,7 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
21284
21637
  open = _useState4[0],
21285
21638
  setOpen = _useState4[1];
21286
21639
  var is12Hour = displayFormat.includes('hh');
21287
- var displayValue = value ? format(displayFormat, value) : '';
21640
+ var displayValue = value ? formatTime(displayFormat, value) : '';
21288
21641
  var theme = useTheme();
21289
21642
  React.useEffect(function () {
21290
21643
  setSelectingDate(value || new Date());
@@ -22026,7 +22379,7 @@ function requireScheduler_production_min() {
22026
22379
  var c = a.sortIndex - b.sortIndex;
22027
22380
  return 0 !== c ? c : a.id - b.id;
22028
22381
  }
22029
- if ("object" === (typeof performance === "undefined" ? "undefined" : _typeof(performance)) && "function" === typeof performance.now) {
22382
+ if ("object" === (typeof performance === "undefined" ? "undefined" : _typeof$1(performance)) && "function" === typeof performance.now) {
22030
22383
  var l = performance;
22031
22384
  exports.unstable_now = function () {
22032
22385
  return l.now();
@@ -22197,7 +22550,7 @@ function requireScheduler_production_min() {
22197
22550
  };
22198
22551
  exports.unstable_scheduleCallback = function (a, b, c) {
22199
22552
  var d = exports.unstable_now();
22200
- "object" === _typeof(c) && null !== c ? (c = c.delay, c = "number" === typeof c && 0 < c ? d + c : d) : c = d;
22553
+ "object" === _typeof$1(c) && null !== c ? (c = c.delay, c = "number" === typeof c && 0 < c ? d + c : d) : c = d;
22201
22554
  switch (a) {
22202
22555
  case 1:
22203
22556
  var e = -1;
@@ -22287,7 +22640,7 @@ function requireReactDom_production_min() {
22287
22640
  }
22288
22641
  function pa(a, b, c, d) {
22289
22642
  if (null !== c && 0 === c.type) return !1;
22290
- switch (_typeof(b)) {
22643
+ switch (_typeof$1(b)) {
22291
22644
  case "function":
22292
22645
  case "symbol":
22293
22646
  return !0;
@@ -22397,7 +22750,7 @@ function requireReactDom_production_min() {
22397
22750
  var Ia = Symbol["for"]("react.offscreen");
22398
22751
  var Ja = Symbol.iterator;
22399
22752
  function Ka(a) {
22400
- if (null === a || "object" !== _typeof(a)) return null;
22753
+ if (null === a || "object" !== _typeof$1(a)) return null;
22401
22754
  a = Ja && a[Ja] || a["@@iterator"];
22402
22755
  return "function" === typeof a ? a : null;
22403
22756
  }
@@ -22426,7 +22779,7 @@ function requireReactDom_production_min() {
22426
22779
  set: function set() {
22427
22780
  throw Error();
22428
22781
  }
22429
- }), "object" === (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && Reflect.construct) {
22782
+ }), "object" === (typeof Reflect === "undefined" ? "undefined" : _typeof$1(Reflect)) && Reflect.construct) {
22430
22783
  try {
22431
22784
  Reflect.construct(b, []);
22432
22785
  } catch (l) {
@@ -22508,7 +22861,7 @@ function requireReactDom_production_min() {
22508
22861
  case Fa:
22509
22862
  return "SuspenseList";
22510
22863
  }
22511
- if ("object" === _typeof(a)) switch (a.$$typeof) {
22864
+ if ("object" === _typeof$1(a)) switch (a.$$typeof) {
22512
22865
  case Ca:
22513
22866
  return (a.displayName || "Context") + ".Consumer";
22514
22867
  case Ba:
@@ -22580,7 +22933,7 @@ function requireReactDom_production_min() {
22580
22933
  return null;
22581
22934
  }
22582
22935
  function Sa(a) {
22583
- switch (_typeof(a)) {
22936
+ switch (_typeof$1(a)) {
22584
22937
  case "boolean":
22585
22938
  case "number":
22586
22939
  case "string":
@@ -22891,9 +23244,9 @@ function requireReactDom_production_min() {
22891
23244
  if (tb[a] && (null != b.children || null != b.dangerouslySetInnerHTML)) throw Error(p(137, a));
22892
23245
  if (null != b.dangerouslySetInnerHTML) {
22893
23246
  if (null != b.children) throw Error(p(60));
22894
- if ("object" !== _typeof(b.dangerouslySetInnerHTML) || !("__html" in b.dangerouslySetInnerHTML)) throw Error(p(61));
23247
+ if ("object" !== _typeof$1(b.dangerouslySetInnerHTML) || !("__html" in b.dangerouslySetInnerHTML)) throw Error(p(61));
22895
23248
  }
22896
- if (null != b.style && "object" !== _typeof(b.style)) throw Error(p(62));
23249
+ if (null != b.style && "object" !== _typeof$1(b.style)) throw Error(p(62));
22897
23250
  }
22898
23251
  }
22899
23252
  function vb(a, b) {
@@ -22979,7 +23332,7 @@ function requireReactDom_production_min() {
22979
23332
  a = !1;
22980
23333
  }
22981
23334
  if (a) return null;
22982
- if (c && "function" !== typeof c) throw Error(p(231, b, _typeof(c)));
23335
+ if (c && "function" !== typeof c) throw Error(p(231, b, _typeof$1(c)));
22983
23336
  return c;
22984
23337
  }
22985
23338
  var Lb = !1;
@@ -23893,7 +24246,7 @@ function requireReactDom_production_min() {
23893
24246
  }
23894
24247
  function he(a) {
23895
24248
  a = a.detail;
23896
- return "object" === _typeof(a) && "data" in a ? a.data : null;
24249
+ return "object" === _typeof$1(a) && "data" in a ? a.data : null;
23897
24250
  }
23898
24251
  var ie = !1;
23899
24252
  function je(a, b) {
@@ -24010,7 +24363,7 @@ function requireReactDom_production_min() {
24010
24363
  var He = "function" === typeof Object.is ? Object.is : Ge;
24011
24364
  function Ie(a, b) {
24012
24365
  if (He(a, b)) return !0;
24013
- if ("object" !== _typeof(a) || null === a || "object" !== _typeof(b) || null === b) return !1;
24366
+ if ("object" !== _typeof$1(a) || null === a || "object" !== _typeof$1(b) || null === b) return !1;
24014
24367
  var c = Object.keys(a),
24015
24368
  d = Object.keys(b);
24016
24369
  if (c.length !== d.length) return !1;
@@ -24537,7 +24890,7 @@ function requireReactDom_production_min() {
24537
24890
  var Cf = null,
24538
24891
  Df = null;
24539
24892
  function Ef(a, b) {
24540
- return "textarea" === a || "noscript" === a || "string" === typeof b.children || "number" === typeof b.children || "object" === _typeof(b.dangerouslySetInnerHTML) && null !== b.dangerouslySetInnerHTML && null != b.dangerouslySetInnerHTML.__html;
24893
+ return "textarea" === a || "noscript" === a || "string" === typeof b.children || "number" === typeof b.children || "object" === _typeof$1(b.dangerouslySetInnerHTML) && null !== b.dangerouslySetInnerHTML && null != b.dangerouslySetInnerHTML.__html;
24541
24894
  }
24542
24895
  var Ff = "function" === typeof setTimeout ? setTimeout : void 0,
24543
24896
  Gf = "function" === typeof clearTimeout ? clearTimeout : void 0,
@@ -25185,7 +25538,7 @@ function requireReactDom_production_min() {
25185
25538
  var d = !1,
25186
25539
  e = Vf;
25187
25540
  var f = b.contextType;
25188
- "object" === _typeof(f) && null !== f ? f = Vg(f) : (e = Zf(b) ? Xf : H.current, d = b.contextTypes, f = (d = null !== d && void 0 !== d) ? Yf(a, e) : Vf);
25541
+ "object" === _typeof$1(f) && null !== f ? f = Vg(f) : (e = Zf(b) ? Xf : H.current, d = b.contextTypes, f = (d = null !== d && void 0 !== d) ? Yf(a, e) : Vf);
25189
25542
  b = new b(c, f);
25190
25543
  a.memoizedState = null !== b.state && void 0 !== b.state ? b.state : null;
25191
25544
  b.updater = nh;
@@ -25207,7 +25560,7 @@ function requireReactDom_production_min() {
25207
25560
  e.refs = jh;
25208
25561
  ah(a);
25209
25562
  var f = b.contextType;
25210
- "object" === _typeof(f) && null !== f ? e.context = Vg(f) : (f = Zf(b) ? Xf : H.current, e.context = Yf(a, f));
25563
+ "object" === _typeof$1(f) && null !== f ? e.context = Vg(f) : (f = Zf(b) ? Xf : H.current, e.context = Yf(a, f));
25211
25564
  e.state = a.memoizedState;
25212
25565
  f = b.getDerivedStateFromProps;
25213
25566
  "function" === typeof f && (kh(a, b, f, c), e.state = a.memoizedState);
@@ -25216,7 +25569,7 @@ function requireReactDom_production_min() {
25216
25569
  }
25217
25570
  function sh(a, b, c) {
25218
25571
  a = c.ref;
25219
- if (null !== a && "function" !== typeof a && "object" !== _typeof(a)) {
25572
+ if (null !== a && "function" !== typeof a && "object" !== _typeof$1(a)) {
25220
25573
  if (c._owner) {
25221
25574
  c = c._owner;
25222
25575
  if (c) {
@@ -25291,7 +25644,7 @@ function requireReactDom_production_min() {
25291
25644
  function k(a, b, c, d) {
25292
25645
  var f = c.type;
25293
25646
  if (f === ya) return m(a, b, c.props.children, d, c.key);
25294
- if (null !== b && (b.elementType === f || "object" === _typeof(f) && null !== f && f.$$typeof === Ha && uh(f) === b.type)) return d = e(b, c.props), d.ref = sh(a, b, c), d["return"] = a, d;
25647
+ if (null !== b && (b.elementType === f || "object" === _typeof$1(f) && null !== f && f.$$typeof === Ha && uh(f) === b.type)) return d = e(b, c.props), d.ref = sh(a, b, c), d["return"] = a, d;
25295
25648
  d = yh(c.type, c.key, c.props, null, a.mode, d);
25296
25649
  d.ref = sh(a, b, c);
25297
25650
  d["return"] = a;
@@ -25311,7 +25664,7 @@ function requireReactDom_production_min() {
25311
25664
  }
25312
25665
  function q(a, b, c) {
25313
25666
  if ("string" === typeof b && "" !== b || "number" === typeof b) return b = xh("" + b, a.mode, c), b["return"] = a, b;
25314
- if ("object" === _typeof(b) && null !== b) {
25667
+ if ("object" === _typeof$1(b) && null !== b) {
25315
25668
  switch (b.$$typeof) {
25316
25669
  case va:
25317
25670
  return c = yh(b.type, b.key, b.props, null, a.mode, c), c.ref = sh(a, null, b), c["return"] = a, c;
@@ -25329,7 +25682,7 @@ function requireReactDom_production_min() {
25329
25682
  function r(a, b, c, d) {
25330
25683
  var e = null !== b ? b.key : null;
25331
25684
  if ("string" === typeof c && "" !== c || "number" === typeof c) return null !== e ? null : h(a, b, "" + c, d);
25332
- if ("object" === _typeof(c) && null !== c) {
25685
+ if ("object" === _typeof$1(c) && null !== c) {
25333
25686
  switch (c.$$typeof) {
25334
25687
  case va:
25335
25688
  return c.key === e ? k(a, b, c, d) : null;
@@ -25345,7 +25698,7 @@ function requireReactDom_production_min() {
25345
25698
  }
25346
25699
  function y(a, b, c, d, e) {
25347
25700
  if ("string" === typeof d && "" !== d || "number" === typeof d) return a = a.get(c) || null, h(b, a, "" + d, e);
25348
- if ("object" === _typeof(d) && null !== d) {
25701
+ if ("object" === _typeof$1(d) && null !== d) {
25349
25702
  switch (d.$$typeof) {
25350
25703
  case va:
25351
25704
  return a = a.get(null === d.key ? c : d.key) || null, k(b, a, d, e);
@@ -25419,8 +25772,8 @@ function requireReactDom_production_min() {
25419
25772
  return l;
25420
25773
  }
25421
25774
  function J(a, d, f, h) {
25422
- "object" === _typeof(f) && null !== f && f.type === ya && null === f.key && (f = f.props.children);
25423
- if ("object" === _typeof(f) && null !== f) {
25775
+ "object" === _typeof$1(f) && null !== f && f.type === ya && null === f.key && (f = f.props.children);
25776
+ if ("object" === _typeof$1(f) && null !== f) {
25424
25777
  switch (f.$$typeof) {
25425
25778
  case va:
25426
25779
  a: {
@@ -25435,7 +25788,7 @@ function requireReactDom_production_min() {
25435
25788
  a = d;
25436
25789
  break a;
25437
25790
  }
25438
- } else if (l.elementType === k || "object" === _typeof(k) && null !== k && k.$$typeof === Ha && uh(k) === l.type) {
25791
+ } else if (l.elementType === k || "object" === _typeof$1(k) && null !== k && k.$$typeof === Ha && uh(k) === l.type) {
25439
25792
  c(a, l.sibling);
25440
25793
  d = e(l, f.props);
25441
25794
  d.ref = sh(a, l, f);
@@ -26320,7 +26673,7 @@ function requireReactDom_production_min() {
26320
26673
  g.props = h;
26321
26674
  var k = g.context,
26322
26675
  l = c.contextType;
26323
- "object" === _typeof(l) && null !== l ? l = Vg(l) : (l = Zf(c) ? Xf : H.current, l = Yf(b, l));
26676
+ "object" === _typeof$1(l) && null !== l ? l = Vg(l) : (l = Zf(c) ? Xf : H.current, l = Yf(b, l));
26324
26677
  var m = c.getDerivedStateFromProps,
26325
26678
  q = "function" === typeof m || "function" === typeof g.getSnapshotBeforeUpdate;
26326
26679
  q || "function" !== typeof g.UNSAFE_componentWillReceiveProps && "function" !== typeof g.componentWillReceiveProps || (h !== d || k !== l) && qh(b, g, d, l);
@@ -26339,7 +26692,7 @@ function requireReactDom_production_min() {
26339
26692
  q = b.pendingProps;
26340
26693
  r = g.context;
26341
26694
  k = c.contextType;
26342
- "object" === _typeof(k) && null !== k ? k = Vg(k) : (k = Zf(c) ? Xf : H.current, k = Yf(b, k));
26695
+ "object" === _typeof$1(k) && null !== k ? k = Vg(k) : (k = Zf(c) ? Xf : H.current, k = Yf(b, k));
26343
26696
  var y = c.getDerivedStateFromProps;
26344
26697
  (m = "function" === typeof y || "function" === typeof g.getSnapshotBeforeUpdate) || "function" !== typeof g.UNSAFE_componentWillReceiveProps && "function" !== typeof g.componentWillReceiveProps || (h !== q || r !== k) && qh(b, g, d, k);
26345
26698
  $g = !1;
@@ -28252,7 +28605,7 @@ function requireReactDom_production_min() {
28252
28605
  k = b;
28253
28606
  b = Z;
28254
28607
  h.flags |= 32768;
28255
- if (null !== k && "object" === _typeof(k) && "function" === typeof k.then) {
28608
+ if (null !== k && "object" === _typeof$1(k) && "function" === typeof k.then) {
28256
28609
  var l = k,
28257
28610
  m = h,
28258
28611
  q = m.tag;
@@ -28673,7 +29026,7 @@ function requireReactDom_production_min() {
28673
29026
  e = Xh(null, b, d, a, e, c);
28674
29027
  var f = bi();
28675
29028
  b.flags |= 1;
28676
- "object" === _typeof(e) && null !== e && "function" === typeof e.render && void 0 === e.$$typeof ? (b.tag = 1, b.memoizedState = null, b.updateQueue = null, Zf(d) ? (f = !0, cg(b)) : f = !1, b.memoizedState = null !== e.state && void 0 !== e.state ? e.state : null, ah(b), e.updater = nh, b.stateNode = e, e._reactInternals = b, rh(b, d, a, c), b = kj(null, b, d, !0, f, c)) : (b.tag = 0, I && f && vg(b), Yi(null, b, e, c), b = b.child);
29029
+ "object" === _typeof$1(e) && null !== e && "function" === typeof e.render && void 0 === e.$$typeof ? (b.tag = 1, b.memoizedState = null, b.updateQueue = null, Zf(d) ? (f = !0, cg(b)) : f = !1, b.memoizedState = null !== e.state && void 0 !== e.state ? e.state : null, ah(b), e.updater = nh, b.stateNode = e, e._reactInternals = b, rh(b, d, a, c), b = kj(null, b, d, !0, f, c)) : (b.tag = 0, I && f && vg(b), Yi(null, b, e, c), b = b.child);
28677
29030
  return b;
28678
29031
  case 16:
28679
29032
  d = b.elementType;
@@ -28914,7 +29267,7 @@ function requireReactDom_production_min() {
28914
29267
  case Ia:
28915
29268
  return qj(c, e, f, b);
28916
29269
  default:
28917
- if ("object" === _typeof(a) && null !== a) switch (a.$$typeof) {
29270
+ if ("object" === _typeof$1(a) && null !== a) switch (a.$$typeof) {
28918
29271
  case Ba:
28919
29272
  g = 10;
28920
29273
  break a;
@@ -28932,7 +29285,7 @@ function requireReactDom_production_min() {
28932
29285
  d = null;
28933
29286
  break a;
28934
29287
  }
28935
- throw Error(p(130, null == a ? a : _typeof(a), ""));
29288
+ throw Error(p(130, null == a ? a : _typeof$1(a), ""));
28936
29289
  }
28937
29290
  b = Bg(g, c, b, e);
28938
29291
  b.elementType = a;
@@ -29580,7 +29933,7 @@ function requireLib() {
29580
29933
  };
29581
29934
  },
29582
29935
  380: function _(e, t, r) {
29583
- var n = "object" == _typeof(r.g) && r.g && r.g.Object === Object && r.g;
29936
+ var n = "object" == _typeof$1(r.g) && r.g && r.g.Object === Object && r.g;
29584
29937
  e.exports = n;
29585
29938
  },
29586
29939
  903: function _(e, t, r) {
@@ -29608,7 +29961,7 @@ function requireLib() {
29608
29961
  },
29609
29962
  433: function _(e, t, r) {
29610
29963
  var n = r(380),
29611
- u = "object" == (typeof self === "undefined" ? "undefined" : _typeof(self)) && self && self.Object === Object && self,
29964
+ u = "object" == (typeof self === "undefined" ? "undefined" : _typeof$1(self)) && self && self.Object === Object && self,
29612
29965
  o = n || u || Function("return this")();
29613
29966
  e.exports = o;
29614
29967
  },
@@ -29677,20 +30030,20 @@ function requireLib() {
29677
30030
  },
29678
30031
  953: function _(e) {
29679
30032
  e.exports = function (e) {
29680
- var t = _typeof(e);
30033
+ var t = _typeof$1(e);
29681
30034
  return null != e && ("object" == t || "function" == t);
29682
30035
  };
29683
30036
  },
29684
30037
  934: function _(e) {
29685
30038
  e.exports = function (e) {
29686
- return null != e && "object" == _typeof(e);
30039
+ return null != e && "object" == _typeof$1(e);
29687
30040
  };
29688
30041
  },
29689
30042
  414: function _(e, t, r) {
29690
30043
  var n = r(148),
29691
30044
  u = r(934);
29692
30045
  e.exports = function (e) {
29693
- return "symbol" == _typeof(e) || u(e) && "[object Symbol]" == n(e);
30046
+ return "symbol" == _typeof$1(e) || u(e) && "[object Symbol]" == n(e);
29694
30047
  };
29695
30048
  },
29696
30049
  664: function _(e, t, r) {
@@ -29767,11 +30120,11 @@ function requireLib() {
29767
30120
  get: t[r]
29768
30121
  });
29769
30122
  }, u.g = function () {
29770
- if ("object" == (typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis))) return globalThis;
30123
+ if ("object" == (typeof globalThis === "undefined" ? "undefined" : _typeof$1(globalThis))) return globalThis;
29771
30124
  try {
29772
30125
  return this || new Function("return this")();
29773
30126
  } catch (e) {
29774
- if ("object" == (typeof window === "undefined" ? "undefined" : _typeof(window))) return window;
30127
+ if ("object" == (typeof window === "undefined" ? "undefined" : _typeof$1(window))) return window;
29775
30128
  }
29776
30129
  }(), u.o = function (e, t) {
29777
30130
  return Object.prototype.hasOwnProperty.call(e, t);
@@ -29893,7 +30246,7 @@ function requireLib() {
29893
30246
  }
29894
30247
  var h = Object.prototype.constructor.toString();
29895
30248
  function p(e) {
29896
- if (!e || "object" != _typeof(e)) return !1;
30249
+ if (!e || "object" != _typeof$1(e)) return !1;
29897
30250
  var t = c(e);
29898
30251
  if (null === t) return !0;
29899
30252
  var r = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
@@ -30190,7 +30543,7 @@ function requireLib() {
30190
30543
  }
30191
30544
  return k(_u4, r), R(n, _u4);
30192
30545
  }
30193
- if (!e || "object" != _typeof(e)) {
30546
+ if (!e || "object" != _typeof$1(e)) {
30194
30547
  if (n = t(e), void 0 === n && (n = e), n === a && (n = void 0), _this.autoFreeze_ && E(n, !0), r) {
30195
30548
  var _t6 = [],
30196
30549
  _u5 = [];
@@ -30468,10 +30821,10 @@ function requireLib() {
30468
30821
  }
30469
30822
  };
30470
30823
  function se(e) {
30471
- return se = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
30472
- return _typeof(e);
30824
+ return se = "function" == typeof Symbol && "symbol" == _typeof$1(Symbol.iterator) ? function (e) {
30825
+ return _typeof$1(e);
30473
30826
  } : function (e) {
30474
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
30827
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof$1(e);
30475
30828
  }, se(e);
30476
30829
  }
30477
30830
  function le(e, t, r) {
@@ -35155,7 +35508,7 @@ function requireLib() {
35155
35508
  Jt = u(858),
35156
35509
  Yt = u.n(Jt);
35157
35510
  var Zt = function Zt(e) {
35158
- return "object" == _typeof(e) && null != e && 1 === e.nodeType;
35511
+ return "object" == _typeof$1(e) && null != e && 1 === e.nodeType;
35159
35512
  },
35160
35513
  Gt = function Gt(e, t) {
35161
35514
  return (!t || "hidden" !== e) && "visible" !== e && "clip" !== e;
@@ -35375,10 +35728,10 @@ function requireLib() {
35375
35728
  "undefined" != typeof navigator && /Safari/.test(navigator.userAgent) && /Version\/(\d+)/.test(navigator.userAgent) && null !== (nr = navigator.userAgent.match(/Version\/(\d+)/)) && void 0 !== nr && nr[1] && parseInt(null === (ur = navigator.userAgent.match(/Version\/(\d+)/)) || void 0 === ur ? void 0 : ur[1], 10);
35376
35729
  var Tr = (!Or || !xr) && !Ar && "undefined" != typeof globalThis && globalThis.InputEvent && "function" == typeof globalThis.InputEvent.prototype.getTargetRanges;
35377
35730
  function Mr(e) {
35378
- return Mr = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
35379
- return _typeof(e);
35731
+ return Mr = "function" == typeof Symbol && "symbol" == _typeof$1(Symbol.iterator) ? function (e) {
35732
+ return _typeof$1(e);
35380
35733
  } : function (e) {
35381
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
35734
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof$1(e);
35382
35735
  }, Mr(e);
35383
35736
  }
35384
35737
  function Rr(e, t, r) {
@@ -36451,10 +36804,10 @@ function requireLib() {
36451
36804
  return u;
36452
36805
  }
36453
36806
  function mu(e) {
36454
- return mu = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
36455
- return _typeof(e);
36807
+ return mu = "function" == typeof Symbol && "symbol" == _typeof$1(Symbol.iterator) ? function (e) {
36808
+ return _typeof$1(e);
36456
36809
  } : function (e) {
36457
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
36810
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof$1(e);
36458
36811
  }, mu(e);
36459
36812
  }
36460
36813
  function yu(e, t, r) {
@@ -38206,7 +38559,7 @@ function requireLib() {
38206
38559
  };
38207
38560
  }(e);
38208
38561
  if (function (e) {
38209
- return "object" == _typeof(e) && "function" == typeof e.behavior;
38562
+ return "object" == _typeof$1(e) && "function" == typeof e.behavior;
38210
38563
  }(t)) return t.behavior(rr(e, t));
38211
38564
  var n = "boolean" == typeof t || null == t ? void 0 : t.behavior;
38212
38565
  var _iterator47 = _createForOfIteratorHelper(rr(e, function (e) {
@@ -41351,6 +41704,7 @@ exports.HeroDesignProvider = HeroDesignProvider;
41351
41704
  exports.Icon = Icon;
41352
41705
  exports.Image = Image;
41353
41706
  exports.List = List;
41707
+ exports.LocaleProvider = LocaleProvider;
41354
41708
  exports.MapPin = index$6;
41355
41709
  exports.PageControl = PageControl;
41356
41710
  exports.PinInput = PinInput;