@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/es/index.js CHANGED
@@ -557,14 +557,14 @@ function _toPropertyKey(t) {
557
557
  var i = _toPrimitive(t, "string");
558
558
  return "symbol" == typeof i ? i : i + "";
559
559
  }
560
- function _typeof(o) {
560
+ function _typeof$1(o) {
561
561
  "@babel/helpers - typeof";
562
562
 
563
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
563
+ return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
564
564
  return typeof o;
565
565
  } : function (o) {
566
566
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
567
- }, _typeof(o);
567
+ }, _typeof$1(o);
568
568
  }
569
569
  function _unsupportedIterableToArray(r, a) {
570
570
  if (r) {
@@ -6089,7 +6089,7 @@ function requireCamelize() {
6089
6089
  return walk(obj);
6090
6090
  };
6091
6091
  function walk(obj) {
6092
- if (!obj || _typeof(obj) !== 'object') return obj;
6092
+ if (!obj || _typeof$1(obj) !== 'object') return obj;
6093
6093
  if (isDate(obj) || isRegex(obj)) return obj;
6094
6094
  if (isArray(obj)) return map(obj, walk);
6095
6095
  return reduce(objectKeys(obj), function (acc, key) {
@@ -6452,7 +6452,7 @@ function requireCssToReactNative() {
6452
6452
  value: true
6453
6453
  });
6454
6454
  function _interopDefault(ex) {
6455
- return ex && _typeof(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
6455
+ return ex && _typeof$1(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
6456
6456
  }
6457
6457
  var parse = requireLib$1();
6458
6458
  var parse__default = _interopDefault(parse);
@@ -7176,7 +7176,7 @@ var generated = {};
7176
7176
  var buffer = '';
7177
7177
  var lastType;
7178
7178
  function handleInterpolation(interpolation, i, arr) {
7179
- var type = _typeof(interpolation);
7179
+ var type = _typeof$1(interpolation);
7180
7180
  if (type === 'string') {
7181
7181
  // strip comments
7182
7182
  interpolation = interpolation.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '');
@@ -10776,12 +10776,59 @@ var BottomSheet$1 = Object.assign(BottomSheet, {
10776
10776
  ScrollView: BottomSheetScrollView
10777
10777
  });
10778
10778
 
10779
+ function _typeof(o) {
10780
+ "@babel/helpers - typeof";
10781
+
10782
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
10783
+ return typeof o;
10784
+ } : function (o) {
10785
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
10786
+ }, _typeof(o);
10787
+ }
10788
+
10779
10789
  function requiredArgs(required, args) {
10780
10790
  if (args.length < required) {
10781
10791
  throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
10782
10792
  }
10783
10793
  }
10784
10794
 
10795
+ /**
10796
+ * @name isDate
10797
+ * @category Common Helpers
10798
+ * @summary Is the given value a date?
10799
+ *
10800
+ * @description
10801
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
10802
+ *
10803
+ * @param {*} value - the value to check
10804
+ * @returns {boolean} true if the given value is a date
10805
+ * @throws {TypeError} 1 arguments required
10806
+ *
10807
+ * @example
10808
+ * // For a valid date:
10809
+ * const result = isDate(new Date())
10810
+ * //=> true
10811
+ *
10812
+ * @example
10813
+ * // For an invalid date:
10814
+ * const result = isDate(new Date(NaN))
10815
+ * //=> true
10816
+ *
10817
+ * @example
10818
+ * // For some value:
10819
+ * const result = isDate('2014-02-31')
10820
+ * //=> false
10821
+ *
10822
+ * @example
10823
+ * // For an object:
10824
+ * const result = isDate({})
10825
+ * //=> false
10826
+ */
10827
+ function isDate(value) {
10828
+ requiredArgs(1, arguments);
10829
+ return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
10830
+ }
10831
+
10785
10832
  /**
10786
10833
  * @name toDate
10787
10834
  * @category Common Helpers
@@ -10812,11 +10859,11 @@ function requiredArgs(required, args) {
10812
10859
  * const result = toDate(1392098430000)
10813
10860
  * //=> Tue Feb 11 2014 11:30:30
10814
10861
  */
10815
-
10816
10862
  function toDate(argument) {
10817
10863
  requiredArgs(1, arguments);
10818
- var argStr = Object.prototype.toString.call(argument); // Clone the date
10864
+ var argStr = Object.prototype.toString.call(argument);
10819
10865
 
10866
+ // Clone the date
10820
10867
  if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
10821
10868
  // Prevent the date to lose the milliseconds when passed to new Date() in IE10
10822
10869
  return new Date(argument.getTime());
@@ -10825,8 +10872,8 @@ function toDate(argument) {
10825
10872
  } else {
10826
10873
  if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
10827
10874
  // eslint-disable-next-line no-console
10828
- 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
10829
-
10875
+ 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");
10876
+ // eslint-disable-next-line no-console
10830
10877
  console.warn(new Error().stack);
10831
10878
  }
10832
10879
  return new Date(NaN);
@@ -10845,544 +10892,34 @@ function toDate(argument) {
10845
10892
  *
10846
10893
  * Time value of Date: http://es5.github.io/#x15.9.1.1
10847
10894
  *
10848
- * ### v2.0.0 breaking changes:
10849
- *
10850
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
10851
- *
10852
- * - Now `isValid` doesn't throw an exception
10853
- * if the first argument is not an instance of Date.
10854
- * Instead, argument is converted beforehand using `toDate`.
10855
- *
10856
- * Examples:
10857
- *
10858
- * | `isValid` argument | Before v2.0.0 | v2.0.0 onward |
10859
- * |---------------------------|---------------|---------------|
10860
- * | `new Date()` | `true` | `true` |
10861
- * | `new Date('2016-01-01')` | `true` | `true` |
10862
- * | `new Date('')` | `false` | `false` |
10863
- * | `new Date(1488370835081)` | `true` | `true` |
10864
- * | `new Date(NaN)` | `false` | `false` |
10865
- * | `'2016-01-01'` | `TypeError` | `false` |
10866
- * | `''` | `TypeError` | `false` |
10867
- * | `1488370835081` | `TypeError` | `true` |
10868
- * | `NaN` | `TypeError` | `false` |
10869
- *
10870
- * We introduce this change to make *date-fns* consistent with ECMAScript behavior
10871
- * that try to coerce arguments to the expected type
10872
- * (which is also the case with other *date-fns* functions).
10873
- *
10874
10895
  * @param {*} date - the date to check
10875
10896
  * @returns {Boolean} the date is valid
10876
10897
  * @throws {TypeError} 1 argument required
10877
10898
  *
10878
10899
  * @example
10879
10900
  * // For the valid date:
10880
- * var result = isValid(new Date(2014, 1, 31))
10901
+ * const result = isValid(new Date(2014, 1, 31))
10881
10902
  * //=> true
10882
10903
  *
10883
10904
  * @example
10884
10905
  * // For the value, convertable into a date:
10885
- * var result = isValid(1393804800000)
10906
+ * const result = isValid(1393804800000)
10886
10907
  * //=> true
10887
10908
  *
10888
10909
  * @example
10889
10910
  * // For the invalid date:
10890
- * var result = isValid(new Date(''))
10911
+ * const result = isValid(new Date(''))
10891
10912
  * //=> false
10892
10913
  */
10893
-
10894
10914
  function isValid(dirtyDate) {
10895
10915
  requiredArgs(1, arguments);
10896
- var date = toDate(dirtyDate);
10897
- return !isNaN(date);
10898
- }
10899
-
10900
- var formatDistanceLocale = {
10901
- lessThanXSeconds: {
10902
- one: 'less than a second',
10903
- other: 'less than {{count}} seconds'
10904
- },
10905
- xSeconds: {
10906
- one: '1 second',
10907
- other: '{{count}} seconds'
10908
- },
10909
- halfAMinute: 'half a minute',
10910
- lessThanXMinutes: {
10911
- one: 'less than a minute',
10912
- other: 'less than {{count}} minutes'
10913
- },
10914
- xMinutes: {
10915
- one: '1 minute',
10916
- other: '{{count}} minutes'
10917
- },
10918
- aboutXHours: {
10919
- one: 'about 1 hour',
10920
- other: 'about {{count}} hours'
10921
- },
10922
- xHours: {
10923
- one: '1 hour',
10924
- other: '{{count}} hours'
10925
- },
10926
- xDays: {
10927
- one: '1 day',
10928
- other: '{{count}} days'
10929
- },
10930
- aboutXWeeks: {
10931
- one: 'about 1 week',
10932
- other: 'about {{count}} weeks'
10933
- },
10934
- xWeeks: {
10935
- one: '1 week',
10936
- other: '{{count}} weeks'
10937
- },
10938
- aboutXMonths: {
10939
- one: 'about 1 month',
10940
- other: 'about {{count}} months'
10941
- },
10942
- xMonths: {
10943
- one: '1 month',
10944
- other: '{{count}} months'
10945
- },
10946
- aboutXYears: {
10947
- one: 'about 1 year',
10948
- other: 'about {{count}} years'
10949
- },
10950
- xYears: {
10951
- one: '1 year',
10952
- other: '{{count}} years'
10953
- },
10954
- overXYears: {
10955
- one: 'over 1 year',
10956
- other: 'over {{count}} years'
10957
- },
10958
- almostXYears: {
10959
- one: 'almost 1 year',
10960
- other: 'almost {{count}} years'
10961
- }
10962
- };
10963
- function formatDistance(token, count, options) {
10964
- options = options || {};
10965
- var result;
10966
- if (typeof formatDistanceLocale[token] === 'string') {
10967
- result = formatDistanceLocale[token];
10968
- } else if (count === 1) {
10969
- result = formatDistanceLocale[token].one;
10970
- } else {
10971
- result = formatDistanceLocale[token].other.replace('{{count}}', count);
10972
- }
10973
- if (options.addSuffix) {
10974
- if (options.comparison > 0) {
10975
- return 'in ' + result;
10976
- } else {
10977
- return result + ' ago';
10978
- }
10979
- }
10980
- return result;
10981
- }
10982
-
10983
- function buildFormatLongFn(args) {
10984
- return function (dirtyOptions) {
10985
- var options = dirtyOptions || {};
10986
- var width = options.width ? String(options.width) : args.defaultWidth;
10987
- var format = args.formats[width] || args.formats[args.defaultWidth];
10988
- return format;
10989
- };
10990
- }
10991
-
10992
- var dateFormats = {
10993
- full: 'EEEE, MMMM do, y',
10994
- "long": 'MMMM do, y',
10995
- medium: 'MMM d, y',
10996
- "short": 'MM/dd/yyyy'
10997
- };
10998
- var timeFormats = {
10999
- full: 'h:mm:ss a zzzz',
11000
- "long": 'h:mm:ss a z',
11001
- medium: 'h:mm:ss a',
11002
- "short": 'h:mm a'
11003
- };
11004
- var dateTimeFormats = {
11005
- full: "{{date}} 'at' {{time}}",
11006
- "long": "{{date}} 'at' {{time}}",
11007
- medium: '{{date}}, {{time}}',
11008
- "short": '{{date}}, {{time}}'
11009
- };
11010
- var formatLong = {
11011
- date: buildFormatLongFn({
11012
- formats: dateFormats,
11013
- defaultWidth: 'full'
11014
- }),
11015
- time: buildFormatLongFn({
11016
- formats: timeFormats,
11017
- defaultWidth: 'full'
11018
- }),
11019
- dateTime: buildFormatLongFn({
11020
- formats: dateTimeFormats,
11021
- defaultWidth: 'full'
11022
- })
11023
- };
11024
-
11025
- var formatRelativeLocale = {
11026
- lastWeek: "'last' eeee 'at' p",
11027
- yesterday: "'yesterday at' p",
11028
- today: "'today at' p",
11029
- tomorrow: "'tomorrow at' p",
11030
- nextWeek: "eeee 'at' p",
11031
- other: 'P'
11032
- };
11033
- function formatRelative(token, _date, _baseDate, _options) {
11034
- return formatRelativeLocale[token];
11035
- }
11036
-
11037
- function buildLocalizeFn(args) {
11038
- return function (dirtyIndex, dirtyOptions) {
11039
- var options = dirtyOptions || {};
11040
- var context = options.context ? String(options.context) : 'standalone';
11041
- var valuesArray;
11042
- if (context === 'formatting' && args.formattingValues) {
11043
- var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
11044
- var width = options.width ? String(options.width) : defaultWidth;
11045
- valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
11046
- } else {
11047
- var _defaultWidth = args.defaultWidth;
11048
- var _width = options.width ? String(options.width) : args.defaultWidth;
11049
- valuesArray = args.values[_width] || args.values[_defaultWidth];
11050
- }
11051
- var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
11052
- return valuesArray[index];
11053
- };
11054
- }
11055
-
11056
- var eraValues = {
11057
- narrow: ['B', 'A'],
11058
- abbreviated: ['BC', 'AD'],
11059
- wide: ['Before Christ', 'Anno Domini']
11060
- };
11061
- var quarterValues = {
11062
- narrow: ['1', '2', '3', '4'],
11063
- abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
11064
- wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter'] // Note: in English, the names of days of the week and months are capitalized.
11065
- // If you are making a new locale based on this one, check if the same is true for the language you're working on.
11066
- // Generally, formatted dates should look like they are in the middle of a sentence,
11067
- // e.g. in Spanish language the weekdays and months should be in the lowercase.
11068
- };
11069
-
11070
- var monthValues = {
11071
- narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
11072
- abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
11073
- wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
11074
- };
11075
- var dayValues = {
11076
- narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
11077
- "short": ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
11078
- abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
11079
- wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
11080
- };
11081
- var dayPeriodValues = {
11082
- narrow: {
11083
- am: 'a',
11084
- pm: 'p',
11085
- midnight: 'mi',
11086
- noon: 'n',
11087
- morning: 'morning',
11088
- afternoon: 'afternoon',
11089
- evening: 'evening',
11090
- night: 'night'
11091
- },
11092
- abbreviated: {
11093
- am: 'AM',
11094
- pm: 'PM',
11095
- midnight: 'midnight',
11096
- noon: 'noon',
11097
- morning: 'morning',
11098
- afternoon: 'afternoon',
11099
- evening: 'evening',
11100
- night: 'night'
11101
- },
11102
- wide: {
11103
- am: 'a.m.',
11104
- pm: 'p.m.',
11105
- midnight: 'midnight',
11106
- noon: 'noon',
11107
- morning: 'morning',
11108
- afternoon: 'afternoon',
11109
- evening: 'evening',
11110
- night: 'night'
11111
- }
11112
- };
11113
- var formattingDayPeriodValues = {
11114
- narrow: {
11115
- am: 'a',
11116
- pm: 'p',
11117
- midnight: 'mi',
11118
- noon: 'n',
11119
- morning: 'in the morning',
11120
- afternoon: 'in the afternoon',
11121
- evening: 'in the evening',
11122
- night: 'at night'
11123
- },
11124
- abbreviated: {
11125
- am: 'AM',
11126
- pm: 'PM',
11127
- midnight: 'midnight',
11128
- noon: 'noon',
11129
- morning: 'in the morning',
11130
- afternoon: 'in the afternoon',
11131
- evening: 'in the evening',
11132
- night: 'at night'
11133
- },
11134
- wide: {
11135
- am: 'a.m.',
11136
- pm: 'p.m.',
11137
- midnight: 'midnight',
11138
- noon: 'noon',
11139
- morning: 'in the morning',
11140
- afternoon: 'in the afternoon',
11141
- evening: 'in the evening',
11142
- night: 'at night'
11143
- }
11144
- };
11145
- function ordinalNumber(dirtyNumber, _dirtyOptions) {
11146
- var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
11147
- // if they are different for different grammatical genders,
11148
- // use `options.unit`:
11149
- //
11150
- // var options = dirtyOptions || {}
11151
- // var unit = String(options.unit)
11152
- //
11153
- // where `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
11154
- // 'day', 'hour', 'minute', 'second'
11155
-
11156
- var rem100 = number % 100;
11157
- if (rem100 > 20 || rem100 < 10) {
11158
- switch (rem100 % 10) {
11159
- case 1:
11160
- return number + 'st';
11161
- case 2:
11162
- return number + 'nd';
11163
- case 3:
11164
- return number + 'rd';
11165
- }
11166
- }
11167
- return number + 'th';
11168
- }
11169
- var localize = {
11170
- ordinalNumber: ordinalNumber,
11171
- era: buildLocalizeFn({
11172
- values: eraValues,
11173
- defaultWidth: 'wide'
11174
- }),
11175
- quarter: buildLocalizeFn({
11176
- values: quarterValues,
11177
- defaultWidth: 'wide',
11178
- argumentCallback: function argumentCallback(quarter) {
11179
- return Number(quarter) - 1;
11180
- }
11181
- }),
11182
- month: buildLocalizeFn({
11183
- values: monthValues,
11184
- defaultWidth: 'wide'
11185
- }),
11186
- day: buildLocalizeFn({
11187
- values: dayValues,
11188
- defaultWidth: 'wide'
11189
- }),
11190
- dayPeriod: buildLocalizeFn({
11191
- values: dayPeriodValues,
11192
- defaultWidth: 'wide',
11193
- formattingValues: formattingDayPeriodValues,
11194
- defaultFormattingWidth: 'wide'
11195
- })
11196
- };
11197
-
11198
- function buildMatchPatternFn(args) {
11199
- return function (dirtyString, dirtyOptions) {
11200
- var string = String(dirtyString);
11201
- var options = dirtyOptions || {};
11202
- var matchResult = string.match(args.matchPattern);
11203
- if (!matchResult) {
11204
- return null;
11205
- }
11206
- var matchedString = matchResult[0];
11207
- var parseResult = string.match(args.parsePattern);
11208
- if (!parseResult) {
11209
- return null;
11210
- }
11211
- var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
11212
- value = options.valueCallback ? options.valueCallback(value) : value;
11213
- return {
11214
- value: value,
11215
- rest: string.slice(matchedString.length)
11216
- };
11217
- };
11218
- }
11219
-
11220
- function buildMatchFn(args) {
11221
- return function (dirtyString, dirtyOptions) {
11222
- var string = String(dirtyString);
11223
- var options = dirtyOptions || {};
11224
- var width = options.width;
11225
- var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
11226
- var matchResult = string.match(matchPattern);
11227
- if (!matchResult) {
11228
- return null;
11229
- }
11230
- var matchedString = matchResult[0];
11231
- var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
11232
- var value;
11233
- if (Object.prototype.toString.call(parsePatterns) === '[object Array]') {
11234
- value = findIndex(parsePatterns, function (pattern) {
11235
- return pattern.test(matchedString);
11236
- });
11237
- } else {
11238
- value = findKey(parsePatterns, function (pattern) {
11239
- return pattern.test(matchedString);
11240
- });
11241
- }
11242
- value = args.valueCallback ? args.valueCallback(value) : value;
11243
- value = options.valueCallback ? options.valueCallback(value) : value;
11244
- return {
11245
- value: value,
11246
- rest: string.slice(matchedString.length)
11247
- };
11248
- };
11249
- }
11250
- function findKey(object, predicate) {
11251
- for (var key in object) {
11252
- if (object.hasOwnProperty(key) && predicate(object[key])) {
11253
- return key;
11254
- }
11255
- }
11256
- }
11257
- function findIndex(array, predicate) {
11258
- for (var key = 0; key < array.length; key++) {
11259
- if (predicate(array[key])) {
11260
- return key;
11261
- }
10916
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
10917
+ return false;
11262
10918
  }
10919
+ var date = toDate(dirtyDate);
10920
+ return !isNaN(Number(date));
11263
10921
  }
11264
10922
 
11265
- var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
11266
- var parseOrdinalNumberPattern = /\d+/i;
11267
- var matchEraPatterns = {
11268
- narrow: /^(b|a)/i,
11269
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
11270
- wide: /^(before christ|before common era|anno domini|common era)/i
11271
- };
11272
- var parseEraPatterns = {
11273
- any: [/^b/i, /^(a|c)/i]
11274
- };
11275
- var matchQuarterPatterns = {
11276
- narrow: /^[1234]/i,
11277
- abbreviated: /^q[1234]/i,
11278
- wide: /^[1234](th|st|nd|rd)? quarter/i
11279
- };
11280
- var parseQuarterPatterns = {
11281
- any: [/1/i, /2/i, /3/i, /4/i]
11282
- };
11283
- var matchMonthPatterns = {
11284
- narrow: /^[jfmasond]/i,
11285
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
11286
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
11287
- };
11288
- var parseMonthPatterns = {
11289
- 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],
11290
- 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]
11291
- };
11292
- var matchDayPatterns = {
11293
- narrow: /^[smtwf]/i,
11294
- "short": /^(su|mo|tu|we|th|fr|sa)/i,
11295
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
11296
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
11297
- };
11298
- var parseDayPatterns = {
11299
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
11300
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
11301
- };
11302
- var matchDayPeriodPatterns = {
11303
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
11304
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
11305
- };
11306
- var parseDayPeriodPatterns = {
11307
- any: {
11308
- am: /^a/i,
11309
- pm: /^p/i,
11310
- midnight: /^mi/i,
11311
- noon: /^no/i,
11312
- morning: /morning/i,
11313
- afternoon: /afternoon/i,
11314
- evening: /evening/i,
11315
- night: /night/i
11316
- }
11317
- };
11318
- var match = {
11319
- ordinalNumber: buildMatchPatternFn({
11320
- matchPattern: matchOrdinalNumberPattern,
11321
- parsePattern: parseOrdinalNumberPattern,
11322
- valueCallback: function valueCallback(value) {
11323
- return parseInt(value, 10);
11324
- }
11325
- }),
11326
- era: buildMatchFn({
11327
- matchPatterns: matchEraPatterns,
11328
- defaultMatchWidth: 'wide',
11329
- parsePatterns: parseEraPatterns,
11330
- defaultParseWidth: 'any'
11331
- }),
11332
- quarter: buildMatchFn({
11333
- matchPatterns: matchQuarterPatterns,
11334
- defaultMatchWidth: 'wide',
11335
- parsePatterns: parseQuarterPatterns,
11336
- defaultParseWidth: 'any',
11337
- valueCallback: function valueCallback(index) {
11338
- return index + 1;
11339
- }
11340
- }),
11341
- month: buildMatchFn({
11342
- matchPatterns: matchMonthPatterns,
11343
- defaultMatchWidth: 'wide',
11344
- parsePatterns: parseMonthPatterns,
11345
- defaultParseWidth: 'any'
11346
- }),
11347
- day: buildMatchFn({
11348
- matchPatterns: matchDayPatterns,
11349
- defaultMatchWidth: 'wide',
11350
- parsePatterns: parseDayPatterns,
11351
- defaultParseWidth: 'any'
11352
- }),
11353
- dayPeriod: buildMatchFn({
11354
- matchPatterns: matchDayPeriodPatterns,
11355
- defaultMatchWidth: 'any',
11356
- parsePatterns: parseDayPeriodPatterns,
11357
- defaultParseWidth: 'any'
11358
- })
11359
- };
11360
-
11361
- /**
11362
- * @type {Locale}
11363
- * @category Locales
11364
- * @summary English locale (United States).
11365
- * @language English
11366
- * @iso-639-2 eng
11367
- * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
11368
- * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
11369
- */
11370
-
11371
- var locale = {
11372
- code: 'en-US',
11373
- formatDistance: formatDistance,
11374
- formatLong: formatLong,
11375
- formatRelative: formatRelative,
11376
- localize: localize,
11377
- match: match,
11378
- options: {
11379
- weekStartsOn: 0
11380
- /* Sunday */,
11381
-
11382
- firstWeekContainsDate: 1
11383
- }
11384
- };
11385
-
11386
10923
  function toInteger(dirtyNumber) {
11387
10924
  if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
11388
10925
  return NaN;
@@ -11402,10 +10939,6 @@ function toInteger(dirtyNumber) {
11402
10939
  * @description
11403
10940
  * Add the specified number of milliseconds to the given date.
11404
10941
  *
11405
- * ### v2.0.0 breaking changes:
11406
- *
11407
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
11408
- *
11409
10942
  * @param {Date|Number} date - the date to be changed
11410
10943
  * @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`.
11411
10944
  * @returns {Date} the new date with the milliseconds added
@@ -11413,10 +10946,9 @@ function toInteger(dirtyNumber) {
11413
10946
  *
11414
10947
  * @example
11415
10948
  * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
11416
- * var result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
10949
+ * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
11417
10950
  * //=> Thu Jul 10 2014 12:45:30.750
11418
10951
  */
11419
-
11420
10952
  function addMilliseconds(dirtyDate, dirtyAmount) {
11421
10953
  requiredArgs(2, arguments);
11422
10954
  var timestamp = toDate(dirtyDate).getTime();
@@ -11432,10 +10964,6 @@ function addMilliseconds(dirtyDate, dirtyAmount) {
11432
10964
  * @description
11433
10965
  * Subtract the specified number of milliseconds from the given date.
11434
10966
  *
11435
- * ### v2.0.0 breaking changes:
11436
- *
11437
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
11438
- *
11439
10967
  * @param {Date|Number} date - the date to be changed
11440
10968
  * @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`.
11441
10969
  * @returns {Date} the new date with the milliseconds subtracted
@@ -11443,119 +10971,27 @@ function addMilliseconds(dirtyDate, dirtyAmount) {
11443
10971
  *
11444
10972
  * @example
11445
10973
  * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
11446
- * var result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
10974
+ * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
11447
10975
  * //=> Thu Jul 10 2014 12:45:29.250
11448
10976
  */
11449
-
11450
10977
  function subMilliseconds(dirtyDate, dirtyAmount) {
11451
10978
  requiredArgs(2, arguments);
11452
10979
  var amount = toInteger(dirtyAmount);
11453
10980
  return addMilliseconds(dirtyDate, -amount);
11454
10981
  }
11455
10982
 
11456
- function addLeadingZeros(number, targetLength) {
11457
- var sign = number < 0 ? '-' : '';
11458
- var output = Math.abs(number).toString();
11459
- while (output.length < targetLength) {
11460
- output = '0' + output;
11461
- }
11462
- return sign + output;
10983
+ var MILLISECONDS_IN_DAY = 86400000;
10984
+ function getUTCDayOfYear(dirtyDate) {
10985
+ requiredArgs(1, arguments);
10986
+ var date = toDate(dirtyDate);
10987
+ var timestamp = date.getTime();
10988
+ date.setUTCMonth(0, 1);
10989
+ date.setUTCHours(0, 0, 0, 0);
10990
+ var startOfYearTimestamp = date.getTime();
10991
+ var difference = timestamp - startOfYearTimestamp;
10992
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
11463
10993
  }
11464
10994
 
11465
- /*
11466
- * | | Unit | | Unit |
11467
- * |-----|--------------------------------|-----|--------------------------------|
11468
- * | a | AM, PM | A* | |
11469
- * | d | Day of month | D | |
11470
- * | h | Hour [1-12] | H | Hour [0-23] |
11471
- * | m | Minute | M | Month |
11472
- * | s | Second | S | Fraction of second |
11473
- * | y | Year (abs) | Y | |
11474
- *
11475
- * Letters marked by * are not implemented but reserved by Unicode standard.
11476
- */
11477
-
11478
- var formatters$1 = {
11479
- // Year
11480
- y: function y(date, token) {
11481
- // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
11482
- // | Year | y | yy | yyy | yyyy | yyyyy |
11483
- // |----------|-------|----|-------|-------|-------|
11484
- // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
11485
- // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
11486
- // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
11487
- // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
11488
- // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
11489
- var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
11490
-
11491
- var year = signedYear > 0 ? signedYear : 1 - signedYear;
11492
- return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
11493
- },
11494
- // Month
11495
- M: function M(date, token) {
11496
- var month = date.getUTCMonth();
11497
- return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
11498
- },
11499
- // Day of the month
11500
- d: function d(date, token) {
11501
- return addLeadingZeros(date.getUTCDate(), token.length);
11502
- },
11503
- // AM or PM
11504
- a: function a(date, token) {
11505
- var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
11506
- switch (token) {
11507
- case 'a':
11508
- case 'aa':
11509
- case 'aaa':
11510
- return dayPeriodEnumValue.toUpperCase();
11511
- case 'aaaaa':
11512
- return dayPeriodEnumValue[0];
11513
- case 'aaaa':
11514
- default:
11515
- return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
11516
- }
11517
- },
11518
- // Hour [1-12]
11519
- h: function h(date, token) {
11520
- return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
11521
- },
11522
- // Hour [0-23]
11523
- H: function H(date, token) {
11524
- return addLeadingZeros(date.getUTCHours(), token.length);
11525
- },
11526
- // Minute
11527
- m: function m(date, token) {
11528
- return addLeadingZeros(date.getUTCMinutes(), token.length);
11529
- },
11530
- // Second
11531
- s: function s(date, token) {
11532
- return addLeadingZeros(date.getUTCSeconds(), token.length);
11533
- },
11534
- // Fraction of second
11535
- S: function S(date, token) {
11536
- var numberOfDigits = token.length;
11537
- var milliseconds = date.getUTCMilliseconds();
11538
- var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
11539
- return addLeadingZeros(fractionalSeconds, token.length);
11540
- }
11541
- };
11542
-
11543
- var MILLISECONDS_IN_DAY = 86400000; // This function will be a part of public API when UTC function will be implemented.
11544
- // See issue: https://github.com/date-fns/date-fns/issues/376
11545
-
11546
- function getUTCDayOfYear(dirtyDate) {
11547
- requiredArgs(1, arguments);
11548
- var date = toDate(dirtyDate);
11549
- var timestamp = date.getTime();
11550
- date.setUTCMonth(0, 1);
11551
- date.setUTCHours(0, 0, 0, 0);
11552
- var startOfYearTimestamp = date.getTime();
11553
- var difference = timestamp - startOfYearTimestamp;
11554
- return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
11555
- }
11556
-
11557
- // See issue: https://github.com/date-fns/date-fns/issues/376
11558
-
11559
10995
  function startOfUTCISOWeek(dirtyDate) {
11560
10996
  requiredArgs(1, arguments);
11561
10997
  var weekStartsOn = 1;
@@ -11567,8 +11003,6 @@ function startOfUTCISOWeek(dirtyDate) {
11567
11003
  return date;
11568
11004
  }
11569
11005
 
11570
- // See issue: https://github.com/date-fns/date-fns/issues/376
11571
-
11572
11006
  function getUTCISOWeekYear(dirtyDate) {
11573
11007
  requiredArgs(1, arguments);
11574
11008
  var date = toDate(dirtyDate);
@@ -11590,8 +11024,6 @@ function getUTCISOWeekYear(dirtyDate) {
11590
11024
  }
11591
11025
  }
11592
11026
 
11593
- // See issue: https://github.com/date-fns/date-fns/issues/376
11594
-
11595
11027
  function startOfUTCISOWeekYear(dirtyDate) {
11596
11028
  requiredArgs(1, arguments);
11597
11029
  var year = getUTCISOWeekYear(dirtyDate);
@@ -11602,29 +11034,33 @@ function startOfUTCISOWeekYear(dirtyDate) {
11602
11034
  return date;
11603
11035
  }
11604
11036
 
11605
- var MILLISECONDS_IN_WEEK$1 = 604800000; // This function will be a part of public API when UTC function will be implemented.
11606
- // See issue: https://github.com/date-fns/date-fns/issues/376
11607
-
11037
+ var MILLISECONDS_IN_WEEK$1 = 604800000;
11608
11038
  function getUTCISOWeek(dirtyDate) {
11609
11039
  requiredArgs(1, arguments);
11610
11040
  var date = toDate(dirtyDate);
11611
- var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer
11041
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
11042
+
11043
+ // Round the number of days to the nearest integer
11612
11044
  // because the number of milliseconds in a week is not constant
11613
11045
  // (e.g. it's different in the week of the daylight saving time clock shift)
11614
-
11615
11046
  return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
11616
11047
  }
11617
11048
 
11618
- // See issue: https://github.com/date-fns/date-fns/issues/376
11049
+ var defaultOptions = {};
11050
+ function getDefaultOptions() {
11051
+ return defaultOptions;
11052
+ }
11053
+ function setDefaultOptions$1(newOptions) {
11054
+ defaultOptions = newOptions;
11055
+ }
11619
11056
 
11620
- function startOfUTCWeek(dirtyDate, dirtyOptions) {
11057
+ function startOfUTCWeek(dirtyDate, options) {
11058
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
11621
11059
  requiredArgs(1, arguments);
11622
- var options = dirtyOptions || {};
11623
- var locale = options.locale;
11624
- var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;
11625
- var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
11626
- var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
11060
+ var defaultOptions = getDefaultOptions();
11061
+ 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);
11627
11062
 
11063
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
11628
11064
  if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
11629
11065
  throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
11630
11066
  }
@@ -11636,29 +11072,26 @@ function startOfUTCWeek(dirtyDate, dirtyOptions) {
11636
11072
  return date;
11637
11073
  }
11638
11074
 
11639
- // See issue: https://github.com/date-fns/date-fns/issues/376
11640
-
11641
- function getUTCWeekYear(dirtyDate, dirtyOptions) {
11075
+ function getUTCWeekYear(dirtyDate, options) {
11076
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
11642
11077
  requiredArgs(1, arguments);
11643
- var date = toDate(dirtyDate, dirtyOptions);
11078
+ var date = toDate(dirtyDate);
11644
11079
  var year = date.getUTCFullYear();
11645
- var options = dirtyOptions || {};
11646
- var locale = options.locale;
11647
- var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
11648
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
11649
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
11080
+ var defaultOptions = getDefaultOptions();
11081
+ 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);
11650
11082
 
11083
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
11651
11084
  if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
11652
11085
  throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
11653
11086
  }
11654
11087
  var firstWeekOfNextYear = new Date(0);
11655
11088
  firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
11656
11089
  firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
11657
- var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, dirtyOptions);
11090
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
11658
11091
  var firstWeekOfThisYear = new Date(0);
11659
11092
  firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
11660
11093
  firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
11661
- var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, dirtyOptions);
11094
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
11662
11095
  if (date.getTime() >= startOfNextYear.getTime()) {
11663
11096
  return year + 1;
11664
11097
  } else if (date.getTime() >= startOfThisYear.getTime()) {
@@ -11668,36 +11101,119 @@ function getUTCWeekYear(dirtyDate, dirtyOptions) {
11668
11101
  }
11669
11102
  }
11670
11103
 
11671
- // See issue: https://github.com/date-fns/date-fns/issues/376
11672
-
11673
- function startOfUTCWeekYear(dirtyDate, dirtyOptions) {
11104
+ function startOfUTCWeekYear(dirtyDate, options) {
11105
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
11674
11106
  requiredArgs(1, arguments);
11675
- var options = dirtyOptions || {};
11676
- var locale = options.locale;
11677
- var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
11678
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
11679
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
11680
- var year = getUTCWeekYear(dirtyDate, dirtyOptions);
11107
+ var defaultOptions = getDefaultOptions();
11108
+ 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);
11109
+ var year = getUTCWeekYear(dirtyDate, options);
11681
11110
  var firstWeek = new Date(0);
11682
11111
  firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
11683
11112
  firstWeek.setUTCHours(0, 0, 0, 0);
11684
- var date = startOfUTCWeek(firstWeek, dirtyOptions);
11113
+ var date = startOfUTCWeek(firstWeek, options);
11685
11114
  return date;
11686
11115
  }
11687
11116
 
11688
- var MILLISECONDS_IN_WEEK = 604800000; // This function will be a part of public API when UTC function will be implemented.
11689
- // See issue: https://github.com/date-fns/date-fns/issues/376
11690
-
11117
+ var MILLISECONDS_IN_WEEK = 604800000;
11691
11118
  function getUTCWeek(dirtyDate, options) {
11692
11119
  requiredArgs(1, arguments);
11693
11120
  var date = toDate(dirtyDate);
11694
- var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer
11121
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
11122
+
11123
+ // Round the number of days to the nearest integer
11695
11124
  // because the number of milliseconds in a week is not constant
11696
11125
  // (e.g. it's different in the week of the daylight saving time clock shift)
11697
-
11698
11126
  return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
11699
11127
  }
11700
11128
 
11129
+ function addLeadingZeros(number, targetLength) {
11130
+ var sign = number < 0 ? '-' : '';
11131
+ var output = Math.abs(number).toString();
11132
+ while (output.length < targetLength) {
11133
+ output = '0' + output;
11134
+ }
11135
+ return sign + output;
11136
+ }
11137
+
11138
+ /*
11139
+ * | | Unit | | Unit |
11140
+ * |-----|--------------------------------|-----|--------------------------------|
11141
+ * | a | AM, PM | A* | |
11142
+ * | d | Day of month | D | |
11143
+ * | h | Hour [1-12] | H | Hour [0-23] |
11144
+ * | m | Minute | M | Month |
11145
+ * | s | Second | S | Fraction of second |
11146
+ * | y | Year (abs) | Y | |
11147
+ *
11148
+ * Letters marked by * are not implemented but reserved by Unicode standard.
11149
+ */
11150
+ var formatters$1 = {
11151
+ // Year
11152
+ y: function y(date, token) {
11153
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
11154
+ // | Year | y | yy | yyy | yyyy | yyyyy |
11155
+ // |----------|-------|----|-------|-------|-------|
11156
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
11157
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
11158
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
11159
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
11160
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
11161
+
11162
+ var signedYear = date.getUTCFullYear();
11163
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
11164
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
11165
+ return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
11166
+ },
11167
+ // Month
11168
+ M: function M(date, token) {
11169
+ var month = date.getUTCMonth();
11170
+ return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
11171
+ },
11172
+ // Day of the month
11173
+ d: function d(date, token) {
11174
+ return addLeadingZeros(date.getUTCDate(), token.length);
11175
+ },
11176
+ // AM or PM
11177
+ a: function a(date, token) {
11178
+ var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
11179
+ switch (token) {
11180
+ case 'a':
11181
+ case 'aa':
11182
+ return dayPeriodEnumValue.toUpperCase();
11183
+ case 'aaa':
11184
+ return dayPeriodEnumValue;
11185
+ case 'aaaaa':
11186
+ return dayPeriodEnumValue[0];
11187
+ case 'aaaa':
11188
+ default:
11189
+ return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
11190
+ }
11191
+ },
11192
+ // Hour [1-12]
11193
+ h: function h(date, token) {
11194
+ return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
11195
+ },
11196
+ // Hour [0-23]
11197
+ H: function H(date, token) {
11198
+ return addLeadingZeros(date.getUTCHours(), token.length);
11199
+ },
11200
+ // Minute
11201
+ m: function m(date, token) {
11202
+ return addLeadingZeros(date.getUTCMinutes(), token.length);
11203
+ },
11204
+ // Second
11205
+ s: function s(date, token) {
11206
+ return addLeadingZeros(date.getUTCSeconds(), token.length);
11207
+ },
11208
+ // Fraction of second
11209
+ S: function S(date, token) {
11210
+ var numberOfDigits = token.length;
11211
+ var milliseconds = date.getUTCMilliseconds();
11212
+ var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
11213
+ return addLeadingZeros(fractionalSeconds, token.length);
11214
+ }
11215
+ };
11216
+
11701
11217
  var dayPeriodEnum = {
11702
11218
  am: 'am',
11703
11219
  pm: 'pm',
@@ -11707,52 +11223,52 @@ var dayPeriodEnum = {
11707
11223
  afternoon: 'afternoon',
11708
11224
  evening: 'evening',
11709
11225
  night: 'night'
11710
- /*
11711
- * | | Unit | | Unit |
11712
- * |-----|--------------------------------|-----|--------------------------------|
11713
- * | a | AM, PM | A* | Milliseconds in day |
11714
- * | b | AM, PM, noon, midnight | B | Flexible day period |
11715
- * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
11716
- * | d | Day of month | D | Day of year |
11717
- * | e | Local day of week | E | Day of week |
11718
- * | f | | F* | Day of week in month |
11719
- * | g* | Modified Julian day | G | Era |
11720
- * | h | Hour [1-12] | H | Hour [0-23] |
11721
- * | i! | ISO day of week | I! | ISO week of year |
11722
- * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
11723
- * | k | Hour [1-24] | K | Hour [0-11] |
11724
- * | l* | (deprecated) | L | Stand-alone month |
11725
- * | m | Minute | M | Month |
11726
- * | n | | N | |
11727
- * | o! | Ordinal number modifier | O | Timezone (GMT) |
11728
- * | p! | Long localized time | P! | Long localized date |
11729
- * | q | Stand-alone quarter | Q | Quarter |
11730
- * | r* | Related Gregorian year | R! | ISO week-numbering year |
11731
- * | s | Second | S | Fraction of second |
11732
- * | t! | Seconds timestamp | T! | Milliseconds timestamp |
11733
- * | u | Extended year | U* | Cyclic year |
11734
- * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
11735
- * | w | Local week of year | W* | Week of month |
11736
- * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
11737
- * | y | Year (abs) | Y | Local week-numbering year |
11738
- * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
11739
- *
11740
- * Letters marked by * are not implemented but reserved by Unicode standard.
11741
- *
11742
- * Letters marked by ! are non-standard, but implemented by date-fns:
11743
- * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
11744
- * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
11745
- * i.e. 7 for Sunday, 1 for Monday, etc.
11746
- * - `I` is ISO week of year, as opposed to `w` which is local week of year.
11747
- * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
11748
- * `R` is supposed to be used in conjunction with `I` and `i`
11749
- * for universal ISO week-numbering date, whereas
11750
- * `Y` is supposed to be used in conjunction with `w` and `e`
11751
- * for week-numbering date specific to the locale.
11752
- * - `P` is long localized date format
11753
- * - `p` is long localized time format
11754
- */
11755
11226
  };
11227
+ /*
11228
+ * | | Unit | | Unit |
11229
+ * |-----|--------------------------------|-----|--------------------------------|
11230
+ * | a | AM, PM | A* | Milliseconds in day |
11231
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
11232
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
11233
+ * | d | Day of month | D | Day of year |
11234
+ * | e | Local day of week | E | Day of week |
11235
+ * | f | | F* | Day of week in month |
11236
+ * | g* | Modified Julian day | G | Era |
11237
+ * | h | Hour [1-12] | H | Hour [0-23] |
11238
+ * | i! | ISO day of week | I! | ISO week of year |
11239
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
11240
+ * | k | Hour [1-24] | K | Hour [0-11] |
11241
+ * | l* | (deprecated) | L | Stand-alone month |
11242
+ * | m | Minute | M | Month |
11243
+ * | n | | N | |
11244
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
11245
+ * | p! | Long localized time | P! | Long localized date |
11246
+ * | q | Stand-alone quarter | Q | Quarter |
11247
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
11248
+ * | s | Second | S | Fraction of second |
11249
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
11250
+ * | u | Extended year | U* | Cyclic year |
11251
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
11252
+ * | w | Local week of year | W* | Week of month |
11253
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
11254
+ * | y | Year (abs) | Y | Local week-numbering year |
11255
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
11256
+ *
11257
+ * Letters marked by * are not implemented but reserved by Unicode standard.
11258
+ *
11259
+ * Letters marked by ! are non-standard, but implemented by date-fns:
11260
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
11261
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
11262
+ * i.e. 7 for Sunday, 1 for Monday, etc.
11263
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
11264
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
11265
+ * `R` is supposed to be used in conjunction with `I` and `i`
11266
+ * for universal ISO week-numbering date, whereas
11267
+ * `Y` is supposed to be used in conjunction with `w` and `e`
11268
+ * for week-numbering date specific to the locale.
11269
+ * - `P` is long localized date format
11270
+ * - `p` is long localized time format
11271
+ */
11756
11272
 
11757
11273
  var formatters = {
11758
11274
  // Era
@@ -11767,13 +11283,11 @@ var formatters = {
11767
11283
  width: 'abbreviated'
11768
11284
  });
11769
11285
  // A, B
11770
-
11771
11286
  case 'GGGGG':
11772
11287
  return localize.era(era, {
11773
11288
  width: 'narrow'
11774
11289
  });
11775
11290
  // Anno Domini, Before Christ
11776
-
11777
11291
  case 'GGGG':
11778
11292
  default:
11779
11293
  return localize.era(era, {
@@ -11785,8 +11299,8 @@ var formatters = {
11785
11299
  y: function y(date, token, localize) {
11786
11300
  // Ordinal number
11787
11301
  if (token === 'yo') {
11788
- var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
11789
-
11302
+ var signedYear = date.getUTCFullYear();
11303
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
11790
11304
  var year = signedYear > 0 ? signedYear : 1 - signedYear;
11791
11305
  return localize.ordinalNumber(year, {
11792
11306
  unit: 'year'
@@ -11796,27 +11310,31 @@ var formatters = {
11796
11310
  },
11797
11311
  // Local week-numbering year
11798
11312
  Y: function Y(date, token, localize, options) {
11799
- var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)
11800
-
11801
- var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year
11313
+ var signedWeekYear = getUTCWeekYear(date, options);
11314
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
11315
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
11802
11316
 
11317
+ // Two digit year
11803
11318
  if (token === 'YY') {
11804
11319
  var twoDigitYear = weekYear % 100;
11805
11320
  return addLeadingZeros(twoDigitYear, 2);
11806
- } // Ordinal number
11321
+ }
11807
11322
 
11323
+ // Ordinal number
11808
11324
  if (token === 'Yo') {
11809
11325
  return localize.ordinalNumber(weekYear, {
11810
11326
  unit: 'year'
11811
11327
  });
11812
- } // Padding
11328
+ }
11813
11329
 
11330
+ // Padding
11814
11331
  return addLeadingZeros(weekYear, token.length);
11815
11332
  },
11816
11333
  // ISO week-numbering year
11817
11334
  R: function R(date, token) {
11818
- var isoWeekYear = getUTCISOWeekYear(date); // Padding
11335
+ var isoWeekYear = getUTCISOWeekYear(date);
11819
11336
 
11337
+ // Padding
11820
11338
  return addLeadingZeros(isoWeekYear, token.length);
11821
11339
  },
11822
11340
  // Extended year. This is a single number designating the year of this calendar system.
@@ -11840,31 +11358,26 @@ var formatters = {
11840
11358
  case 'Q':
11841
11359
  return String(quarter);
11842
11360
  // 01, 02, 03, 04
11843
-
11844
11361
  case 'QQ':
11845
11362
  return addLeadingZeros(quarter, 2);
11846
11363
  // 1st, 2nd, 3rd, 4th
11847
-
11848
11364
  case 'Qo':
11849
11365
  return localize.ordinalNumber(quarter, {
11850
11366
  unit: 'quarter'
11851
11367
  });
11852
11368
  // Q1, Q2, Q3, Q4
11853
-
11854
11369
  case 'QQQ':
11855
11370
  return localize.quarter(quarter, {
11856
11371
  width: 'abbreviated',
11857
11372
  context: 'formatting'
11858
11373
  });
11859
11374
  // 1, 2, 3, 4 (narrow quarter; could be not numerical)
11860
-
11861
11375
  case 'QQQQQ':
11862
11376
  return localize.quarter(quarter, {
11863
11377
  width: 'narrow',
11864
11378
  context: 'formatting'
11865
11379
  });
11866
11380
  // 1st quarter, 2nd quarter, ...
11867
-
11868
11381
  case 'QQQQ':
11869
11382
  default:
11870
11383
  return localize.quarter(quarter, {
@@ -11881,31 +11394,26 @@ var formatters = {
11881
11394
  case 'q':
11882
11395
  return String(quarter);
11883
11396
  // 01, 02, 03, 04
11884
-
11885
11397
  case 'qq':
11886
11398
  return addLeadingZeros(quarter, 2);
11887
11399
  // 1st, 2nd, 3rd, 4th
11888
-
11889
11400
  case 'qo':
11890
11401
  return localize.ordinalNumber(quarter, {
11891
11402
  unit: 'quarter'
11892
11403
  });
11893
11404
  // Q1, Q2, Q3, Q4
11894
-
11895
11405
  case 'qqq':
11896
11406
  return localize.quarter(quarter, {
11897
11407
  width: 'abbreviated',
11898
11408
  context: 'standalone'
11899
11409
  });
11900
11410
  // 1, 2, 3, 4 (narrow quarter; could be not numerical)
11901
-
11902
11411
  case 'qqqqq':
11903
11412
  return localize.quarter(quarter, {
11904
11413
  width: 'narrow',
11905
11414
  context: 'standalone'
11906
11415
  });
11907
11416
  // 1st quarter, 2nd quarter, ...
11908
-
11909
11417
  case 'qqqq':
11910
11418
  default:
11911
11419
  return localize.quarter(quarter, {
@@ -11922,27 +11430,23 @@ var formatters = {
11922
11430
  case 'MM':
11923
11431
  return formatters$1.M(date, token);
11924
11432
  // 1st, 2nd, ..., 12th
11925
-
11926
11433
  case 'Mo':
11927
11434
  return localize.ordinalNumber(month + 1, {
11928
11435
  unit: 'month'
11929
11436
  });
11930
11437
  // Jan, Feb, ..., Dec
11931
-
11932
11438
  case 'MMM':
11933
11439
  return localize.month(month, {
11934
11440
  width: 'abbreviated',
11935
11441
  context: 'formatting'
11936
11442
  });
11937
11443
  // J, F, ..., D
11938
-
11939
11444
  case 'MMMMM':
11940
11445
  return localize.month(month, {
11941
11446
  width: 'narrow',
11942
11447
  context: 'formatting'
11943
11448
  });
11944
11449
  // January, February, ..., December
11945
-
11946
11450
  case 'MMMM':
11947
11451
  default:
11948
11452
  return localize.month(month, {
@@ -11959,31 +11463,26 @@ var formatters = {
11959
11463
  case 'L':
11960
11464
  return String(month + 1);
11961
11465
  // 01, 02, ..., 12
11962
-
11963
11466
  case 'LL':
11964
11467
  return addLeadingZeros(month + 1, 2);
11965
11468
  // 1st, 2nd, ..., 12th
11966
-
11967
11469
  case 'Lo':
11968
11470
  return localize.ordinalNumber(month + 1, {
11969
11471
  unit: 'month'
11970
11472
  });
11971
11473
  // Jan, Feb, ..., Dec
11972
-
11973
11474
  case 'LLL':
11974
11475
  return localize.month(month, {
11975
11476
  width: 'abbreviated',
11976
11477
  context: 'standalone'
11977
11478
  });
11978
11479
  // J, F, ..., D
11979
-
11980
11480
  case 'LLLLL':
11981
11481
  return localize.month(month, {
11982
11482
  width: 'narrow',
11983
11483
  context: 'standalone'
11984
11484
  });
11985
11485
  // January, February, ..., December
11986
-
11987
11486
  case 'LLLL':
11988
11487
  default:
11989
11488
  return localize.month(month, {
@@ -12044,21 +11543,18 @@ var formatters = {
12044
11543
  context: 'formatting'
12045
11544
  });
12046
11545
  // T
12047
-
12048
11546
  case 'EEEEE':
12049
11547
  return localize.day(dayOfWeek, {
12050
11548
  width: 'narrow',
12051
11549
  context: 'formatting'
12052
11550
  });
12053
11551
  // Tu
12054
-
12055
11552
  case 'EEEEEE':
12056
11553
  return localize.day(dayOfWeek, {
12057
11554
  width: 'short',
12058
11555
  context: 'formatting'
12059
11556
  });
12060
11557
  // Tuesday
12061
-
12062
11558
  case 'EEEE':
12063
11559
  default:
12064
11560
  return localize.day(dayOfWeek, {
@@ -12076,11 +11572,9 @@ var formatters = {
12076
11572
  case 'e':
12077
11573
  return String(localDayOfWeek);
12078
11574
  // Padded numerical value
12079
-
12080
11575
  case 'ee':
12081
11576
  return addLeadingZeros(localDayOfWeek, 2);
12082
11577
  // 1st, 2nd, ..., 7th
12083
-
12084
11578
  case 'eo':
12085
11579
  return localize.ordinalNumber(localDayOfWeek, {
12086
11580
  unit: 'day'
@@ -12091,21 +11585,18 @@ var formatters = {
12091
11585
  context: 'formatting'
12092
11586
  });
12093
11587
  // T
12094
-
12095
11588
  case 'eeeee':
12096
11589
  return localize.day(dayOfWeek, {
12097
11590
  width: 'narrow',
12098
11591
  context: 'formatting'
12099
11592
  });
12100
11593
  // Tu
12101
-
12102
11594
  case 'eeeeee':
12103
11595
  return localize.day(dayOfWeek, {
12104
11596
  width: 'short',
12105
11597
  context: 'formatting'
12106
11598
  });
12107
11599
  // Tuesday
12108
-
12109
11600
  case 'eeee':
12110
11601
  default:
12111
11602
  return localize.day(dayOfWeek, {
@@ -12123,11 +11614,9 @@ var formatters = {
12123
11614
  case 'c':
12124
11615
  return String(localDayOfWeek);
12125
11616
  // Padded numerical value
12126
-
12127
11617
  case 'cc':
12128
11618
  return addLeadingZeros(localDayOfWeek, token.length);
12129
11619
  // 1st, 2nd, ..., 7th
12130
-
12131
11620
  case 'co':
12132
11621
  return localize.ordinalNumber(localDayOfWeek, {
12133
11622
  unit: 'day'
@@ -12138,21 +11627,18 @@ var formatters = {
12138
11627
  context: 'standalone'
12139
11628
  });
12140
11629
  // T
12141
-
12142
11630
  case 'ccccc':
12143
11631
  return localize.day(dayOfWeek, {
12144
11632
  width: 'narrow',
12145
11633
  context: 'standalone'
12146
11634
  });
12147
11635
  // Tu
12148
-
12149
11636
  case 'cccccc':
12150
11637
  return localize.day(dayOfWeek, {
12151
11638
  width: 'short',
12152
11639
  context: 'standalone'
12153
11640
  });
12154
11641
  // Tuesday
12155
-
12156
11642
  case 'cccc':
12157
11643
  default:
12158
11644
  return localize.day(dayOfWeek, {
@@ -12170,38 +11656,32 @@ var formatters = {
12170
11656
  case 'i':
12171
11657
  return String(isoDayOfWeek);
12172
11658
  // 02
12173
-
12174
11659
  case 'ii':
12175
11660
  return addLeadingZeros(isoDayOfWeek, token.length);
12176
11661
  // 2nd
12177
-
12178
11662
  case 'io':
12179
11663
  return localize.ordinalNumber(isoDayOfWeek, {
12180
11664
  unit: 'day'
12181
11665
  });
12182
11666
  // Tue
12183
-
12184
11667
  case 'iii':
12185
11668
  return localize.day(dayOfWeek, {
12186
11669
  width: 'abbreviated',
12187
11670
  context: 'formatting'
12188
11671
  });
12189
11672
  // T
12190
-
12191
11673
  case 'iiiii':
12192
11674
  return localize.day(dayOfWeek, {
12193
11675
  width: 'narrow',
12194
11676
  context: 'formatting'
12195
11677
  });
12196
11678
  // Tu
12197
-
12198
11679
  case 'iiiiii':
12199
11680
  return localize.day(dayOfWeek, {
12200
11681
  width: 'short',
12201
11682
  context: 'formatting'
12202
11683
  });
12203
11684
  // Tuesday
12204
-
12205
11685
  case 'iiii':
12206
11686
  default:
12207
11687
  return localize.day(dayOfWeek, {
@@ -12217,11 +11697,15 @@ var formatters = {
12217
11697
  switch (token) {
12218
11698
  case 'a':
12219
11699
  case 'aa':
12220
- case 'aaa':
12221
11700
  return localize.dayPeriod(dayPeriodEnumValue, {
12222
11701
  width: 'abbreviated',
12223
11702
  context: 'formatting'
12224
11703
  });
11704
+ case 'aaa':
11705
+ return localize.dayPeriod(dayPeriodEnumValue, {
11706
+ width: 'abbreviated',
11707
+ context: 'formatting'
11708
+ }).toLowerCase();
12225
11709
  case 'aaaaa':
12226
11710
  return localize.dayPeriod(dayPeriodEnumValue, {
12227
11711
  width: 'narrow',
@@ -12249,11 +11733,15 @@ var formatters = {
12249
11733
  switch (token) {
12250
11734
  case 'b':
12251
11735
  case 'bb':
12252
- case 'bbb':
12253
11736
  return localize.dayPeriod(dayPeriodEnumValue, {
12254
11737
  width: 'abbreviated',
12255
11738
  context: 'formatting'
12256
11739
  });
11740
+ case 'bbb':
11741
+ return localize.dayPeriod(dayPeriodEnumValue, {
11742
+ width: 'abbreviated',
11743
+ context: 'formatting'
11744
+ }).toLowerCase();
12257
11745
  case 'bbbbb':
12258
11746
  return localize.dayPeriod(dayPeriodEnumValue, {
12259
11747
  width: 'narrow',
@@ -12375,21 +11863,20 @@ var formatters = {
12375
11863
  // Hours and optional minutes
12376
11864
  case 'X':
12377
11865
  return formatTimezoneWithOptionalMinutes(timezoneOffset);
11866
+
12378
11867
  // Hours, minutes and optional seconds without `:` delimiter
12379
11868
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
12380
11869
  // so this token always has the same output as `XX`
12381
-
12382
11870
  case 'XXXX':
12383
11871
  case 'XX':
12384
11872
  // Hours and minutes without `:` delimiter
12385
11873
  return formatTimezone(timezoneOffset);
11874
+
12386
11875
  // Hours, minutes and optional seconds with `:` delimiter
12387
11876
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
12388
11877
  // so this token always has the same output as `XXX`
12389
-
12390
11878
  case 'XXXXX':
12391
11879
  case 'XXX': // Hours and minutes with `:` delimiter
12392
-
12393
11880
  default:
12394
11881
  return formatTimezone(timezoneOffset, ':');
12395
11882
  }
@@ -12402,21 +11889,20 @@ var formatters = {
12402
11889
  // Hours and optional minutes
12403
11890
  case 'x':
12404
11891
  return formatTimezoneWithOptionalMinutes(timezoneOffset);
11892
+
12405
11893
  // Hours, minutes and optional seconds without `:` delimiter
12406
11894
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
12407
11895
  // so this token always has the same output as `xx`
12408
-
12409
11896
  case 'xxxx':
12410
11897
  case 'xx':
12411
11898
  // Hours and minutes without `:` delimiter
12412
11899
  return formatTimezone(timezoneOffset);
11900
+
12413
11901
  // Hours, minutes and optional seconds with `:` delimiter
12414
11902
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
12415
11903
  // so this token always has the same output as `xxx`
12416
-
12417
11904
  case 'xxxxx':
12418
11905
  case 'xxx': // Hours and minutes with `:` delimiter
12419
-
12420
11906
  default:
12421
11907
  return formatTimezone(timezoneOffset, ':');
12422
11908
  }
@@ -12432,7 +11918,6 @@ var formatters = {
12432
11918
  case 'OOO':
12433
11919
  return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
12434
11920
  // Long
12435
-
12436
11921
  case 'OOOO':
12437
11922
  default:
12438
11923
  return 'GMT' + formatTimezone(timezoneOffset, ':');
@@ -12449,7 +11934,6 @@ var formatters = {
12449
11934
  case 'zzz':
12450
11935
  return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
12451
11936
  // Long
12452
-
12453
11937
  case 'zzzz':
12454
11938
  default:
12455
11939
  return 'GMT' + formatTimezone(timezoneOffset, ':');
@@ -12495,7 +11979,7 @@ function formatTimezone(offset, dirtyDelimiter) {
12495
11979
  return sign + hours + delimiter + minutes;
12496
11980
  }
12497
11981
 
12498
- function dateLongFormatter(pattern, formatLong) {
11982
+ var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
12499
11983
  switch (pattern) {
12500
11984
  case 'P':
12501
11985
  return formatLong.date({
@@ -12515,8 +11999,8 @@ function dateLongFormatter(pattern, formatLong) {
12515
11999
  width: 'full'
12516
12000
  });
12517
12001
  }
12518
- }
12519
- function timeLongFormatter(pattern, formatLong) {
12002
+ };
12003
+ var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
12520
12004
  switch (pattern) {
12521
12005
  case 'p':
12522
12006
  return formatLong.time({
@@ -12536,9 +12020,9 @@ function timeLongFormatter(pattern, formatLong) {
12536
12020
  width: 'full'
12537
12021
  });
12538
12022
  }
12539
- }
12540
- function dateTimeLongFormatter(pattern, formatLong) {
12541
- var matchResult = pattern.match(/(P+)(p+)?/);
12023
+ };
12024
+ var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
12025
+ var matchResult = pattern.match(/(P+)(p+)?/) || [];
12542
12026
  var datePattern = matchResult[1];
12543
12027
  var timePattern = matchResult[2];
12544
12028
  if (!timePattern) {
@@ -12569,16 +12053,12 @@ function dateTimeLongFormatter(pattern, formatLong) {
12569
12053
  break;
12570
12054
  }
12571
12055
  return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
12572
- }
12056
+ };
12573
12057
  var longFormatters = {
12574
12058
  p: timeLongFormatter,
12575
12059
  P: dateTimeLongFormatter
12576
12060
  };
12577
12061
 
12578
- var MILLISECONDS_IN_MINUTE = 60000;
12579
- function getDateMillisecondsPart(date) {
12580
- return date.getTime() % MILLISECONDS_IN_MINUTE;
12581
- }
12582
12062
  /**
12583
12063
  * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
12584
12064
  * They usually appear for dates that denote time before the timezones were introduced
@@ -12590,14 +12070,10 @@ function getDateMillisecondsPart(date) {
12590
12070
  *
12591
12071
  * This function returns the timezone offset in milliseconds that takes seconds in account.
12592
12072
  */
12593
-
12594
- function getTimezoneOffsetInMilliseconds(dirtyDate) {
12595
- var date = new Date(dirtyDate.getTime());
12596
- var baseTimezoneOffset = Math.ceil(date.getTimezoneOffset());
12597
- date.setSeconds(0, 0);
12598
- var hasNegativeUTCOffset = baseTimezoneOffset > 0;
12599
- var millisecondsPartOfTimezoneOffset = hasNegativeUTCOffset ? (MILLISECONDS_IN_MINUTE + getDateMillisecondsPart(date)) % MILLISECONDS_IN_MINUTE : getDateMillisecondsPart(date);
12600
- return baseTimezoneOffset * MILLISECONDS_IN_MINUTE + millisecondsPartOfTimezoneOffset;
12073
+ function getTimezoneOffsetInMilliseconds(date) {
12074
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
12075
+ utcDate.setUTCFullYear(date.getFullYear());
12076
+ return date.getTime() - utcDate.getTime();
12601
12077
  }
12602
12078
 
12603
12079
  var protectedDayOfYearTokens = ['D', 'DD'];
@@ -12610,16 +12086,494 @@ function isProtectedWeekYearToken(token) {
12610
12086
  }
12611
12087
  function throwProtectedError(token, format, input) {
12612
12088
  if (token === 'YYYY') {
12613
- throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
12089
+ 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"));
12614
12090
  } else if (token === 'YY') {
12615
- throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
12091
+ 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"));
12616
12092
  } else if (token === 'D') {
12617
- 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"));
12093
+ 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"));
12618
12094
  } else if (token === 'DD') {
12619
- 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"));
12095
+ 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"));
12096
+ }
12097
+ }
12098
+
12099
+ var formatDistanceLocale$1 = {
12100
+ lessThanXSeconds: {
12101
+ one: 'less than a second',
12102
+ other: 'less than {{count}} seconds'
12103
+ },
12104
+ xSeconds: {
12105
+ one: '1 second',
12106
+ other: '{{count}} seconds'
12107
+ },
12108
+ halfAMinute: 'half a minute',
12109
+ lessThanXMinutes: {
12110
+ one: 'less than a minute',
12111
+ other: 'less than {{count}} minutes'
12112
+ },
12113
+ xMinutes: {
12114
+ one: '1 minute',
12115
+ other: '{{count}} minutes'
12116
+ },
12117
+ aboutXHours: {
12118
+ one: 'about 1 hour',
12119
+ other: 'about {{count}} hours'
12120
+ },
12121
+ xHours: {
12122
+ one: '1 hour',
12123
+ other: '{{count}} hours'
12124
+ },
12125
+ xDays: {
12126
+ one: '1 day',
12127
+ other: '{{count}} days'
12128
+ },
12129
+ aboutXWeeks: {
12130
+ one: 'about 1 week',
12131
+ other: 'about {{count}} weeks'
12132
+ },
12133
+ xWeeks: {
12134
+ one: '1 week',
12135
+ other: '{{count}} weeks'
12136
+ },
12137
+ aboutXMonths: {
12138
+ one: 'about 1 month',
12139
+ other: 'about {{count}} months'
12140
+ },
12141
+ xMonths: {
12142
+ one: '1 month',
12143
+ other: '{{count}} months'
12144
+ },
12145
+ aboutXYears: {
12146
+ one: 'about 1 year',
12147
+ other: 'about {{count}} years'
12148
+ },
12149
+ xYears: {
12150
+ one: '1 year',
12151
+ other: '{{count}} years'
12152
+ },
12153
+ overXYears: {
12154
+ one: 'over 1 year',
12155
+ other: 'over {{count}} years'
12156
+ },
12157
+ almostXYears: {
12158
+ one: 'almost 1 year',
12159
+ other: 'almost {{count}} years'
12160
+ }
12161
+ };
12162
+ var formatDistance$1 = function formatDistance(token, count, options) {
12163
+ var result;
12164
+ var tokenValue = formatDistanceLocale$1[token];
12165
+ if (typeof tokenValue === 'string') {
12166
+ result = tokenValue;
12167
+ } else if (count === 1) {
12168
+ result = tokenValue.one;
12169
+ } else {
12170
+ result = tokenValue.other.replace('{{count}}', count.toString());
12171
+ }
12172
+ if (options !== null && options !== void 0 && options.addSuffix) {
12173
+ if (options.comparison && options.comparison > 0) {
12174
+ return 'in ' + result;
12175
+ } else {
12176
+ return result + ' ago';
12177
+ }
12178
+ }
12179
+ return result;
12180
+ };
12181
+
12182
+ function buildFormatLongFn(args) {
12183
+ return function () {
12184
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12185
+ // TODO: Remove String()
12186
+ var width = options.width ? String(options.width) : args.defaultWidth;
12187
+ var format = args.formats[width] || args.formats[args.defaultWidth];
12188
+ return format;
12189
+ };
12190
+ }
12191
+
12192
+ var dateFormats$2 = {
12193
+ full: 'EEEE, MMMM do, y',
12194
+ "long": 'MMMM do, y',
12195
+ medium: 'MMM d, y',
12196
+ "short": 'MM/dd/yyyy'
12197
+ };
12198
+ var timeFormats$2 = {
12199
+ full: 'h:mm:ss a zzzz',
12200
+ "long": 'h:mm:ss a z',
12201
+ medium: 'h:mm:ss a',
12202
+ "short": 'h:mm a'
12203
+ };
12204
+ var dateTimeFormats$2 = {
12205
+ full: "{{date}} 'at' {{time}}",
12206
+ "long": "{{date}} 'at' {{time}}",
12207
+ medium: '{{date}}, {{time}}',
12208
+ "short": '{{date}}, {{time}}'
12209
+ };
12210
+ var formatLong$2 = {
12211
+ date: buildFormatLongFn({
12212
+ formats: dateFormats$2,
12213
+ defaultWidth: 'full'
12214
+ }),
12215
+ time: buildFormatLongFn({
12216
+ formats: timeFormats$2,
12217
+ defaultWidth: 'full'
12218
+ }),
12219
+ dateTime: buildFormatLongFn({
12220
+ formats: dateTimeFormats$2,
12221
+ defaultWidth: 'full'
12222
+ })
12223
+ };
12224
+
12225
+ var formatRelativeLocale = {
12226
+ lastWeek: "'last' eeee 'at' p",
12227
+ yesterday: "'yesterday at' p",
12228
+ today: "'today at' p",
12229
+ tomorrow: "'tomorrow at' p",
12230
+ nextWeek: "eeee 'at' p",
12231
+ other: 'P'
12232
+ };
12233
+ var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
12234
+ return formatRelativeLocale[token];
12235
+ };
12236
+
12237
+ function buildLocalizeFn(args) {
12238
+ return function (dirtyIndex, options) {
12239
+ var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
12240
+ var valuesArray;
12241
+ if (context === 'formatting' && args.formattingValues) {
12242
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
12243
+ var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
12244
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
12245
+ } else {
12246
+ var _defaultWidth = args.defaultWidth;
12247
+ var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
12248
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
12249
+ }
12250
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
12251
+ // @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!
12252
+ return valuesArray[index];
12253
+ };
12254
+ }
12255
+
12256
+ var eraValues = {
12257
+ narrow: ['B', 'A'],
12258
+ abbreviated: ['BC', 'AD'],
12259
+ wide: ['Before Christ', 'Anno Domini']
12260
+ };
12261
+ var quarterValues = {
12262
+ narrow: ['1', '2', '3', '4'],
12263
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
12264
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
12265
+ };
12266
+
12267
+ // Note: in English, the names of days of the week and months are capitalized.
12268
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
12269
+ // Generally, formatted dates should look like they are in the middle of a sentence,
12270
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
12271
+ var monthValues = {
12272
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
12273
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
12274
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
12275
+ };
12276
+ var dayValues = {
12277
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
12278
+ "short": ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
12279
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
12280
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
12281
+ };
12282
+ var dayPeriodValues = {
12283
+ narrow: {
12284
+ am: 'a',
12285
+ pm: 'p',
12286
+ midnight: 'mi',
12287
+ noon: 'n',
12288
+ morning: 'morning',
12289
+ afternoon: 'afternoon',
12290
+ evening: 'evening',
12291
+ night: 'night'
12292
+ },
12293
+ abbreviated: {
12294
+ am: 'AM',
12295
+ pm: 'PM',
12296
+ midnight: 'midnight',
12297
+ noon: 'noon',
12298
+ morning: 'morning',
12299
+ afternoon: 'afternoon',
12300
+ evening: 'evening',
12301
+ night: 'night'
12302
+ },
12303
+ wide: {
12304
+ am: 'a.m.',
12305
+ pm: 'p.m.',
12306
+ midnight: 'midnight',
12307
+ noon: 'noon',
12308
+ morning: 'morning',
12309
+ afternoon: 'afternoon',
12310
+ evening: 'evening',
12311
+ night: 'night'
12312
+ }
12313
+ };
12314
+ var formattingDayPeriodValues = {
12315
+ narrow: {
12316
+ am: 'a',
12317
+ pm: 'p',
12318
+ midnight: 'mi',
12319
+ noon: 'n',
12320
+ morning: 'in the morning',
12321
+ afternoon: 'in the afternoon',
12322
+ evening: 'in the evening',
12323
+ night: 'at night'
12324
+ },
12325
+ abbreviated: {
12326
+ am: 'AM',
12327
+ pm: 'PM',
12328
+ midnight: 'midnight',
12329
+ noon: 'noon',
12330
+ morning: 'in the morning',
12331
+ afternoon: 'in the afternoon',
12332
+ evening: 'in the evening',
12333
+ night: 'at night'
12334
+ },
12335
+ wide: {
12336
+ am: 'a.m.',
12337
+ pm: 'p.m.',
12338
+ midnight: 'midnight',
12339
+ noon: 'noon',
12340
+ morning: 'in the morning',
12341
+ afternoon: 'in the afternoon',
12342
+ evening: 'in the evening',
12343
+ night: 'at night'
12344
+ }
12345
+ };
12346
+ var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
12347
+ var number = Number(dirtyNumber);
12348
+
12349
+ // If ordinal numbers depend on context, for example,
12350
+ // if they are different for different grammatical genders,
12351
+ // use `options.unit`.
12352
+ //
12353
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
12354
+ // 'day', 'hour', 'minute', 'second'.
12355
+
12356
+ var rem100 = number % 100;
12357
+ if (rem100 > 20 || rem100 < 10) {
12358
+ switch (rem100 % 10) {
12359
+ case 1:
12360
+ return number + 'st';
12361
+ case 2:
12362
+ return number + 'nd';
12363
+ case 3:
12364
+ return number + 'rd';
12365
+ }
12366
+ }
12367
+ return number + 'th';
12368
+ };
12369
+ var localize = {
12370
+ ordinalNumber: ordinalNumber,
12371
+ era: buildLocalizeFn({
12372
+ values: eraValues,
12373
+ defaultWidth: 'wide'
12374
+ }),
12375
+ quarter: buildLocalizeFn({
12376
+ values: quarterValues,
12377
+ defaultWidth: 'wide',
12378
+ argumentCallback: function argumentCallback(quarter) {
12379
+ return quarter - 1;
12380
+ }
12381
+ }),
12382
+ month: buildLocalizeFn({
12383
+ values: monthValues,
12384
+ defaultWidth: 'wide'
12385
+ }),
12386
+ day: buildLocalizeFn({
12387
+ values: dayValues,
12388
+ defaultWidth: 'wide'
12389
+ }),
12390
+ dayPeriod: buildLocalizeFn({
12391
+ values: dayPeriodValues,
12392
+ defaultWidth: 'wide',
12393
+ formattingValues: formattingDayPeriodValues,
12394
+ defaultFormattingWidth: 'wide'
12395
+ })
12396
+ };
12397
+
12398
+ function buildMatchFn(args) {
12399
+ return function (string) {
12400
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12401
+ var width = options.width;
12402
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
12403
+ var matchResult = string.match(matchPattern);
12404
+ if (!matchResult) {
12405
+ return null;
12406
+ }
12407
+ var matchedString = matchResult[0];
12408
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
12409
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
12410
+ return pattern.test(matchedString);
12411
+ }) : findKey(parsePatterns, function (pattern) {
12412
+ return pattern.test(matchedString);
12413
+ });
12414
+ var value;
12415
+ value = args.valueCallback ? args.valueCallback(key) : key;
12416
+ value = options.valueCallback ? options.valueCallback(value) : value;
12417
+ var rest = string.slice(matchedString.length);
12418
+ return {
12419
+ value: value,
12420
+ rest: rest
12421
+ };
12422
+ };
12423
+ }
12424
+ function findKey(object, predicate) {
12425
+ for (var key in object) {
12426
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
12427
+ return key;
12428
+ }
12429
+ }
12430
+ return undefined;
12431
+ }
12432
+ function findIndex(array, predicate) {
12433
+ for (var key = 0; key < array.length; key++) {
12434
+ if (predicate(array[key])) {
12435
+ return key;
12436
+ }
12620
12437
  }
12438
+ return undefined;
12439
+ }
12440
+
12441
+ function buildMatchPatternFn(args) {
12442
+ return function (string) {
12443
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12444
+ var matchResult = string.match(args.matchPattern);
12445
+ if (!matchResult) return null;
12446
+ var matchedString = matchResult[0];
12447
+ var parseResult = string.match(args.parsePattern);
12448
+ if (!parseResult) return null;
12449
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
12450
+ value = options.valueCallback ? options.valueCallback(value) : value;
12451
+ var rest = string.slice(matchedString.length);
12452
+ return {
12453
+ value: value,
12454
+ rest: rest
12455
+ };
12456
+ };
12621
12457
  }
12622
12458
 
12459
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
12460
+ var parseOrdinalNumberPattern = /\d+/i;
12461
+ var matchEraPatterns = {
12462
+ narrow: /^(b|a)/i,
12463
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
12464
+ wide: /^(before christ|before common era|anno domini|common era)/i
12465
+ };
12466
+ var parseEraPatterns = {
12467
+ any: [/^b/i, /^(a|c)/i]
12468
+ };
12469
+ var matchQuarterPatterns = {
12470
+ narrow: /^[1234]/i,
12471
+ abbreviated: /^q[1234]/i,
12472
+ wide: /^[1234](th|st|nd|rd)? quarter/i
12473
+ };
12474
+ var parseQuarterPatterns = {
12475
+ any: [/1/i, /2/i, /3/i, /4/i]
12476
+ };
12477
+ var matchMonthPatterns = {
12478
+ narrow: /^[jfmasond]/i,
12479
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
12480
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
12481
+ };
12482
+ var parseMonthPatterns = {
12483
+ 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],
12484
+ 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]
12485
+ };
12486
+ var matchDayPatterns = {
12487
+ narrow: /^[smtwf]/i,
12488
+ "short": /^(su|mo|tu|we|th|fr|sa)/i,
12489
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
12490
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
12491
+ };
12492
+ var parseDayPatterns = {
12493
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
12494
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
12495
+ };
12496
+ var matchDayPeriodPatterns = {
12497
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
12498
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
12499
+ };
12500
+ var parseDayPeriodPatterns = {
12501
+ any: {
12502
+ am: /^a/i,
12503
+ pm: /^p/i,
12504
+ midnight: /^mi/i,
12505
+ noon: /^no/i,
12506
+ morning: /morning/i,
12507
+ afternoon: /afternoon/i,
12508
+ evening: /evening/i,
12509
+ night: /night/i
12510
+ }
12511
+ };
12512
+ var match = {
12513
+ ordinalNumber: buildMatchPatternFn({
12514
+ matchPattern: matchOrdinalNumberPattern,
12515
+ parsePattern: parseOrdinalNumberPattern,
12516
+ valueCallback: function valueCallback(value) {
12517
+ return parseInt(value, 10);
12518
+ }
12519
+ }),
12520
+ era: buildMatchFn({
12521
+ matchPatterns: matchEraPatterns,
12522
+ defaultMatchWidth: 'wide',
12523
+ parsePatterns: parseEraPatterns,
12524
+ defaultParseWidth: 'any'
12525
+ }),
12526
+ quarter: buildMatchFn({
12527
+ matchPatterns: matchQuarterPatterns,
12528
+ defaultMatchWidth: 'wide',
12529
+ parsePatterns: parseQuarterPatterns,
12530
+ defaultParseWidth: 'any',
12531
+ valueCallback: function valueCallback(index) {
12532
+ return index + 1;
12533
+ }
12534
+ }),
12535
+ month: buildMatchFn({
12536
+ matchPatterns: matchMonthPatterns,
12537
+ defaultMatchWidth: 'wide',
12538
+ parsePatterns: parseMonthPatterns,
12539
+ defaultParseWidth: 'any'
12540
+ }),
12541
+ day: buildMatchFn({
12542
+ matchPatterns: matchDayPatterns,
12543
+ defaultMatchWidth: 'wide',
12544
+ parsePatterns: parseDayPatterns,
12545
+ defaultParseWidth: 'any'
12546
+ }),
12547
+ dayPeriod: buildMatchFn({
12548
+ matchPatterns: matchDayPeriodPatterns,
12549
+ defaultMatchWidth: 'any',
12550
+ parsePatterns: parseDayPeriodPatterns,
12551
+ defaultParseWidth: 'any'
12552
+ })
12553
+ };
12554
+
12555
+ /**
12556
+ * @type {Locale}
12557
+ * @category Locales
12558
+ * @summary English locale (United States).
12559
+ * @language English
12560
+ * @iso-639-2 eng
12561
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
12562
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
12563
+ */
12564
+ var locale$4 = {
12565
+ code: 'en-US',
12566
+ formatDistance: formatDistance$1,
12567
+ formatLong: formatLong$2,
12568
+ formatRelative: formatRelative,
12569
+ localize: localize,
12570
+ match: match,
12571
+ options: {
12572
+ weekStartsOn: 0 /* Sunday */,
12573
+ firstWeekContainsDate: 1
12574
+ }
12575
+ };
12576
+
12623
12577
  // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
12624
12578
  // (one of the certain letters followed by `o`)
12625
12579
  // - (\w)\1* matches any sequences of the same letter
@@ -12630,14 +12584,15 @@ function throwProtectedError(token, format, input) {
12630
12584
  // If there is no matching single quote
12631
12585
  // then the sequence will continue until the end of the string.
12632
12586
  // - . matches any single character unmatched by previous parts of the RegExps
12587
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
12633
12588
 
12634
- var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also
12589
+ // This RegExp catches symbols escaped by quotes, and also
12635
12590
  // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
12636
-
12637
12591
  var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
12638
12592
  var escapedStringRegExp = /^'([^]*?)'?$/;
12639
12593
  var doubleQuoteRegExp = /''/g;
12640
12594
  var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12595
+
12641
12596
  /**
12642
12597
  * @name format
12643
12598
  * @category Common Helpers
@@ -12647,7 +12602,7 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12647
12602
  * Return the formatted date string in the given format. The result may vary by locale.
12648
12603
  *
12649
12604
  * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
12650
- * > See: https://git.io/fxCyr
12605
+ * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12651
12606
  *
12652
12607
  * The characters wrapped between two single quotes characters (') are escaped.
12653
12608
  * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
@@ -12726,32 +12681,34 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12726
12681
  * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
12727
12682
  * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
12728
12683
  * | | EEEEE | M, T, W, T, F, S, S | |
12729
- * | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |
12684
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
12730
12685
  * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
12731
12686
  * | | io | 1st, 2nd, ..., 7th | 7 |
12732
12687
  * | | ii | 01, 02, ..., 07 | 7 |
12733
12688
  * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
12734
12689
  * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
12735
12690
  * | | iiiii | M, T, W, T, F, S, S | 7 |
12736
- * | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 |
12691
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
12737
12692
  * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
12738
12693
  * | | eo | 2nd, 3rd, ..., 1st | 7 |
12739
12694
  * | | ee | 02, 03, ..., 01 | |
12740
12695
  * | | eee | Mon, Tue, Wed, ..., Sun | |
12741
12696
  * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
12742
12697
  * | | eeeee | M, T, W, T, F, S, S | |
12743
- * | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |
12698
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
12744
12699
  * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
12745
12700
  * | | co | 2nd, 3rd, ..., 1st | 7 |
12746
12701
  * | | cc | 02, 03, ..., 01 | |
12747
12702
  * | | ccc | Mon, Tue, Wed, ..., Sun | |
12748
12703
  * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
12749
12704
  * | | ccccc | M, T, W, T, F, S, S | |
12750
- * | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |
12751
- * | AM, PM | a..aaa | AM, PM | |
12705
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
12706
+ * | AM, PM | a..aa | AM, PM | |
12707
+ * | | aaa | am, pm | |
12752
12708
  * | | aaaa | a.m., p.m. | 2 |
12753
12709
  * | | aaaaa | a, p | |
12754
- * | AM, PM, noon, midnight | b..bbb | AM, PM, noon, midnight | |
12710
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
12711
+ * | | bbb | am, pm, noon, midnight | |
12755
12712
  * | | bbbb | a.m., p.m., noon, midnight | 2 |
12756
12713
  * | | bbbbb | a, p, n, mi | |
12757
12714
  * | Flexible day period | B..BBB | at night, in the morning, ... | |
@@ -12777,7 +12734,7 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12777
12734
  * | | ss | 00, 01, ..., 59 | |
12778
12735
  * | Fraction of second | S | 0, 1, ..., 9 | |
12779
12736
  * | | SS | 00, 01, ..., 99 | |
12780
- * | | SSS | 000, 0001, ..., 999 | |
12737
+ * | | SSS | 000, 001, ..., 999 | |
12781
12738
  * | | SSSS | ... | 3 |
12782
12739
  * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
12783
12740
  * | | XX | -0800, +0530, Z | |
@@ -12797,18 +12754,18 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12797
12754
  * | | tt | ... | 3,7 |
12798
12755
  * | Milliseconds timestamp | T | 512969520900 | 7 |
12799
12756
  * | | TT | ... | 3,7 |
12800
- * | Long localized date | P | 05/29/1453 | 7 |
12801
- * | | PP | May 29, 1453 | 7 |
12802
- * | | PPP | May 29th, 1453 | 7 |
12803
- * | | PPPP | Sunday, May 29th, 1453 | 2,7 |
12757
+ * | Long localized date | P | 04/29/1453 | 7 |
12758
+ * | | PP | Apr 29, 1453 | 7 |
12759
+ * | | PPP | April 29th, 1453 | 7 |
12760
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
12804
12761
  * | Long localized time | p | 12:00 AM | 7 |
12805
12762
  * | | pp | 12:00:00 AM | 7 |
12806
12763
  * | | ppp | 12:00:00 AM GMT+2 | 7 |
12807
12764
  * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
12808
- * | Combination of date and time | Pp | 05/29/1453, 12:00 AM | 7 |
12809
- * | | PPpp | May 29, 1453, 12:00:00 AM | 7 |
12810
- * | | PPPppp | May 29th, 1453 at ... | 7 |
12811
- * | | PPPPpppp| Sunday, May 29th, 1453 at ... | 2,7 |
12765
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
12766
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
12767
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
12768
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
12812
12769
  * Notes:
12813
12770
  * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
12814
12771
  * are the same as "stand-alone" units, but are different in some languages.
@@ -12881,30 +12838,10 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12881
12838
  * - `p`: long localized time
12882
12839
  *
12883
12840
  * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
12884
- * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://git.io/fxCyr
12885
- *
12886
- * 9. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.
12887
- * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://git.io/fxCyr
12888
- *
12889
- * ### v2.0.0 breaking changes:
12890
- *
12891
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
12892
- *
12893
- * - The second argument is now required for the sake of explicitness.
12894
- *
12895
- * ```javascript
12896
- * // Before v2.0.0
12897
- * format(new Date(2016, 0, 1))
12841
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12898
12842
  *
12899
- * // v2.0.0 onward
12900
- * format(new Date(2016, 0, 1), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")
12901
- * ```
12902
- *
12903
- * - New format string API for `format` function
12904
- * which is based on [Unicode Technical Standard #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).
12905
- * See [this post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.
12906
- *
12907
- * - Characters are now escaped using single quote symbols (`'`) instead of square brackets.
12843
+ * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
12844
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12908
12845
  *
12909
12846
  * @param {Date|Number} date - the original date
12910
12847
  * @param {String} format - the string of tokens
@@ -12913,9 +12850,9 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12913
12850
  * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
12914
12851
  * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
12915
12852
  * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
12916
- * see: https://git.io/fxCyr
12853
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12917
12854
  * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
12918
- * see: https://git.io/fxCyr
12855
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12919
12856
  * @returns {String} the formatted date string
12920
12857
  * @throws {TypeError} 2 arguments required
12921
12858
  * @throws {RangeError} `date` must not be Invalid Date
@@ -12923,76 +12860,76 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12923
12860
  * @throws {RangeError} `options.locale` must contain `formatLong` property
12924
12861
  * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
12925
12862
  * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
12926
- * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
12927
- * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
12928
- * @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
12929
- * @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
12863
+ * @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
12864
+ * @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
12865
+ * @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
12866
+ * @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
12930
12867
  * @throws {RangeError} format string contains an unescaped latin alphabet character
12931
12868
  *
12932
12869
  * @example
12933
12870
  * // Represent 11 February 2014 in middle-endian format:
12934
- * var result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
12871
+ * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
12935
12872
  * //=> '02/11/2014'
12936
12873
  *
12937
12874
  * @example
12938
12875
  * // Represent 2 July 2014 in Esperanto:
12939
12876
  * import { eoLocale } from 'date-fns/locale/eo'
12940
- * var result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
12877
+ * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
12941
12878
  * locale: eoLocale
12942
12879
  * })
12943
12880
  * //=> '2-a de julio 2014'
12944
12881
  *
12945
12882
  * @example
12946
12883
  * // Escape string by single quote characters:
12947
- * var result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
12884
+ * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
12948
12885
  * //=> "3 o'clock"
12949
12886
  */
12950
12887
 
12951
- function format$1(dirtyDate, dirtyFormatStr, dirtyOptions) {
12888
+ function format(dirtyDate, dirtyFormatStr, options) {
12889
+ 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;
12952
12890
  requiredArgs(2, arguments);
12953
12891
  var formatStr = String(dirtyFormatStr);
12954
- var options = dirtyOptions || {};
12955
- var locale$1 = options.locale || locale;
12956
- var localeFirstWeekContainsDate = locale$1.options && locale$1.options.firstWeekContainsDate;
12957
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
12958
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
12892
+ var defaultOptions = getDefaultOptions();
12893
+ 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;
12894
+ 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);
12959
12895
 
12896
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
12960
12897
  if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
12961
12898
  throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
12962
12899
  }
12963
- var localeWeekStartsOn = locale$1.options && locale$1.options.weekStartsOn;
12964
- var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
12965
- var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
12900
+ 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);
12966
12901
 
12902
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
12967
12903
  if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
12968
12904
  throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
12969
12905
  }
12970
- if (!locale$1.localize) {
12906
+ if (!locale.localize) {
12971
12907
  throw new RangeError('locale must contain localize property');
12972
12908
  }
12973
- if (!locale$1.formatLong) {
12909
+ if (!locale.formatLong) {
12974
12910
  throw new RangeError('locale must contain formatLong property');
12975
12911
  }
12976
12912
  var originalDate = toDate(dirtyDate);
12977
12913
  if (!isValid(originalDate)) {
12978
12914
  throw new RangeError('Invalid time value');
12979
- } // Convert the date in system timezone to the same date in UTC+00:00 timezone.
12915
+ }
12916
+
12917
+ // Convert the date in system timezone to the same date in UTC+00:00 timezone.
12980
12918
  // This ensures that when UTC functions will be implemented, locales will be compatible with them.
12981
12919
  // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
12982
-
12983
12920
  var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
12984
12921
  var utcDate = subMilliseconds(originalDate, timezoneOffset);
12985
12922
  var formatterOptions = {
12986
12923
  firstWeekContainsDate: firstWeekContainsDate,
12987
12924
  weekStartsOn: weekStartsOn,
12988
- locale: locale$1,
12925
+ locale: locale,
12989
12926
  _originalDate: originalDate
12990
12927
  };
12991
12928
  var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
12992
12929
  var firstCharacter = substring[0];
12993
12930
  if (firstCharacter === 'p' || firstCharacter === 'P') {
12994
12931
  var longFormatter = longFormatters[firstCharacter];
12995
- return longFormatter(substring, locale$1.formatLong, formatterOptions);
12932
+ return longFormatter(substring, locale.formatLong);
12996
12933
  }
12997
12934
  return substring;
12998
12935
  }).join('').match(formattingTokensRegExp).map(function (substring) {
@@ -13006,13 +12943,13 @@ function format$1(dirtyDate, dirtyFormatStr, dirtyOptions) {
13006
12943
  }
13007
12944
  var formatter = formatters[firstCharacter];
13008
12945
  if (formatter) {
13009
- if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
13010
- throwProtectedError(substring, dirtyFormatStr, dirtyDate);
12946
+ if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
12947
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
13011
12948
  }
13012
- if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
13013
- throwProtectedError(substring, dirtyFormatStr, dirtyDate);
12949
+ if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
12950
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
13014
12951
  }
13015
- return formatter(utcDate, substring, locale$1.localize, formatterOptions);
12952
+ return formatter(utcDate, substring, locale.localize, formatterOptions);
13016
12953
  }
13017
12954
  if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
13018
12955
  throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
@@ -13022,22 +12959,28 @@ function format$1(dirtyDate, dirtyFormatStr, dirtyOptions) {
13022
12959
  return result;
13023
12960
  }
13024
12961
  function cleanEscapedString(input) {
13025
- return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
12962
+ var matched = input.match(escapedStringRegExp);
12963
+ if (!matched) {
12964
+ return input;
12965
+ }
12966
+ return matched[1].replace(doubleQuoteRegExp, "'");
13026
12967
  }
13027
12968
 
13028
- function convertToFP(fn, arity, a) {
13029
- a = a || [];
12969
+ function convertToFP(fn, arity) {
12970
+ var a = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
13030
12971
  if (a.length >= arity) {
13031
12972
  return fn.apply(null, a.slice(0, arity).reverse());
13032
12973
  }
13033
12974
  return function () {
13034
- var args = Array.prototype.slice.call(arguments);
12975
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12976
+ args[_key] = arguments[_key];
12977
+ }
13035
12978
  return convertToFP(fn, arity, a.concat(args));
13036
12979
  };
13037
12980
  }
13038
12981
 
13039
- // This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
13040
- var format = convertToFP(format$1, 2);
12982
+ // This file is generated automatically by `scripts/build/fp.ts`. Please, don't change it.
12983
+ var formatTime = convertToFP(format, 2);
13041
12984
 
13042
12985
  var Wrapper = index$a(View)(function () {
13043
12986
  return {
@@ -13457,7 +13400,7 @@ var CalendarRange = function CalendarRange(_ref) {
13457
13400
  return /*#__PURE__*/React__default.createElement(StyledContainer$7, {
13458
13401
  testID: testID
13459
13402
  }, /*#__PURE__*/React__default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__default.createElement(ContentNavigator, {
13460
- value: !useMonthPicker ? format('MMMM yyyy', visibleDate) : /*#__PURE__*/React__default.createElement(TouchableOpacity, {
13403
+ value: !useMonthPicker ? formatTime('MMMM yyyy', visibleDate) : /*#__PURE__*/React__default.createElement(TouchableOpacity, {
13461
13404
  testID: "calendar-month-picker",
13462
13405
  onPress: function onPress() {
13463
13406
  onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(!monthPickerVisible);
@@ -13473,7 +13416,7 @@ var CalendarRange = function CalendarRange(_ref) {
13473
13416
  textAlign: 'center',
13474
13417
  marginRight: theme.__hd__.calendar.space.headerMarginRight
13475
13418
  }
13476
- }, format('MMMM yyyy', visibleDate)), /*#__PURE__*/React__default.createElement(Icon, {
13419
+ }, formatTime('MMMM yyyy', visibleDate)), /*#__PURE__*/React__default.createElement(Icon, {
13477
13420
  icon: monthPickerVisible ? 'arrow-up' : 'arrow-down',
13478
13421
  size: "small"
13479
13422
  }))),
@@ -13624,7 +13567,7 @@ var Calendar = function Calendar(_ref) {
13624
13567
  return /*#__PURE__*/React__default.createElement(StyledContainer$7, {
13625
13568
  testID: testID
13626
13569
  }, /*#__PURE__*/React__default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__default.createElement(ContentNavigator, {
13627
- value: !useMonthPicker ? format('MMMM yyyy', visibleDate) : /*#__PURE__*/React__default.createElement(TouchableOpacity, {
13570
+ value: !useMonthPicker ? formatTime('MMMM yyyy', visibleDate) : /*#__PURE__*/React__default.createElement(TouchableOpacity, {
13628
13571
  testID: "calendar-month-picker",
13629
13572
  onPress: function onPress() {
13630
13573
  onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(!monthPickerVisible);
@@ -13640,7 +13583,7 @@ var Calendar = function Calendar(_ref) {
13640
13583
  textAlign: 'center',
13641
13584
  marginRight: theme.__hd__.calendar.space.headerMarginRight
13642
13585
  }
13643
- }, format('MMMM yyyy', visibleDate)), /*#__PURE__*/React__default.createElement(Icon, {
13586
+ }, formatTime('MMMM yyyy', visibleDate)), /*#__PURE__*/React__default.createElement(Icon, {
13644
13587
  icon: monthPickerVisible ? 'arrow-up' : 'arrow-down',
13645
13588
  size: "small"
13646
13589
  }))),
@@ -14154,7 +14097,7 @@ var StyledPageControlWrapper = index$a(View)(function (_ref7) {
14154
14097
  });
14155
14098
 
14156
14099
  function isCarouselImageProps(image) {
14157
- return _typeof(image) === 'object';
14100
+ return _typeof$1(image) === 'object';
14158
14101
  }
14159
14102
  var CarouselItem = function CarouselItem(_ref) {
14160
14103
  var width = _ref.width,
@@ -15075,6 +15018,82 @@ var useCalculateDate = function useCalculateDate(_ref) {
15075
15018
  }, [maxDate, minDate, value]);
15076
15019
  };
15077
15020
 
15021
+ var locale$3 = {
15022
+ lang: 'en-AU',
15023
+ dateTimeFormats: {
15024
+ fullDate: 'dd/MM/yyyy'
15025
+ }
15026
+ };
15027
+
15028
+ var LocaleContext = /*#__PURE__*/createContext(locale$3);
15029
+
15030
+ var useLocale = function useLocale() {
15031
+ var context = useContext(LocaleContext);
15032
+ if (!context) return locale$3;
15033
+ return context;
15034
+ };
15035
+ var useDateTimeFormat = function useDateTimeFormat() {
15036
+ var _useLocale = useLocale(),
15037
+ dateTimeFormats = _useLocale.dateTimeFormats;
15038
+ var localizeDateTime = useCallback(function (key) {
15039
+ return dateTimeFormats === null || dateTimeFormats === void 0 ? void 0 : dateTimeFormats[key];
15040
+ }, [dateTimeFormats]);
15041
+ return {
15042
+ localizeDateTime: localizeDateTime
15043
+ };
15044
+ };
15045
+
15046
+ var locale$2 = {
15047
+ lang: 'en-CA',
15048
+ dateTimeFormats: {
15049
+ fullDate: 'MMM dd, yyyy'
15050
+ }
15051
+ };
15052
+
15053
+ var locales = {
15054
+ 'en-AU': locale$3,
15055
+ 'en-CA': locale$2
15056
+ };
15057
+
15058
+ // Function to get the date format based on the displayFormat and locale,
15059
+ // if no displayFormat or locale is provided, use the default fullDate format
15060
+ var getDateFormat = function getDateFormat(_ref) {
15061
+ var displayFormat = _ref.displayFormat,
15062
+ locale = _ref.locale,
15063
+ localizeDateTime = _ref.localizeDateTime;
15064
+ // Prioritise displayFormat
15065
+ if (displayFormat) {
15066
+ return displayFormat;
15067
+ }
15068
+ // If locale is provided, find the corresponding locale in the locales object
15069
+ if (locale && locales[locale]) {
15070
+ var localeObject = locales[locale];
15071
+ if (localeObject) {
15072
+ return localeObject.dateTimeFormats.fullDate;
15073
+ }
15074
+ }
15075
+ // If no displayFormat or locale is provided, use the default fullDate format
15076
+ return localizeDateTime('fullDate');
15077
+ };
15078
+
15079
+ var useFormatDate = function useFormatDate(_ref) {
15080
+ var displayFormat = _ref.displayFormat,
15081
+ locale = _ref.locale,
15082
+ value = _ref.value;
15083
+ var _useDateTimeFormat = useDateTimeFormat(),
15084
+ localizeDateTime = _useDateTimeFormat.localizeDateTime;
15085
+ var format = getDateFormat({
15086
+ displayFormat: displayFormat,
15087
+ locale: locale,
15088
+ localizeDateTime: localizeDateTime
15089
+ });
15090
+ var displayValue = value ? formatTime(format, value) : '';
15091
+ return {
15092
+ displayValue: displayValue,
15093
+ format: format
15094
+ };
15095
+ };
15096
+
15078
15097
  var DatePickerAndroid = function DatePickerAndroid(_ref) {
15079
15098
  var value = _ref.value,
15080
15099
  minDate = _ref.minDate,
@@ -15082,8 +15101,7 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
15082
15101
  label = _ref.label,
15083
15102
  placeholder = _ref.placeholder,
15084
15103
  _onChange = _ref.onChange,
15085
- _ref$displayFormat = _ref.displayFormat,
15086
- displayFormat = _ref$displayFormat === void 0 ? 'dd/MM/yyyy' : _ref$displayFormat,
15104
+ displayFormat = _ref.displayFormat,
15087
15105
  _ref$disabled = _ref.disabled,
15088
15106
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
15089
15107
  required = _ref.required,
@@ -15092,19 +15110,27 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
15092
15110
  style = _ref.style,
15093
15111
  testID = _ref.testID,
15094
15112
  _ref$variant = _ref.variant,
15095
- variant = _ref$variant === void 0 ? 'default' : _ref$variant;
15113
+ variant = _ref$variant === void 0 ? 'default' : _ref$variant,
15114
+ renderSelectedValue = _ref.renderSelectedValue,
15115
+ locale = _ref.locale;
15096
15116
  var _useState = useState(false),
15097
15117
  _useState2 = _slicedToArray(_useState, 2),
15098
15118
  open = _useState2[0],
15099
15119
  setOpen = _useState2[1];
15100
- var displayValue = value ? format(displayFormat, value) : '';
15101
- var pickerInitValue = value || new Date();
15120
+ var _useFormatDate = useFormatDate({
15121
+ displayFormat: displayFormat,
15122
+ locale: locale,
15123
+ value: value
15124
+ }),
15125
+ displayValue = _useFormatDate.displayValue,
15126
+ format = _useFormatDate.format;
15102
15127
  useCalculateDate({
15103
15128
  minDate: minDate,
15104
15129
  maxDate: maxDate,
15105
15130
  onChange: _onChange,
15106
15131
  value: value
15107
15132
  });
15133
+ var pickerInitValue = value || new Date();
15108
15134
  var theme = useTheme();
15109
15135
  return /*#__PURE__*/React__default.createElement(TouchableOpacity, {
15110
15136
  onPress: function onPress() {
@@ -15118,13 +15144,19 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
15118
15144
  label: label,
15119
15145
  value: displayValue,
15120
15146
  suffix: "calendar-dates-outlined",
15121
- placeholder: placeholder || displayFormat,
15147
+ placeholder: placeholder || format,
15122
15148
  disabled: disabled,
15123
15149
  error: error,
15124
15150
  required: required,
15125
15151
  helpText: helpText,
15126
15152
  style: style,
15127
- testID: testID
15153
+ testID: testID,
15154
+ renderInputValue: renderSelectedValue !== undefined && !!value ? function (props) {
15155
+ return renderSelectedValue({
15156
+ date: value,
15157
+ formattedDateString: displayValue
15158
+ }, props);
15159
+ } : undefined
15128
15160
  })), open && variant === 'month-year' ? /*#__PURE__*/React__default.createElement(MonthYearPickerDialogueAndroid, {
15129
15161
  themeVariant: theme.themeMode === 'dark' ? 'dark' : 'light',
15130
15162
  value: value,
@@ -15204,8 +15236,7 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
15204
15236
  placeholder = _ref2.placeholder,
15205
15237
  onChange = _ref2.onChange,
15206
15238
  confirmLabel = _ref2.confirmLabel,
15207
- _ref2$displayFormat = _ref2.displayFormat,
15208
- displayFormat = _ref2$displayFormat === void 0 ? 'dd/MM/yyyy' : _ref2$displayFormat,
15239
+ displayFormat = _ref2.displayFormat,
15209
15240
  _ref2$disabled = _ref2.disabled,
15210
15241
  disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
15211
15242
  required = _ref2.required,
@@ -15216,7 +15247,9 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
15216
15247
  monthPickerConfirmLabel = _ref2.monthPickerConfirmLabel,
15217
15248
  monthPickerCancelLabel = _ref2.monthPickerCancelLabel,
15218
15249
  _ref2$supportedOrient = _ref2.supportedOrientations,
15219
- supportedOrientations = _ref2$supportedOrient === void 0 ? ['portrait'] : _ref2$supportedOrient;
15250
+ supportedOrientations = _ref2$supportedOrient === void 0 ? ['portrait'] : _ref2$supportedOrient,
15251
+ renderSelectedValue = _ref2.renderSelectedValue,
15252
+ locale = _ref2.locale;
15220
15253
  var _useState5 = useState(false),
15221
15254
  _useState6 = _slicedToArray(_useState5, 2),
15222
15255
  open = _useState6[0],
@@ -15230,7 +15263,12 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
15230
15263
  _useState10 = _slicedToArray(_useState9, 2),
15231
15264
  selectingDate = _useState10[0],
15232
15265
  setSelectingDate = _useState10[1];
15233
- var displayValue = value ? format(displayFormat, value) : '';
15266
+ var _useFormatDate = useFormatDate({
15267
+ value: value,
15268
+ displayFormat: displayFormat,
15269
+ locale: locale
15270
+ }),
15271
+ displayValue = _useFormatDate.displayValue;
15234
15272
  useCalculateDate({
15235
15273
  minDate: minDate,
15236
15274
  maxDate: maxDate,
@@ -15255,7 +15293,13 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
15255
15293
  required: required,
15256
15294
  helpText: helpText,
15257
15295
  testID: testID,
15258
- style: style
15296
+ style: style,
15297
+ renderInputValue: renderSelectedValue !== undefined && !!value ? function (props) {
15298
+ return renderSelectedValue({
15299
+ date: value,
15300
+ formattedDateString: displayValue
15301
+ }, props);
15302
+ } : undefined
15259
15303
  })), /*#__PURE__*/React__default.createElement(BottomSheet$1, {
15260
15304
  open: open,
15261
15305
  onRequestClose: function onRequestClose() {
@@ -15301,8 +15345,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
15301
15345
  placeholder = _ref.placeholder,
15302
15346
  onChange = _ref.onChange,
15303
15347
  confirmLabel = _ref.confirmLabel,
15304
- _ref$displayFormat = _ref.displayFormat,
15305
- displayFormat = _ref$displayFormat === void 0 ? 'dd/MM/yyyy' : _ref$displayFormat,
15348
+ displayFormat = _ref.displayFormat,
15306
15349
  _ref$disabled = _ref.disabled,
15307
15350
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
15308
15351
  required = _ref.required,
@@ -15314,7 +15357,9 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
15314
15357
  supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta,
15315
15358
  _ref$variant = _ref.variant,
15316
15359
  variant = _ref$variant === void 0 ? 'default' : _ref$variant,
15317
- locale = _ref.locale;
15360
+ locale = _ref.locale,
15361
+ renderSelectedValue = _ref.renderSelectedValue;
15362
+ var theme = useTheme();
15318
15363
  var _useState = useState(getDateValue(value || new Date(), minDate, maxDate)),
15319
15364
  _useState2 = _slicedToArray(_useState, 2),
15320
15365
  selectingDate = _useState2[0],
@@ -15323,8 +15368,15 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
15323
15368
  _useState4 = _slicedToArray(_useState3, 2),
15324
15369
  open = _useState4[0],
15325
15370
  setOpen = _useState4[1];
15326
- var displayValue = value ? format(displayFormat, value) : '';
15327
- var theme = useTheme();
15371
+ var _useLocale = useLocale(),
15372
+ defaultLocale = _useLocale.lang;
15373
+ var _useFormatDate = useFormatDate({
15374
+ displayFormat: displayFormat,
15375
+ locale: locale,
15376
+ value: value
15377
+ }),
15378
+ displayValue = _useFormatDate.displayValue,
15379
+ format = _useFormatDate.format;
15328
15380
  useCalculateDate({
15329
15381
  minDate: minDate,
15330
15382
  maxDate: maxDate,
@@ -15343,13 +15395,19 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
15343
15395
  label: label,
15344
15396
  value: displayValue,
15345
15397
  suffix: "calendar-dates-outlined",
15346
- placeholder: placeholder || displayFormat,
15398
+ placeholder: placeholder || format,
15347
15399
  disabled: disabled,
15348
15400
  error: error,
15349
15401
  required: required,
15350
15402
  helpText: helpText,
15351
15403
  testID: testID,
15352
- style: style
15404
+ style: style,
15405
+ renderInputValue: renderSelectedValue !== undefined && !!value ? function (props) {
15406
+ return renderSelectedValue({
15407
+ date: value,
15408
+ formattedDateString: displayValue
15409
+ }, props);
15410
+ } : undefined
15353
15411
  })), /*#__PURE__*/React__default.createElement(BottomSheet$1, {
15354
15412
  open: open,
15355
15413
  onRequestClose: function onRequestClose() {
@@ -15369,7 +15427,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
15369
15427
  supportedOrientations: supportedOrientations
15370
15428
  }, /*#__PURE__*/React__default.createElement(StyledPickerWrapper$1, null, variant === 'month-year' ? /*#__PURE__*/React__default.createElement(MonthYearPickerViewIOS, {
15371
15429
  value: value,
15372
- locale: locale,
15430
+ locale: locale || defaultLocale,
15373
15431
  minimumDate: minDate,
15374
15432
  textColor: theme.colors.onDefaultGlobalSurface,
15375
15433
  maximumDate: maxDate,
@@ -15382,7 +15440,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
15382
15440
  flex: 1
15383
15441
  }
15384
15442
  }) : null, variant === 'default' ? /*#__PURE__*/React__default.createElement(DateTimePicker, {
15385
- locale: locale,
15443
+ locale: locale || defaultLocale,
15386
15444
  testID: "datePickerIOS",
15387
15445
  value: selectingDate,
15388
15446
  minimumDate: minDate,
@@ -17879,12 +17937,307 @@ var Toast = {
17879
17937
  useToast: useToast
17880
17938
  };
17881
17939
 
17940
+ /**
17941
+ * @name setDefaultOptions
17942
+ * @category Common Helpers
17943
+ * @summary Set default options including locale.
17944
+ * @pure false
17945
+ *
17946
+ * @description
17947
+ * Sets the defaults for
17948
+ * `options.locale`, `options.weekStartsOn` and `options.firstWeekContainsDate`
17949
+ * arguments for all functions.
17950
+ *
17951
+ * @param {Object} newOptions - an object with options.
17952
+ * @param {Locale} [newOptions.locale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
17953
+ * @param {0|1|2|3|4|5|6} [newOptions.weekStartsOn] - the index of the first day of the week (0 - Sunday)
17954
+ * @param {1|2|3|4|5|6|7} [newOptions.firstWeekContainsDate] - the day of January, which is always in the first week of the year
17955
+ * @throws {TypeError} 1 argument required
17956
+ *
17957
+ * @example
17958
+ * // Set global locale:
17959
+ * import { es } from 'date-fns/locale'
17960
+ * setDefaultOptions({ locale: es })
17961
+ * const result = format(new Date(2014, 8, 2), 'PPPP')
17962
+ * //=> 'martes, 2 de septiembre de 2014'
17963
+ *
17964
+ * @example
17965
+ * // Start of the week for 2 September 2014:
17966
+ * const result = startOfWeek(new Date(2014, 8, 2))
17967
+ * //=> Sun Aug 31 2014 00:00:00
17968
+ *
17969
+ * @example
17970
+ * // Start of the week for 2 September 2014,
17971
+ * // when we set that week starts on Monday by default:
17972
+ * setDefaultOptions({ weekStartsOn: 1 })
17973
+ * const result = startOfWeek(new Date(2014, 8, 2))
17974
+ * //=> Mon Sep 01 2014 00:00:00
17975
+ *
17976
+ * @example
17977
+ * // Manually set options take priority over default options:
17978
+ * setDefaultOptions({ weekStartsOn: 1 })
17979
+ * const result = startOfWeek(new Date(2014, 8, 2), { weekStartsOn: 0 })
17980
+ * //=> Sun Aug 31 2014 00:00:00
17981
+ *
17982
+ * @example
17983
+ * // Remove the option by setting it to `undefined`:
17984
+ * setDefaultOptions({ weekStartsOn: 1 })
17985
+ * setDefaultOptions({ weekStartsOn: undefined })
17986
+ * const result = startOfWeek(new Date(2014, 8, 2))
17987
+ * //=> Sun Aug 31 2014 00:00:00
17988
+ */
17989
+ function setDefaultOptions(newOptions) {
17990
+ requiredArgs(1, arguments);
17991
+ var result = {};
17992
+ var defaultOptions = getDefaultOptions();
17993
+ for (var property in defaultOptions) {
17994
+ if (Object.prototype.hasOwnProperty.call(defaultOptions, property)) {
17995
+ result[property] = defaultOptions[property];
17996
+ }
17997
+ }
17998
+ for (var _property in newOptions) {
17999
+ if (Object.prototype.hasOwnProperty.call(newOptions, _property)) {
18000
+ if (newOptions[_property] === undefined) {
18001
+ delete result[_property];
18002
+ } else {
18003
+ result[_property] = newOptions[_property];
18004
+ }
18005
+ }
18006
+ }
18007
+ setDefaultOptions$1(result);
18008
+ }
18009
+
18010
+ var dateFormats$1 = {
18011
+ full: 'EEEE, d MMMM yyyy',
18012
+ "long": 'd MMMM yyyy',
18013
+ medium: 'd MMM yyyy',
18014
+ "short": 'dd/MM/yyyy'
18015
+ };
18016
+ var timeFormats$1 = {
18017
+ full: 'h:mm:ss a zzzz',
18018
+ "long": 'h:mm:ss a z',
18019
+ medium: 'h:mm:ss a',
18020
+ "short": 'h:mm a'
18021
+ };
18022
+ var dateTimeFormats$1 = {
18023
+ full: "{{date}} 'at' {{time}}",
18024
+ "long": "{{date}} 'at' {{time}}",
18025
+ medium: '{{date}}, {{time}}',
18026
+ "short": '{{date}}, {{time}}'
18027
+ };
18028
+ var formatLong$1 = {
18029
+ date: buildFormatLongFn({
18030
+ formats: dateFormats$1,
18031
+ defaultWidth: 'full'
18032
+ }),
18033
+ time: buildFormatLongFn({
18034
+ formats: timeFormats$1,
18035
+ defaultWidth: 'full'
18036
+ }),
18037
+ dateTime: buildFormatLongFn({
18038
+ formats: dateTimeFormats$1,
18039
+ defaultWidth: 'full'
18040
+ })
18041
+ };
18042
+
18043
+ /**
18044
+ * @type {Locale}
18045
+ * @category Locales
18046
+ * @summary English locale (Australia).
18047
+ * @language English
18048
+ * @iso-639-2 eng
18049
+ * @author Julien Malige [@JulienMalige]{@link https://github.com/JulienMalige}
18050
+ */
18051
+ var locale$1 = {
18052
+ code: 'en-AU',
18053
+ formatDistance: formatDistance$1,
18054
+ formatLong: formatLong$1,
18055
+ formatRelative: formatRelative,
18056
+ localize: localize,
18057
+ match: match,
18058
+ options: {
18059
+ weekStartsOn: 1 /* Monday */,
18060
+ firstWeekContainsDate: 4
18061
+ }
18062
+ };
18063
+
18064
+ var formatDistanceLocale = {
18065
+ lessThanXSeconds: {
18066
+ one: 'less than a second',
18067
+ other: 'less than {{count}} seconds'
18068
+ },
18069
+ xSeconds: {
18070
+ one: 'a second',
18071
+ other: '{{count}} seconds'
18072
+ },
18073
+ halfAMinute: 'half a minute',
18074
+ lessThanXMinutes: {
18075
+ one: 'less than a minute',
18076
+ other: 'less than {{count}} minutes'
18077
+ },
18078
+ xMinutes: {
18079
+ one: 'a minute',
18080
+ other: '{{count}} minutes'
18081
+ },
18082
+ aboutXHours: {
18083
+ one: 'about an hour',
18084
+ other: 'about {{count}} hours'
18085
+ },
18086
+ xHours: {
18087
+ one: 'an hour',
18088
+ other: '{{count}} hours'
18089
+ },
18090
+ xDays: {
18091
+ one: 'a day',
18092
+ other: '{{count}} days'
18093
+ },
18094
+ aboutXWeeks: {
18095
+ one: 'about a week',
18096
+ other: 'about {{count}} weeks'
18097
+ },
18098
+ xWeeks: {
18099
+ one: 'a week',
18100
+ other: '{{count}} weeks'
18101
+ },
18102
+ aboutXMonths: {
18103
+ one: 'about a month',
18104
+ other: 'about {{count}} months'
18105
+ },
18106
+ xMonths: {
18107
+ one: 'a month',
18108
+ other: '{{count}} months'
18109
+ },
18110
+ aboutXYears: {
18111
+ one: 'about a year',
18112
+ other: 'about {{count}} years'
18113
+ },
18114
+ xYears: {
18115
+ one: 'a year',
18116
+ other: '{{count}} years'
18117
+ },
18118
+ overXYears: {
18119
+ one: 'over a year',
18120
+ other: 'over {{count}} years'
18121
+ },
18122
+ almostXYears: {
18123
+ one: 'almost a year',
18124
+ other: 'almost {{count}} years'
18125
+ }
18126
+ };
18127
+ var formatDistance = function formatDistance(token, count, options) {
18128
+ var result;
18129
+ var tokenValue = formatDistanceLocale[token];
18130
+ if (typeof tokenValue === 'string') {
18131
+ result = tokenValue;
18132
+ } else if (count === 1) {
18133
+ result = tokenValue.one;
18134
+ } else {
18135
+ result = tokenValue.other.replace('{{count}}', count.toString());
18136
+ }
18137
+ if (options !== null && options !== void 0 && options.addSuffix) {
18138
+ if (options.comparison && options.comparison > 0) {
18139
+ return 'in ' + result;
18140
+ } else {
18141
+ return result + ' ago';
18142
+ }
18143
+ }
18144
+ return result;
18145
+ };
18146
+
18147
+ var dateFormats = {
18148
+ full: 'EEEE, MMMM do, yyyy',
18149
+ "long": 'MMMM do, yyyy',
18150
+ medium: 'MMM d, yyyy',
18151
+ "short": 'yyyy-MM-dd'
18152
+ };
18153
+ var timeFormats = {
18154
+ full: 'h:mm:ss a zzzz',
18155
+ "long": 'h:mm:ss a z',
18156
+ medium: 'h:mm:ss a',
18157
+ "short": 'h:mm a'
18158
+ };
18159
+ var dateTimeFormats = {
18160
+ full: "{{date}} 'at' {{time}}",
18161
+ "long": "{{date}} 'at' {{time}}",
18162
+ medium: '{{date}}, {{time}}',
18163
+ "short": '{{date}}, {{time}}'
18164
+ };
18165
+ var formatLong = {
18166
+ date: buildFormatLongFn({
18167
+ formats: dateFormats,
18168
+ defaultWidth: 'full'
18169
+ }),
18170
+ time: buildFormatLongFn({
18171
+ formats: timeFormats,
18172
+ defaultWidth: 'full'
18173
+ }),
18174
+ dateTime: buildFormatLongFn({
18175
+ formats: dateTimeFormats,
18176
+ defaultWidth: 'full'
18177
+ })
18178
+ };
18179
+
18180
+ /**
18181
+ * @type {Locale}
18182
+ * @category Locales
18183
+ * @summary English locale (Canada).
18184
+ * @language English
18185
+ * @iso-639-2 eng
18186
+ * @author Mark Owsiak [@markowsiak]{@link https://github.com/markowsiak}
18187
+ * @author Marco Imperatore [@mimperatore]{@link https://github.com/mimperatore}
18188
+ */
18189
+ var locale = {
18190
+ code: 'en-CA',
18191
+ formatDistance: formatDistance,
18192
+ formatLong: formatLong,
18193
+ formatRelative: formatRelative,
18194
+ localize: localize,
18195
+ match: match,
18196
+ options: {
18197
+ weekStartsOn: 0 /* Sunday */,
18198
+ firstWeekContainsDate: 1
18199
+ }
18200
+ };
18201
+
18202
+ var Locales = {
18203
+ 'en-AU': locale$1,
18204
+ 'en-CA': locale
18205
+ };
18206
+ function getDateFnsLocale(locale) {
18207
+ var fallbackLocale = Locales['en-AU'];
18208
+ return Locales[locale] || fallbackLocale;
18209
+ }
18210
+
18211
+ var LocaleProvider = function LocaleProvider(props) {
18212
+ var locale = props.locale,
18213
+ children = props.children;
18214
+ var code = (locale === null || locale === void 0 ? void 0 : locale['lang']) || 'en-AU';
18215
+ // setDefaultOptions here instead of inside useEffect for first rendering
18216
+ setDefaultOptions({
18217
+ locale: getDateFnsLocale(code)
18218
+ });
18219
+ useEffect(function () {
18220
+ return function () {
18221
+ return setDefaultOptions({
18222
+ locale: getDateFnsLocale('en-AU')
18223
+ });
18224
+ };
18225
+ }, []);
18226
+ return /*#__PURE__*/React__default.createElement(LocaleContext.Provider, {
18227
+ value: locale
18228
+ }, children);
18229
+ };
18230
+
17882
18231
  var HeroDesignProvider = function HeroDesignProvider(_ref) {
17883
18232
  var theme = _ref.theme,
18233
+ _ref$locale = _ref.locale,
18234
+ locale = _ref$locale === void 0 ? locale$3 : _ref$locale,
17884
18235
  children = _ref.children;
17885
- return /*#__PURE__*/React__default.createElement(ThemeProvider, {
18236
+ return /*#__PURE__*/React__default.createElement(LocaleProvider, {
18237
+ locale: locale
18238
+ }, /*#__PURE__*/React__default.createElement(ThemeProvider, {
17886
18239
  theme: theme
17887
- }, /*#__PURE__*/React__default.createElement(Toast.Provider, null, /*#__PURE__*/React__default.createElement(Portal$1.Provider, null, children)));
18240
+ }, /*#__PURE__*/React__default.createElement(Toast.Provider, null, /*#__PURE__*/React__default.createElement(Portal$1.Provider, null, children))));
17888
18241
  };
17889
18242
 
17890
18243
  var StyledContainer$3 = index$a(View)(function (_ref) {
@@ -19391,7 +19744,7 @@ var deepCompareValue = function deepCompareValue(a, b) {
19391
19744
  // If either is null or undefined (but they are not strictly equal), return false
19392
19745
  if (a == null || b == null) return false;
19393
19746
  // If types don't match, they can't be equal
19394
- if (_typeof(a) !== _typeof(b)) return false;
19747
+ if (_typeof$1(a) !== _typeof$1(b)) return false;
19395
19748
  // Handle array comparison
19396
19749
  if (Array.isArray(a) && Array.isArray(b)) {
19397
19750
  if (a.length !== b.length) return false;
@@ -19402,7 +19755,7 @@ var deepCompareValue = function deepCompareValue(a, b) {
19402
19755
  // If one is array and the other isn't, return false
19403
19756
  if (Array.isArray(a) !== Array.isArray(b)) return false;
19404
19757
  // Handle object comparison
19405
- if (_typeof(a) === 'object' && _typeof(b) === 'object') {
19758
+ if (_typeof$1(a) === 'object' && _typeof$1(b) === 'object') {
19406
19759
  var keysA = Object.keys(a);
19407
19760
  var keysB = Object.keys(b);
19408
19761
  if (keysA.length !== keysB.length) return false;
@@ -21184,7 +21537,7 @@ var TimePickerAndroid = function TimePickerAndroid(_ref) {
21184
21537
  open = _useState2[0],
21185
21538
  setOpen = _useState2[1];
21186
21539
  var is12Hour = displayFormat.includes('hh');
21187
- var displayValue = value ? format(displayFormat, value) : '';
21540
+ var displayValue = value ? formatTime(displayFormat, value) : '';
21188
21541
  var pickerInitValue = value || new Date();
21189
21542
  return /*#__PURE__*/React__default.createElement(TouchableOpacity, {
21190
21543
  onPress: function onPress() {
@@ -21255,7 +21608,7 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
21255
21608
  open = _useState4[0],
21256
21609
  setOpen = _useState4[1];
21257
21610
  var is12Hour = displayFormat.includes('hh');
21258
- var displayValue = value ? format(displayFormat, value) : '';
21611
+ var displayValue = value ? formatTime(displayFormat, value) : '';
21259
21612
  var theme = useTheme();
21260
21613
  useEffect(function () {
21261
21614
  setSelectingDate(value || new Date());
@@ -21997,7 +22350,7 @@ function requireScheduler_production_min() {
21997
22350
  var c = a.sortIndex - b.sortIndex;
21998
22351
  return 0 !== c ? c : a.id - b.id;
21999
22352
  }
22000
- if ("object" === (typeof performance === "undefined" ? "undefined" : _typeof(performance)) && "function" === typeof performance.now) {
22353
+ if ("object" === (typeof performance === "undefined" ? "undefined" : _typeof$1(performance)) && "function" === typeof performance.now) {
22001
22354
  var l = performance;
22002
22355
  exports.unstable_now = function () {
22003
22356
  return l.now();
@@ -22168,7 +22521,7 @@ function requireScheduler_production_min() {
22168
22521
  };
22169
22522
  exports.unstable_scheduleCallback = function (a, b, c) {
22170
22523
  var d = exports.unstable_now();
22171
- "object" === _typeof(c) && null !== c ? (c = c.delay, c = "number" === typeof c && 0 < c ? d + c : d) : c = d;
22524
+ "object" === _typeof$1(c) && null !== c ? (c = c.delay, c = "number" === typeof c && 0 < c ? d + c : d) : c = d;
22172
22525
  switch (a) {
22173
22526
  case 1:
22174
22527
  var e = -1;
@@ -22258,7 +22611,7 @@ function requireReactDom_production_min() {
22258
22611
  }
22259
22612
  function pa(a, b, c, d) {
22260
22613
  if (null !== c && 0 === c.type) return !1;
22261
- switch (_typeof(b)) {
22614
+ switch (_typeof$1(b)) {
22262
22615
  case "function":
22263
22616
  case "symbol":
22264
22617
  return !0;
@@ -22368,7 +22721,7 @@ function requireReactDom_production_min() {
22368
22721
  var Ia = Symbol["for"]("react.offscreen");
22369
22722
  var Ja = Symbol.iterator;
22370
22723
  function Ka(a) {
22371
- if (null === a || "object" !== _typeof(a)) return null;
22724
+ if (null === a || "object" !== _typeof$1(a)) return null;
22372
22725
  a = Ja && a[Ja] || a["@@iterator"];
22373
22726
  return "function" === typeof a ? a : null;
22374
22727
  }
@@ -22397,7 +22750,7 @@ function requireReactDom_production_min() {
22397
22750
  set: function set() {
22398
22751
  throw Error();
22399
22752
  }
22400
- }), "object" === (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && Reflect.construct) {
22753
+ }), "object" === (typeof Reflect === "undefined" ? "undefined" : _typeof$1(Reflect)) && Reflect.construct) {
22401
22754
  try {
22402
22755
  Reflect.construct(b, []);
22403
22756
  } catch (l) {
@@ -22479,7 +22832,7 @@ function requireReactDom_production_min() {
22479
22832
  case Fa:
22480
22833
  return "SuspenseList";
22481
22834
  }
22482
- if ("object" === _typeof(a)) switch (a.$$typeof) {
22835
+ if ("object" === _typeof$1(a)) switch (a.$$typeof) {
22483
22836
  case Ca:
22484
22837
  return (a.displayName || "Context") + ".Consumer";
22485
22838
  case Ba:
@@ -22551,7 +22904,7 @@ function requireReactDom_production_min() {
22551
22904
  return null;
22552
22905
  }
22553
22906
  function Sa(a) {
22554
- switch (_typeof(a)) {
22907
+ switch (_typeof$1(a)) {
22555
22908
  case "boolean":
22556
22909
  case "number":
22557
22910
  case "string":
@@ -22862,9 +23215,9 @@ function requireReactDom_production_min() {
22862
23215
  if (tb[a] && (null != b.children || null != b.dangerouslySetInnerHTML)) throw Error(p(137, a));
22863
23216
  if (null != b.dangerouslySetInnerHTML) {
22864
23217
  if (null != b.children) throw Error(p(60));
22865
- if ("object" !== _typeof(b.dangerouslySetInnerHTML) || !("__html" in b.dangerouslySetInnerHTML)) throw Error(p(61));
23218
+ if ("object" !== _typeof$1(b.dangerouslySetInnerHTML) || !("__html" in b.dangerouslySetInnerHTML)) throw Error(p(61));
22866
23219
  }
22867
- if (null != b.style && "object" !== _typeof(b.style)) throw Error(p(62));
23220
+ if (null != b.style && "object" !== _typeof$1(b.style)) throw Error(p(62));
22868
23221
  }
22869
23222
  }
22870
23223
  function vb(a, b) {
@@ -22950,7 +23303,7 @@ function requireReactDom_production_min() {
22950
23303
  a = !1;
22951
23304
  }
22952
23305
  if (a) return null;
22953
- if (c && "function" !== typeof c) throw Error(p(231, b, _typeof(c)));
23306
+ if (c && "function" !== typeof c) throw Error(p(231, b, _typeof$1(c)));
22954
23307
  return c;
22955
23308
  }
22956
23309
  var Lb = !1;
@@ -23864,7 +24217,7 @@ function requireReactDom_production_min() {
23864
24217
  }
23865
24218
  function he(a) {
23866
24219
  a = a.detail;
23867
- return "object" === _typeof(a) && "data" in a ? a.data : null;
24220
+ return "object" === _typeof$1(a) && "data" in a ? a.data : null;
23868
24221
  }
23869
24222
  var ie = !1;
23870
24223
  function je(a, b) {
@@ -23981,7 +24334,7 @@ function requireReactDom_production_min() {
23981
24334
  var He = "function" === typeof Object.is ? Object.is : Ge;
23982
24335
  function Ie(a, b) {
23983
24336
  if (He(a, b)) return !0;
23984
- if ("object" !== _typeof(a) || null === a || "object" !== _typeof(b) || null === b) return !1;
24337
+ if ("object" !== _typeof$1(a) || null === a || "object" !== _typeof$1(b) || null === b) return !1;
23985
24338
  var c = Object.keys(a),
23986
24339
  d = Object.keys(b);
23987
24340
  if (c.length !== d.length) return !1;
@@ -24508,7 +24861,7 @@ function requireReactDom_production_min() {
24508
24861
  var Cf = null,
24509
24862
  Df = null;
24510
24863
  function Ef(a, b) {
24511
- return "textarea" === a || "noscript" === a || "string" === typeof b.children || "number" === typeof b.children || "object" === _typeof(b.dangerouslySetInnerHTML) && null !== b.dangerouslySetInnerHTML && null != b.dangerouslySetInnerHTML.__html;
24864
+ 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;
24512
24865
  }
24513
24866
  var Ff = "function" === typeof setTimeout ? setTimeout : void 0,
24514
24867
  Gf = "function" === typeof clearTimeout ? clearTimeout : void 0,
@@ -25156,7 +25509,7 @@ function requireReactDom_production_min() {
25156
25509
  var d = !1,
25157
25510
  e = Vf;
25158
25511
  var f = b.contextType;
25159
- "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);
25512
+ "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);
25160
25513
  b = new b(c, f);
25161
25514
  a.memoizedState = null !== b.state && void 0 !== b.state ? b.state : null;
25162
25515
  b.updater = nh;
@@ -25178,7 +25531,7 @@ function requireReactDom_production_min() {
25178
25531
  e.refs = jh;
25179
25532
  ah(a);
25180
25533
  var f = b.contextType;
25181
- "object" === _typeof(f) && null !== f ? e.context = Vg(f) : (f = Zf(b) ? Xf : H.current, e.context = Yf(a, f));
25534
+ "object" === _typeof$1(f) && null !== f ? e.context = Vg(f) : (f = Zf(b) ? Xf : H.current, e.context = Yf(a, f));
25182
25535
  e.state = a.memoizedState;
25183
25536
  f = b.getDerivedStateFromProps;
25184
25537
  "function" === typeof f && (kh(a, b, f, c), e.state = a.memoizedState);
@@ -25187,7 +25540,7 @@ function requireReactDom_production_min() {
25187
25540
  }
25188
25541
  function sh(a, b, c) {
25189
25542
  a = c.ref;
25190
- if (null !== a && "function" !== typeof a && "object" !== _typeof(a)) {
25543
+ if (null !== a && "function" !== typeof a && "object" !== _typeof$1(a)) {
25191
25544
  if (c._owner) {
25192
25545
  c = c._owner;
25193
25546
  if (c) {
@@ -25262,7 +25615,7 @@ function requireReactDom_production_min() {
25262
25615
  function k(a, b, c, d) {
25263
25616
  var f = c.type;
25264
25617
  if (f === ya) return m(a, b, c.props.children, d, c.key);
25265
- 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;
25618
+ 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;
25266
25619
  d = yh(c.type, c.key, c.props, null, a.mode, d);
25267
25620
  d.ref = sh(a, b, c);
25268
25621
  d["return"] = a;
@@ -25282,7 +25635,7 @@ function requireReactDom_production_min() {
25282
25635
  }
25283
25636
  function q(a, b, c) {
25284
25637
  if ("string" === typeof b && "" !== b || "number" === typeof b) return b = xh("" + b, a.mode, c), b["return"] = a, b;
25285
- if ("object" === _typeof(b) && null !== b) {
25638
+ if ("object" === _typeof$1(b) && null !== b) {
25286
25639
  switch (b.$$typeof) {
25287
25640
  case va:
25288
25641
  return c = yh(b.type, b.key, b.props, null, a.mode, c), c.ref = sh(a, null, b), c["return"] = a, c;
@@ -25300,7 +25653,7 @@ function requireReactDom_production_min() {
25300
25653
  function r(a, b, c, d) {
25301
25654
  var e = null !== b ? b.key : null;
25302
25655
  if ("string" === typeof c && "" !== c || "number" === typeof c) return null !== e ? null : h(a, b, "" + c, d);
25303
- if ("object" === _typeof(c) && null !== c) {
25656
+ if ("object" === _typeof$1(c) && null !== c) {
25304
25657
  switch (c.$$typeof) {
25305
25658
  case va:
25306
25659
  return c.key === e ? k(a, b, c, d) : null;
@@ -25316,7 +25669,7 @@ function requireReactDom_production_min() {
25316
25669
  }
25317
25670
  function y(a, b, c, d, e) {
25318
25671
  if ("string" === typeof d && "" !== d || "number" === typeof d) return a = a.get(c) || null, h(b, a, "" + d, e);
25319
- if ("object" === _typeof(d) && null !== d) {
25672
+ if ("object" === _typeof$1(d) && null !== d) {
25320
25673
  switch (d.$$typeof) {
25321
25674
  case va:
25322
25675
  return a = a.get(null === d.key ? c : d.key) || null, k(b, a, d, e);
@@ -25390,8 +25743,8 @@ function requireReactDom_production_min() {
25390
25743
  return l;
25391
25744
  }
25392
25745
  function J(a, d, f, h) {
25393
- "object" === _typeof(f) && null !== f && f.type === ya && null === f.key && (f = f.props.children);
25394
- if ("object" === _typeof(f) && null !== f) {
25746
+ "object" === _typeof$1(f) && null !== f && f.type === ya && null === f.key && (f = f.props.children);
25747
+ if ("object" === _typeof$1(f) && null !== f) {
25395
25748
  switch (f.$$typeof) {
25396
25749
  case va:
25397
25750
  a: {
@@ -25406,7 +25759,7 @@ function requireReactDom_production_min() {
25406
25759
  a = d;
25407
25760
  break a;
25408
25761
  }
25409
- } else if (l.elementType === k || "object" === _typeof(k) && null !== k && k.$$typeof === Ha && uh(k) === l.type) {
25762
+ } else if (l.elementType === k || "object" === _typeof$1(k) && null !== k && k.$$typeof === Ha && uh(k) === l.type) {
25410
25763
  c(a, l.sibling);
25411
25764
  d = e(l, f.props);
25412
25765
  d.ref = sh(a, l, f);
@@ -26291,7 +26644,7 @@ function requireReactDom_production_min() {
26291
26644
  g.props = h;
26292
26645
  var k = g.context,
26293
26646
  l = c.contextType;
26294
- "object" === _typeof(l) && null !== l ? l = Vg(l) : (l = Zf(c) ? Xf : H.current, l = Yf(b, l));
26647
+ "object" === _typeof$1(l) && null !== l ? l = Vg(l) : (l = Zf(c) ? Xf : H.current, l = Yf(b, l));
26295
26648
  var m = c.getDerivedStateFromProps,
26296
26649
  q = "function" === typeof m || "function" === typeof g.getSnapshotBeforeUpdate;
26297
26650
  q || "function" !== typeof g.UNSAFE_componentWillReceiveProps && "function" !== typeof g.componentWillReceiveProps || (h !== d || k !== l) && qh(b, g, d, l);
@@ -26310,7 +26663,7 @@ function requireReactDom_production_min() {
26310
26663
  q = b.pendingProps;
26311
26664
  r = g.context;
26312
26665
  k = c.contextType;
26313
- "object" === _typeof(k) && null !== k ? k = Vg(k) : (k = Zf(c) ? Xf : H.current, k = Yf(b, k));
26666
+ "object" === _typeof$1(k) && null !== k ? k = Vg(k) : (k = Zf(c) ? Xf : H.current, k = Yf(b, k));
26314
26667
  var y = c.getDerivedStateFromProps;
26315
26668
  (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);
26316
26669
  $g = !1;
@@ -28223,7 +28576,7 @@ function requireReactDom_production_min() {
28223
28576
  k = b;
28224
28577
  b = Z;
28225
28578
  h.flags |= 32768;
28226
- if (null !== k && "object" === _typeof(k) && "function" === typeof k.then) {
28579
+ if (null !== k && "object" === _typeof$1(k) && "function" === typeof k.then) {
28227
28580
  var l = k,
28228
28581
  m = h,
28229
28582
  q = m.tag;
@@ -28644,7 +28997,7 @@ function requireReactDom_production_min() {
28644
28997
  e = Xh(null, b, d, a, e, c);
28645
28998
  var f = bi();
28646
28999
  b.flags |= 1;
28647
- "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);
29000
+ "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);
28648
29001
  return b;
28649
29002
  case 16:
28650
29003
  d = b.elementType;
@@ -28885,7 +29238,7 @@ function requireReactDom_production_min() {
28885
29238
  case Ia:
28886
29239
  return qj(c, e, f, b);
28887
29240
  default:
28888
- if ("object" === _typeof(a) && null !== a) switch (a.$$typeof) {
29241
+ if ("object" === _typeof$1(a) && null !== a) switch (a.$$typeof) {
28889
29242
  case Ba:
28890
29243
  g = 10;
28891
29244
  break a;
@@ -28903,7 +29256,7 @@ function requireReactDom_production_min() {
28903
29256
  d = null;
28904
29257
  break a;
28905
29258
  }
28906
- throw Error(p(130, null == a ? a : _typeof(a), ""));
29259
+ throw Error(p(130, null == a ? a : _typeof$1(a), ""));
28907
29260
  }
28908
29261
  b = Bg(g, c, b, e);
28909
29262
  b.elementType = a;
@@ -29551,7 +29904,7 @@ function requireLib() {
29551
29904
  };
29552
29905
  },
29553
29906
  380: function _(e, t, r) {
29554
- var n = "object" == _typeof(r.g) && r.g && r.g.Object === Object && r.g;
29907
+ var n = "object" == _typeof$1(r.g) && r.g && r.g.Object === Object && r.g;
29555
29908
  e.exports = n;
29556
29909
  },
29557
29910
  903: function _(e, t, r) {
@@ -29579,7 +29932,7 @@ function requireLib() {
29579
29932
  },
29580
29933
  433: function _(e, t, r) {
29581
29934
  var n = r(380),
29582
- u = "object" == (typeof self === "undefined" ? "undefined" : _typeof(self)) && self && self.Object === Object && self,
29935
+ u = "object" == (typeof self === "undefined" ? "undefined" : _typeof$1(self)) && self && self.Object === Object && self,
29583
29936
  o = n || u || Function("return this")();
29584
29937
  e.exports = o;
29585
29938
  },
@@ -29648,20 +30001,20 @@ function requireLib() {
29648
30001
  },
29649
30002
  953: function _(e) {
29650
30003
  e.exports = function (e) {
29651
- var t = _typeof(e);
30004
+ var t = _typeof$1(e);
29652
30005
  return null != e && ("object" == t || "function" == t);
29653
30006
  };
29654
30007
  },
29655
30008
  934: function _(e) {
29656
30009
  e.exports = function (e) {
29657
- return null != e && "object" == _typeof(e);
30010
+ return null != e && "object" == _typeof$1(e);
29658
30011
  };
29659
30012
  },
29660
30013
  414: function _(e, t, r) {
29661
30014
  var n = r(148),
29662
30015
  u = r(934);
29663
30016
  e.exports = function (e) {
29664
- return "symbol" == _typeof(e) || u(e) && "[object Symbol]" == n(e);
30017
+ return "symbol" == _typeof$1(e) || u(e) && "[object Symbol]" == n(e);
29665
30018
  };
29666
30019
  },
29667
30020
  664: function _(e, t, r) {
@@ -29738,11 +30091,11 @@ function requireLib() {
29738
30091
  get: t[r]
29739
30092
  });
29740
30093
  }, u.g = function () {
29741
- if ("object" == (typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis))) return globalThis;
30094
+ if ("object" == (typeof globalThis === "undefined" ? "undefined" : _typeof$1(globalThis))) return globalThis;
29742
30095
  try {
29743
30096
  return this || new Function("return this")();
29744
30097
  } catch (e) {
29745
- if ("object" == (typeof window === "undefined" ? "undefined" : _typeof(window))) return window;
30098
+ if ("object" == (typeof window === "undefined" ? "undefined" : _typeof$1(window))) return window;
29746
30099
  }
29747
30100
  }(), u.o = function (e, t) {
29748
30101
  return Object.prototype.hasOwnProperty.call(e, t);
@@ -29864,7 +30217,7 @@ function requireLib() {
29864
30217
  }
29865
30218
  var h = Object.prototype.constructor.toString();
29866
30219
  function p(e) {
29867
- if (!e || "object" != _typeof(e)) return !1;
30220
+ if (!e || "object" != _typeof$1(e)) return !1;
29868
30221
  var t = c(e);
29869
30222
  if (null === t) return !0;
29870
30223
  var r = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
@@ -30161,7 +30514,7 @@ function requireLib() {
30161
30514
  }
30162
30515
  return k(_u4, r), R(n, _u4);
30163
30516
  }
30164
- if (!e || "object" != _typeof(e)) {
30517
+ if (!e || "object" != _typeof$1(e)) {
30165
30518
  if (n = t(e), void 0 === n && (n = e), n === a && (n = void 0), _this.autoFreeze_ && E(n, !0), r) {
30166
30519
  var _t6 = [],
30167
30520
  _u5 = [];
@@ -30439,10 +30792,10 @@ function requireLib() {
30439
30792
  }
30440
30793
  };
30441
30794
  function se(e) {
30442
- return se = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
30443
- return _typeof(e);
30795
+ return se = "function" == typeof Symbol && "symbol" == _typeof$1(Symbol.iterator) ? function (e) {
30796
+ return _typeof$1(e);
30444
30797
  } : function (e) {
30445
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
30798
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof$1(e);
30446
30799
  }, se(e);
30447
30800
  }
30448
30801
  function le(e, t, r) {
@@ -35126,7 +35479,7 @@ function requireLib() {
35126
35479
  Jt = u(858),
35127
35480
  Yt = u.n(Jt);
35128
35481
  var Zt = function Zt(e) {
35129
- return "object" == _typeof(e) && null != e && 1 === e.nodeType;
35482
+ return "object" == _typeof$1(e) && null != e && 1 === e.nodeType;
35130
35483
  },
35131
35484
  Gt = function Gt(e, t) {
35132
35485
  return (!t || "hidden" !== e) && "visible" !== e && "clip" !== e;
@@ -35346,10 +35699,10 @@ function requireLib() {
35346
35699
  "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);
35347
35700
  var Tr = (!Or || !xr) && !Ar && "undefined" != typeof globalThis && globalThis.InputEvent && "function" == typeof globalThis.InputEvent.prototype.getTargetRanges;
35348
35701
  function Mr(e) {
35349
- return Mr = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
35350
- return _typeof(e);
35702
+ return Mr = "function" == typeof Symbol && "symbol" == _typeof$1(Symbol.iterator) ? function (e) {
35703
+ return _typeof$1(e);
35351
35704
  } : function (e) {
35352
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
35705
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof$1(e);
35353
35706
  }, Mr(e);
35354
35707
  }
35355
35708
  function Rr(e, t, r) {
@@ -36422,10 +36775,10 @@ function requireLib() {
36422
36775
  return u;
36423
36776
  }
36424
36777
  function mu(e) {
36425
- return mu = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
36426
- return _typeof(e);
36778
+ return mu = "function" == typeof Symbol && "symbol" == _typeof$1(Symbol.iterator) ? function (e) {
36779
+ return _typeof$1(e);
36427
36780
  } : function (e) {
36428
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
36781
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof$1(e);
36429
36782
  }, mu(e);
36430
36783
  }
36431
36784
  function yu(e, t, r) {
@@ -38177,7 +38530,7 @@ function requireLib() {
38177
38530
  };
38178
38531
  }(e);
38179
38532
  if (function (e) {
38180
- return "object" == _typeof(e) && "function" == typeof e.behavior;
38533
+ return "object" == _typeof$1(e) && "function" == typeof e.behavior;
38181
38534
  }(t)) return t.behavior(rr(e, t));
38182
38535
  var n = "boolean" == typeof t || null == t ? void 0 : t.behavior;
38183
38536
  var _iterator47 = _createForOfIteratorHelper(rr(e, function (e) {
@@ -41293,4 +41646,4 @@ var FloatingIsland = function FloatingIsland(_ref2) {
41293
41646
  }));
41294
41647
  };
41295
41648
 
41296
- export { Accordion, Alert, AppCue, Attachment, index$9 as Avatar, Badge$1 as Badge, BottomNavigation, BottomSheet$1 as BottomSheet, Box, CompoundButton as Button, Calendar$1 as Calendar, Card$1 as Card, index$8 as Carousel, Checkbox, Chip, Collapse, ContentNavigator, DatePicker, Divider, index$7 as Drawer, Empty, ErrorComponent as Error, FAB, FlatListWithFAB, FloatingIsland, HeroDesignProvider, Icon, Image, List, index$6 as MapPin, PageControl, PinInput, Portal$1 as Portal, Progress, CompoundRadio as Radio, Rate, RefreshControl, index as RichTextEditor, ScrollViewWithFAB, Search, SectionHeading, SectionListWithFAB, index$4 as Select, Skeleton, Slider, Spinner, Success, index$5 as Swipeable, index$3 as Switch, index$2 as Tabs, Tag, TextInput, ThemeProvider, ThemeSwitcher, TimePicker, Toast, index$1 as Toolbar, Typography, eBensSystemPalette, ehJobsSystemPalette, ehWorkDarkSystemPalette, ehWorkSystemPalette, getTheme$1 as getTheme, jobsSystemPalette, scale, swagDarkSystemPalette, swagLightJobsSystemPalette, swagSystemPalette$1 as swagLightSystemPalette, swagSystemPalette$2 as swagSystemPalette, defaultTheme as theme, useAvatarColors, useTheme, walletSystemPalette, withTheme, workSystemPalette };
41649
+ export { Accordion, Alert, AppCue, Attachment, index$9 as Avatar, Badge$1 as Badge, BottomNavigation, BottomSheet$1 as BottomSheet, Box, CompoundButton as Button, Calendar$1 as Calendar, Card$1 as Card, index$8 as Carousel, Checkbox, Chip, Collapse, ContentNavigator, DatePicker, Divider, index$7 as Drawer, Empty, ErrorComponent as Error, FAB, FlatListWithFAB, FloatingIsland, HeroDesignProvider, Icon, Image, List, LocaleProvider, index$6 as MapPin, PageControl, PinInput, Portal$1 as Portal, Progress, CompoundRadio as Radio, Rate, RefreshControl, index as RichTextEditor, ScrollViewWithFAB, Search, SectionHeading, SectionListWithFAB, index$4 as Select, Skeleton, Slider, Spinner, Success, index$5 as Swipeable, index$3 as Switch, index$2 as Tabs, Tag, TextInput, ThemeProvider, ThemeSwitcher, TimePicker, Toast, index$1 as Toolbar, Typography, eBensSystemPalette, ehJobsSystemPalette, ehWorkDarkSystemPalette, ehWorkSystemPalette, getTheme$1 as getTheme, jobsSystemPalette, scale, swagDarkSystemPalette, swagLightJobsSystemPalette, swagSystemPalette$1 as swagLightSystemPalette, swagSystemPalette$2 as swagSystemPalette, defaultTheme as theme, useAvatarColors, useTheme, walletSystemPalette, withTheme, workSystemPalette };