@hero-design/rn 8.89.0-alpha.0 → 8.89.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 (50) hide show
  1. package/.turbo/turbo-build.log +13 -0
  2. package/CHANGELOG.md +10 -0
  3. package/es/index.js +1441 -1126
  4. package/lib/index.js +1441 -1127
  5. package/package.json +2 -3
  6. package/src/components/Calendar/CalendarRange.tsx +337 -0
  7. package/src/components/Calendar/CalendarRangeConnector.tsx +68 -0
  8. package/src/components/Calendar/CalendarRowItem.tsx +14 -3
  9. package/src/components/Calendar/StyledCalendar.tsx +23 -9
  10. package/src/components/Calendar/__tests__/CalendarRange.spec.tsx +284 -0
  11. package/src/components/Calendar/__tests__/CalendarRangeConnector.spec.tsx +73 -0
  12. package/src/components/Calendar/__tests__/__snapshots__/CalendarRangeConnector.spec.tsx.snap +632 -0
  13. package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +45 -20
  14. package/src/components/Calendar/__tests__/helper.spec.ts +110 -1
  15. package/src/components/Calendar/helpers.ts +75 -0
  16. package/src/components/Calendar/index.tsx +19 -15
  17. package/src/components/RichTextEditor/RichTextEditor.tsx +14 -20
  18. package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +2 -4
  19. package/src/index.ts +0 -2
  20. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +9 -4
  21. package/src/theme/components/calendar.ts +6 -1
  22. package/src/theme/global/index.ts +0 -2
  23. package/src/theme/index.ts +0 -2
  24. package/src/types.ts +2 -0
  25. package/stats/8.88.0/rn-stats.html +0 -2
  26. package/stats/8.89.0/rn-stats.html +4842 -0
  27. package/types/components/Calendar/CalendarRowItem.d.ts +3 -1
  28. package/types/components/Calendar/StyledCalendar.d.ts +2 -1
  29. package/types/components/Calendar/helpers.d.ts +15 -0
  30. package/types/components/Calendar/index.d.ts +4 -2
  31. package/types/index.d.ts +2 -2
  32. package/types/theme/components/calendar.d.ts +5 -0
  33. package/types/theme/global/index.d.ts +1 -2
  34. package/types/theme/index.d.ts +2 -2
  35. package/types/types.d.ts +2 -1
  36. package/src/theme/global/colors/ehWorkDark.ts +0 -60
  37. package/types/components/Calendar/CalendarRangeSelectedItem.d.ts +0 -11
  38. package/types/components/Calendar/Sample.d.ts +0 -13
  39. package/types/components/Calendar/hooks/useCalendarLayout.d.ts +0 -7
  40. package/types/components/Calendar/useSetUpCalendar.d.ts +0 -0
  41. package/types/components/CompoundSearch/CompoundSearchHandler.d.ts +0 -31
  42. package/types/components/CompoundSearch/CompoundSearchTextInput.d.ts +0 -60
  43. package/types/components/CompoundSearch/StyledCompoundSearch.d.ts +0 -40
  44. package/types/components/CompoundSearch/index.d.ts +0 -8
  45. package/types/components/CompoundSearch/utils.d.ts +0 -8
  46. package/types/components/FloatingIsland/SingleLine/StyledSingleLine.d.ts +0 -15
  47. package/types/components/FloatingIsland/SingleLine/index.d.ts +0 -24
  48. package/types/test-utils.d.ts +0 -4
  49. package/types/theme/components/compoundSearch.d.ts +0 -36
  50. package/types/theme/global/colors/ehWorkDark.d.ts +0 -48
package/es/index.js CHANGED
@@ -363,14 +363,14 @@ function _regeneratorRuntime() {
363
363
  }
364
364
  }, e;
365
365
  }
366
- function _typeof$1(o) {
366
+ function _typeof(o) {
367
367
  "@babel/helpers - typeof";
368
368
 
369
- return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
369
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
370
370
  return typeof o;
371
371
  } : function (o) {
372
372
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
373
- }, _typeof$1(o);
373
+ }, _typeof(o);
374
374
  }
375
375
  function _classCallCheck(instance, Constructor) {
376
376
  if (!(instance instanceof Constructor)) {
@@ -2062,62 +2062,6 @@ var eBensBrandSystemPallete = {
2062
2062
  };
2063
2063
  var eBensSystemPalette = _objectSpread2(_objectSpread2({}, swagSystemPalette$1), eBensBrandSystemPallete);
2064
2064
 
2065
- var ehWorkDarkPalette = _objectSpread2(_objectSpread2({}, swagLightGlobalPalette), {}, {
2066
- // Surface
2067
- defaultGlobalSurface: '#27272A',
2068
- neutralGlobalSurface: '#121214',
2069
- darkGlobalSurface: '#fcfbff',
2070
- overlayGlobalSurface: '#ffffff',
2071
- // On Surface
2072
- onDefaultGlobalSurface: '#ffffff',
2073
- mutedOnDefaultGlobalSurface: '#a9a9b2',
2074
- inactiveOnDefaultGlobalSurface: '#71717a',
2075
- disabledOnDefaultGlobalSurface: '#52525b',
2076
- onOnDarkGlobalSurface: '#121214',
2077
- // Outline:
2078
- primaryOutline: '#a9a9b2',
2079
- secondaryOutline: '#3f3f46',
2080
- inactiveOutline: '#71717a',
2081
- disabledOutline: '#52525b',
2082
- // Archived:
2083
- archivedSurface: '#52525b',
2084
- mutedArchived: '#3f3f46',
2085
- archived: '#71717a',
2086
- onArchivedSurface: '#a9a9b2',
2087
- // Error:
2088
- errorSurface: '#7a1d06',
2089
- mutedError: '#9b2508',
2090
- error: '#bd2d09',
2091
- onErrorSurface: '#fecfca',
2092
- // Warming:
2093
- warningSurface: '#963e03',
2094
- mutedWarning: '#c35004',
2095
- warning: '#dc6204',
2096
- onWarningSurface: '#fff0d5',
2097
- // Success:
2098
- successSurface: '#00483e',
2099
- mutedSuccess: '#016256',
2100
- success: '#017d6d',
2101
- onSuccessSurface: '#a7f3e9',
2102
- // Info:
2103
- infoSurface: '#004a61',
2104
- mutedInfo: '#006585',
2105
- info: '#007da3',
2106
- onInfoSurface: '#a0e8ff',
2107
- // Brand:
2108
- primary: '#cdacfe',
2109
- onPrimary: '#fdfbff',
2110
- secondary: '#7622d7',
2111
- onSecondary: '#ffffff',
2112
- defaultSurface: '#fdfbff',
2113
- highlightedSurface: '#280541',
2114
- pressedSurface: '#9a58fc',
2115
- decorativePrimary: '#fdfbff',
2116
- decorativePrimarySurface: '#74409a',
2117
- decorativeSecondary: '#fdfbff',
2118
- decorativeSecondarySurface: '#f0e6ff'
2119
- });
2120
-
2121
2065
  var BASE_WIDTH = 390; // Based on iPhone 13's viewport size
2122
2066
  var horizontalScale = function horizontalScale(size) {
2123
2067
  if (Platform.OS === 'web') {
@@ -2684,9 +2628,13 @@ var getCalendarTheme = function getCalendarTheme(theme) {
2684
2628
  background: theme.colors.defaultGlobalSurface,
2685
2629
  border: theme.colors.primaryOutline,
2686
2630
  primary: theme.colors.primary,
2687
- inverted: theme.colors.onDarkGlobalSurface
2631
+ inverted: theme.colors.onDarkGlobalSurface,
2632
+ rowItem: {
2633
+ selected: theme.colors.primary,
2634
+ highlighted: theme.colors.highlightedSurface
2635
+ }
2688
2636
  };
2689
- var cellSize = theme.sizes.xxxlarge;
2637
+ var cellSize = theme.sizes.xxxxlarge;
2690
2638
  var markSize = theme.sizes.xsmall;
2691
2639
  var sizes = {
2692
2640
  cellWidth: cellSize,
@@ -2701,7 +2649,8 @@ var getCalendarTheme = function getCalendarTheme(theme) {
2701
2649
  headerVerticalPadding: theme.space.medium,
2702
2650
  headerHorizontalPadding: theme.space.smallMedium,
2703
2651
  headerMarginRight: theme.space.small,
2704
- iosPickerMarginVertical: theme.space['5xlarge']
2652
+ iosPickerMarginVertical: theme.space['5xlarge'],
2653
+ cellPadding: theme.space.xlarge
2705
2654
  };
2706
2655
  var radii = {
2707
2656
  "default": theme.radii.rounded
@@ -5951,7 +5900,7 @@ function requireCamelize() {
5951
5900
  return walk(obj);
5952
5901
  };
5953
5902
  function walk(obj) {
5954
- if (!obj || _typeof$1(obj) !== 'object') return obj;
5903
+ if (!obj || _typeof(obj) !== 'object') return obj;
5955
5904
  if (isDate(obj) || isRegex(obj)) return obj;
5956
5905
  if (isArray(obj)) return map(obj, walk);
5957
5906
  return reduce(objectKeys(obj), function (acc, key) {
@@ -6314,7 +6263,7 @@ function requireCssToReactNative() {
6314
6263
  value: true
6315
6264
  });
6316
6265
  function _interopDefault(ex) {
6317
- return ex && _typeof$1(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
6266
+ return ex && _typeof(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
6318
6267
  }
6319
6268
  var parse = requireLib$1();
6320
6269
  var parse__default = _interopDefault(parse);
@@ -7038,7 +6987,7 @@ var generated = {};
7038
6987
  var buffer = '';
7039
6988
  var lastType;
7040
6989
  function handleInterpolation(interpolation, i, arr) {
7041
- var type = _typeof$1(interpolation);
6990
+ var type = _typeof(interpolation);
7042
6991
  if (type === 'string') {
7043
6992
  // strip comments
7044
6993
  interpolation = interpolation.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '');
@@ -10573,59 +10522,12 @@ var BottomSheet$1 = Object.assign(BottomSheet, {
10573
10522
  ScrollView: BottomSheetScrollView
10574
10523
  });
10575
10524
 
10576
- function _typeof(o) {
10577
- "@babel/helpers - typeof";
10578
-
10579
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
10580
- return typeof o;
10581
- } : function (o) {
10582
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
10583
- }, _typeof(o);
10584
- }
10585
-
10586
10525
  function requiredArgs(required, args) {
10587
10526
  if (args.length < required) {
10588
10527
  throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
10589
10528
  }
10590
10529
  }
10591
10530
 
10592
- /**
10593
- * @name isDate
10594
- * @category Common Helpers
10595
- * @summary Is the given value a date?
10596
- *
10597
- * @description
10598
- * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
10599
- *
10600
- * @param {*} value - the value to check
10601
- * @returns {boolean} true if the given value is a date
10602
- * @throws {TypeError} 1 arguments required
10603
- *
10604
- * @example
10605
- * // For a valid date:
10606
- * const result = isDate(new Date())
10607
- * //=> true
10608
- *
10609
- * @example
10610
- * // For an invalid date:
10611
- * const result = isDate(new Date(NaN))
10612
- * //=> true
10613
- *
10614
- * @example
10615
- * // For some value:
10616
- * const result = isDate('2014-02-31')
10617
- * //=> false
10618
- *
10619
- * @example
10620
- * // For an object:
10621
- * const result = isDate({})
10622
- * //=> false
10623
- */
10624
- function isDate(value) {
10625
- requiredArgs(1, arguments);
10626
- return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
10627
- }
10628
-
10629
10531
  /**
10630
10532
  * @name toDate
10631
10533
  * @category Common Helpers
@@ -10656,11 +10558,11 @@ function isDate(value) {
10656
10558
  * const result = toDate(1392098430000)
10657
10559
  * //=> Tue Feb 11 2014 11:30:30
10658
10560
  */
10561
+
10659
10562
  function toDate(argument) {
10660
10563
  requiredArgs(1, arguments);
10661
- var argStr = Object.prototype.toString.call(argument);
10564
+ var argStr = Object.prototype.toString.call(argument); // Clone the date
10662
10565
 
10663
- // Clone the date
10664
10566
  if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
10665
10567
  // Prevent the date to lose the milliseconds when passed to new Date() in IE10
10666
10568
  return new Date(argument.getTime());
@@ -10669,8 +10571,8 @@ function toDate(argument) {
10669
10571
  } else {
10670
10572
  if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
10671
10573
  // eslint-disable-next-line no-console
10672
- 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");
10673
- // eslint-disable-next-line no-console
10574
+ 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
10575
+
10674
10576
  console.warn(new Error().stack);
10675
10577
  }
10676
10578
  return new Date(NaN);
@@ -10689,34 +10591,544 @@ function toDate(argument) {
10689
10591
  *
10690
10592
  * Time value of Date: http://es5.github.io/#x15.9.1.1
10691
10593
  *
10594
+ * ### v2.0.0 breaking changes:
10595
+ *
10596
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
10597
+ *
10598
+ * - Now `isValid` doesn't throw an exception
10599
+ * if the first argument is not an instance of Date.
10600
+ * Instead, argument is converted beforehand using `toDate`.
10601
+ *
10602
+ * Examples:
10603
+ *
10604
+ * | `isValid` argument | Before v2.0.0 | v2.0.0 onward |
10605
+ * |---------------------------|---------------|---------------|
10606
+ * | `new Date()` | `true` | `true` |
10607
+ * | `new Date('2016-01-01')` | `true` | `true` |
10608
+ * | `new Date('')` | `false` | `false` |
10609
+ * | `new Date(1488370835081)` | `true` | `true` |
10610
+ * | `new Date(NaN)` | `false` | `false` |
10611
+ * | `'2016-01-01'` | `TypeError` | `false` |
10612
+ * | `''` | `TypeError` | `false` |
10613
+ * | `1488370835081` | `TypeError` | `true` |
10614
+ * | `NaN` | `TypeError` | `false` |
10615
+ *
10616
+ * We introduce this change to make *date-fns* consistent with ECMAScript behavior
10617
+ * that try to coerce arguments to the expected type
10618
+ * (which is also the case with other *date-fns* functions).
10619
+ *
10692
10620
  * @param {*} date - the date to check
10693
10621
  * @returns {Boolean} the date is valid
10694
10622
  * @throws {TypeError} 1 argument required
10695
10623
  *
10696
10624
  * @example
10697
10625
  * // For the valid date:
10698
- * const result = isValid(new Date(2014, 1, 31))
10626
+ * var result = isValid(new Date(2014, 1, 31))
10699
10627
  * //=> true
10700
10628
  *
10701
10629
  * @example
10702
10630
  * // For the value, convertable into a date:
10703
- * const result = isValid(1393804800000)
10631
+ * var result = isValid(1393804800000)
10704
10632
  * //=> true
10705
10633
  *
10706
10634
  * @example
10707
10635
  * // For the invalid date:
10708
- * const result = isValid(new Date(''))
10636
+ * var result = isValid(new Date(''))
10709
10637
  * //=> false
10710
10638
  */
10639
+
10711
10640
  function isValid(dirtyDate) {
10712
10641
  requiredArgs(1, arguments);
10713
- if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
10714
- return false;
10715
- }
10716
10642
  var date = toDate(dirtyDate);
10717
- return !isNaN(Number(date));
10643
+ return !isNaN(date);
10644
+ }
10645
+
10646
+ var formatDistanceLocale = {
10647
+ lessThanXSeconds: {
10648
+ one: 'less than a second',
10649
+ other: 'less than {{count}} seconds'
10650
+ },
10651
+ xSeconds: {
10652
+ one: '1 second',
10653
+ other: '{{count}} seconds'
10654
+ },
10655
+ halfAMinute: 'half a minute',
10656
+ lessThanXMinutes: {
10657
+ one: 'less than a minute',
10658
+ other: 'less than {{count}} minutes'
10659
+ },
10660
+ xMinutes: {
10661
+ one: '1 minute',
10662
+ other: '{{count}} minutes'
10663
+ },
10664
+ aboutXHours: {
10665
+ one: 'about 1 hour',
10666
+ other: 'about {{count}} hours'
10667
+ },
10668
+ xHours: {
10669
+ one: '1 hour',
10670
+ other: '{{count}} hours'
10671
+ },
10672
+ xDays: {
10673
+ one: '1 day',
10674
+ other: '{{count}} days'
10675
+ },
10676
+ aboutXWeeks: {
10677
+ one: 'about 1 week',
10678
+ other: 'about {{count}} weeks'
10679
+ },
10680
+ xWeeks: {
10681
+ one: '1 week',
10682
+ other: '{{count}} weeks'
10683
+ },
10684
+ aboutXMonths: {
10685
+ one: 'about 1 month',
10686
+ other: 'about {{count}} months'
10687
+ },
10688
+ xMonths: {
10689
+ one: '1 month',
10690
+ other: '{{count}} months'
10691
+ },
10692
+ aboutXYears: {
10693
+ one: 'about 1 year',
10694
+ other: 'about {{count}} years'
10695
+ },
10696
+ xYears: {
10697
+ one: '1 year',
10698
+ other: '{{count}} years'
10699
+ },
10700
+ overXYears: {
10701
+ one: 'over 1 year',
10702
+ other: 'over {{count}} years'
10703
+ },
10704
+ almostXYears: {
10705
+ one: 'almost 1 year',
10706
+ other: 'almost {{count}} years'
10707
+ }
10708
+ };
10709
+ function formatDistance(token, count, options) {
10710
+ options = options || {};
10711
+ var result;
10712
+ if (typeof formatDistanceLocale[token] === 'string') {
10713
+ result = formatDistanceLocale[token];
10714
+ } else if (count === 1) {
10715
+ result = formatDistanceLocale[token].one;
10716
+ } else {
10717
+ result = formatDistanceLocale[token].other.replace('{{count}}', count);
10718
+ }
10719
+ if (options.addSuffix) {
10720
+ if (options.comparison > 0) {
10721
+ return 'in ' + result;
10722
+ } else {
10723
+ return result + ' ago';
10724
+ }
10725
+ }
10726
+ return result;
10727
+ }
10728
+
10729
+ function buildFormatLongFn(args) {
10730
+ return function (dirtyOptions) {
10731
+ var options = dirtyOptions || {};
10732
+ var width = options.width ? String(options.width) : args.defaultWidth;
10733
+ var format = args.formats[width] || args.formats[args.defaultWidth];
10734
+ return format;
10735
+ };
10736
+ }
10737
+
10738
+ var dateFormats = {
10739
+ full: 'EEEE, MMMM do, y',
10740
+ "long": 'MMMM do, y',
10741
+ medium: 'MMM d, y',
10742
+ "short": 'MM/dd/yyyy'
10743
+ };
10744
+ var timeFormats = {
10745
+ full: 'h:mm:ss a zzzz',
10746
+ "long": 'h:mm:ss a z',
10747
+ medium: 'h:mm:ss a',
10748
+ "short": 'h:mm a'
10749
+ };
10750
+ var dateTimeFormats = {
10751
+ full: "{{date}} 'at' {{time}}",
10752
+ "long": "{{date}} 'at' {{time}}",
10753
+ medium: '{{date}}, {{time}}',
10754
+ "short": '{{date}}, {{time}}'
10755
+ };
10756
+ var formatLong = {
10757
+ date: buildFormatLongFn({
10758
+ formats: dateFormats,
10759
+ defaultWidth: 'full'
10760
+ }),
10761
+ time: buildFormatLongFn({
10762
+ formats: timeFormats,
10763
+ defaultWidth: 'full'
10764
+ }),
10765
+ dateTime: buildFormatLongFn({
10766
+ formats: dateTimeFormats,
10767
+ defaultWidth: 'full'
10768
+ })
10769
+ };
10770
+
10771
+ var formatRelativeLocale = {
10772
+ lastWeek: "'last' eeee 'at' p",
10773
+ yesterday: "'yesterday at' p",
10774
+ today: "'today at' p",
10775
+ tomorrow: "'tomorrow at' p",
10776
+ nextWeek: "eeee 'at' p",
10777
+ other: 'P'
10778
+ };
10779
+ function formatRelative(token, _date, _baseDate, _options) {
10780
+ return formatRelativeLocale[token];
10781
+ }
10782
+
10783
+ function buildLocalizeFn(args) {
10784
+ return function (dirtyIndex, dirtyOptions) {
10785
+ var options = dirtyOptions || {};
10786
+ var context = options.context ? String(options.context) : 'standalone';
10787
+ var valuesArray;
10788
+ if (context === 'formatting' && args.formattingValues) {
10789
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
10790
+ var width = options.width ? String(options.width) : defaultWidth;
10791
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
10792
+ } else {
10793
+ var _defaultWidth = args.defaultWidth;
10794
+ var _width = options.width ? String(options.width) : args.defaultWidth;
10795
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
10796
+ }
10797
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
10798
+ return valuesArray[index];
10799
+ };
10800
+ }
10801
+
10802
+ var eraValues = {
10803
+ narrow: ['B', 'A'],
10804
+ abbreviated: ['BC', 'AD'],
10805
+ wide: ['Before Christ', 'Anno Domini']
10806
+ };
10807
+ var quarterValues = {
10808
+ narrow: ['1', '2', '3', '4'],
10809
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
10810
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter'] // Note: in English, the names of days of the week and months are capitalized.
10811
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
10812
+ // Generally, formatted dates should look like they are in the middle of a sentence,
10813
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
10814
+ };
10815
+
10816
+ var monthValues = {
10817
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
10818
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
10819
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
10820
+ };
10821
+ var dayValues = {
10822
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
10823
+ "short": ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
10824
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
10825
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
10826
+ };
10827
+ var dayPeriodValues = {
10828
+ narrow: {
10829
+ am: 'a',
10830
+ pm: 'p',
10831
+ midnight: 'mi',
10832
+ noon: 'n',
10833
+ morning: 'morning',
10834
+ afternoon: 'afternoon',
10835
+ evening: 'evening',
10836
+ night: 'night'
10837
+ },
10838
+ abbreviated: {
10839
+ am: 'AM',
10840
+ pm: 'PM',
10841
+ midnight: 'midnight',
10842
+ noon: 'noon',
10843
+ morning: 'morning',
10844
+ afternoon: 'afternoon',
10845
+ evening: 'evening',
10846
+ night: 'night'
10847
+ },
10848
+ wide: {
10849
+ am: 'a.m.',
10850
+ pm: 'p.m.',
10851
+ midnight: 'midnight',
10852
+ noon: 'noon',
10853
+ morning: 'morning',
10854
+ afternoon: 'afternoon',
10855
+ evening: 'evening',
10856
+ night: 'night'
10857
+ }
10858
+ };
10859
+ var formattingDayPeriodValues = {
10860
+ narrow: {
10861
+ am: 'a',
10862
+ pm: 'p',
10863
+ midnight: 'mi',
10864
+ noon: 'n',
10865
+ morning: 'in the morning',
10866
+ afternoon: 'in the afternoon',
10867
+ evening: 'in the evening',
10868
+ night: 'at night'
10869
+ },
10870
+ abbreviated: {
10871
+ am: 'AM',
10872
+ pm: 'PM',
10873
+ midnight: 'midnight',
10874
+ noon: 'noon',
10875
+ morning: 'in the morning',
10876
+ afternoon: 'in the afternoon',
10877
+ evening: 'in the evening',
10878
+ night: 'at night'
10879
+ },
10880
+ wide: {
10881
+ am: 'a.m.',
10882
+ pm: 'p.m.',
10883
+ midnight: 'midnight',
10884
+ noon: 'noon',
10885
+ morning: 'in the morning',
10886
+ afternoon: 'in the afternoon',
10887
+ evening: 'in the evening',
10888
+ night: 'at night'
10889
+ }
10890
+ };
10891
+ function ordinalNumber(dirtyNumber, _dirtyOptions) {
10892
+ var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
10893
+ // if they are different for different grammatical genders,
10894
+ // use `options.unit`:
10895
+ //
10896
+ // var options = dirtyOptions || {}
10897
+ // var unit = String(options.unit)
10898
+ //
10899
+ // where `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
10900
+ // 'day', 'hour', 'minute', 'second'
10901
+
10902
+ var rem100 = number % 100;
10903
+ if (rem100 > 20 || rem100 < 10) {
10904
+ switch (rem100 % 10) {
10905
+ case 1:
10906
+ return number + 'st';
10907
+ case 2:
10908
+ return number + 'nd';
10909
+ case 3:
10910
+ return number + 'rd';
10911
+ }
10912
+ }
10913
+ return number + 'th';
10914
+ }
10915
+ var localize = {
10916
+ ordinalNumber: ordinalNumber,
10917
+ era: buildLocalizeFn({
10918
+ values: eraValues,
10919
+ defaultWidth: 'wide'
10920
+ }),
10921
+ quarter: buildLocalizeFn({
10922
+ values: quarterValues,
10923
+ defaultWidth: 'wide',
10924
+ argumentCallback: function argumentCallback(quarter) {
10925
+ return Number(quarter) - 1;
10926
+ }
10927
+ }),
10928
+ month: buildLocalizeFn({
10929
+ values: monthValues,
10930
+ defaultWidth: 'wide'
10931
+ }),
10932
+ day: buildLocalizeFn({
10933
+ values: dayValues,
10934
+ defaultWidth: 'wide'
10935
+ }),
10936
+ dayPeriod: buildLocalizeFn({
10937
+ values: dayPeriodValues,
10938
+ defaultWidth: 'wide',
10939
+ formattingValues: formattingDayPeriodValues,
10940
+ defaultFormattingWidth: 'wide'
10941
+ })
10942
+ };
10943
+
10944
+ function buildMatchPatternFn(args) {
10945
+ return function (dirtyString, dirtyOptions) {
10946
+ var string = String(dirtyString);
10947
+ var options = dirtyOptions || {};
10948
+ var matchResult = string.match(args.matchPattern);
10949
+ if (!matchResult) {
10950
+ return null;
10951
+ }
10952
+ var matchedString = matchResult[0];
10953
+ var parseResult = string.match(args.parsePattern);
10954
+ if (!parseResult) {
10955
+ return null;
10956
+ }
10957
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
10958
+ value = options.valueCallback ? options.valueCallback(value) : value;
10959
+ return {
10960
+ value: value,
10961
+ rest: string.slice(matchedString.length)
10962
+ };
10963
+ };
10964
+ }
10965
+
10966
+ function buildMatchFn(args) {
10967
+ return function (dirtyString, dirtyOptions) {
10968
+ var string = String(dirtyString);
10969
+ var options = dirtyOptions || {};
10970
+ var width = options.width;
10971
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
10972
+ var matchResult = string.match(matchPattern);
10973
+ if (!matchResult) {
10974
+ return null;
10975
+ }
10976
+ var matchedString = matchResult[0];
10977
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
10978
+ var value;
10979
+ if (Object.prototype.toString.call(parsePatterns) === '[object Array]') {
10980
+ value = findIndex(parsePatterns, function (pattern) {
10981
+ return pattern.test(matchedString);
10982
+ });
10983
+ } else {
10984
+ value = findKey(parsePatterns, function (pattern) {
10985
+ return pattern.test(matchedString);
10986
+ });
10987
+ }
10988
+ value = args.valueCallback ? args.valueCallback(value) : value;
10989
+ value = options.valueCallback ? options.valueCallback(value) : value;
10990
+ return {
10991
+ value: value,
10992
+ rest: string.slice(matchedString.length)
10993
+ };
10994
+ };
10995
+ }
10996
+ function findKey(object, predicate) {
10997
+ for (var key in object) {
10998
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
10999
+ return key;
11000
+ }
11001
+ }
11002
+ }
11003
+ function findIndex(array, predicate) {
11004
+ for (var key = 0; key < array.length; key++) {
11005
+ if (predicate(array[key])) {
11006
+ return key;
11007
+ }
11008
+ }
10718
11009
  }
10719
11010
 
11011
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
11012
+ var parseOrdinalNumberPattern = /\d+/i;
11013
+ var matchEraPatterns = {
11014
+ narrow: /^(b|a)/i,
11015
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
11016
+ wide: /^(before christ|before common era|anno domini|common era)/i
11017
+ };
11018
+ var parseEraPatterns = {
11019
+ any: [/^b/i, /^(a|c)/i]
11020
+ };
11021
+ var matchQuarterPatterns = {
11022
+ narrow: /^[1234]/i,
11023
+ abbreviated: /^q[1234]/i,
11024
+ wide: /^[1234](th|st|nd|rd)? quarter/i
11025
+ };
11026
+ var parseQuarterPatterns = {
11027
+ any: [/1/i, /2/i, /3/i, /4/i]
11028
+ };
11029
+ var matchMonthPatterns = {
11030
+ narrow: /^[jfmasond]/i,
11031
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
11032
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
11033
+ };
11034
+ var parseMonthPatterns = {
11035
+ 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],
11036
+ 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]
11037
+ };
11038
+ var matchDayPatterns = {
11039
+ narrow: /^[smtwf]/i,
11040
+ "short": /^(su|mo|tu|we|th|fr|sa)/i,
11041
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
11042
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
11043
+ };
11044
+ var parseDayPatterns = {
11045
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
11046
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
11047
+ };
11048
+ var matchDayPeriodPatterns = {
11049
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
11050
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
11051
+ };
11052
+ var parseDayPeriodPatterns = {
11053
+ any: {
11054
+ am: /^a/i,
11055
+ pm: /^p/i,
11056
+ midnight: /^mi/i,
11057
+ noon: /^no/i,
11058
+ morning: /morning/i,
11059
+ afternoon: /afternoon/i,
11060
+ evening: /evening/i,
11061
+ night: /night/i
11062
+ }
11063
+ };
11064
+ var match = {
11065
+ ordinalNumber: buildMatchPatternFn({
11066
+ matchPattern: matchOrdinalNumberPattern,
11067
+ parsePattern: parseOrdinalNumberPattern,
11068
+ valueCallback: function valueCallback(value) {
11069
+ return parseInt(value, 10);
11070
+ }
11071
+ }),
11072
+ era: buildMatchFn({
11073
+ matchPatterns: matchEraPatterns,
11074
+ defaultMatchWidth: 'wide',
11075
+ parsePatterns: parseEraPatterns,
11076
+ defaultParseWidth: 'any'
11077
+ }),
11078
+ quarter: buildMatchFn({
11079
+ matchPatterns: matchQuarterPatterns,
11080
+ defaultMatchWidth: 'wide',
11081
+ parsePatterns: parseQuarterPatterns,
11082
+ defaultParseWidth: 'any',
11083
+ valueCallback: function valueCallback(index) {
11084
+ return index + 1;
11085
+ }
11086
+ }),
11087
+ month: buildMatchFn({
11088
+ matchPatterns: matchMonthPatterns,
11089
+ defaultMatchWidth: 'wide',
11090
+ parsePatterns: parseMonthPatterns,
11091
+ defaultParseWidth: 'any'
11092
+ }),
11093
+ day: buildMatchFn({
11094
+ matchPatterns: matchDayPatterns,
11095
+ defaultMatchWidth: 'wide',
11096
+ parsePatterns: parseDayPatterns,
11097
+ defaultParseWidth: 'any'
11098
+ }),
11099
+ dayPeriod: buildMatchFn({
11100
+ matchPatterns: matchDayPeriodPatterns,
11101
+ defaultMatchWidth: 'any',
11102
+ parsePatterns: parseDayPeriodPatterns,
11103
+ defaultParseWidth: 'any'
11104
+ })
11105
+ };
11106
+
11107
+ /**
11108
+ * @type {Locale}
11109
+ * @category Locales
11110
+ * @summary English locale (United States).
11111
+ * @language English
11112
+ * @iso-639-2 eng
11113
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
11114
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
11115
+ */
11116
+
11117
+ var locale = {
11118
+ code: 'en-US',
11119
+ formatDistance: formatDistance,
11120
+ formatLong: formatLong,
11121
+ formatRelative: formatRelative,
11122
+ localize: localize,
11123
+ match: match,
11124
+ options: {
11125
+ weekStartsOn: 0
11126
+ /* Sunday */,
11127
+
11128
+ firstWeekContainsDate: 1
11129
+ }
11130
+ };
11131
+
10720
11132
  function toInteger(dirtyNumber) {
10721
11133
  if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
10722
11134
  return NaN;
@@ -10736,6 +11148,10 @@ function toInteger(dirtyNumber) {
10736
11148
  * @description
10737
11149
  * Add the specified number of milliseconds to the given date.
10738
11150
  *
11151
+ * ### v2.0.0 breaking changes:
11152
+ *
11153
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
11154
+ *
10739
11155
  * @param {Date|Number} date - the date to be changed
10740
11156
  * @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`.
10741
11157
  * @returns {Date} the new date with the milliseconds added
@@ -10743,9 +11159,10 @@ function toInteger(dirtyNumber) {
10743
11159
  *
10744
11160
  * @example
10745
11161
  * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
10746
- * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
11162
+ * var result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
10747
11163
  * //=> Thu Jul 10 2014 12:45:30.750
10748
11164
  */
11165
+
10749
11166
  function addMilliseconds(dirtyDate, dirtyAmount) {
10750
11167
  requiredArgs(2, arguments);
10751
11168
  var timestamp = toDate(dirtyDate).getTime();
@@ -10761,6 +11178,10 @@ function addMilliseconds(dirtyDate, dirtyAmount) {
10761
11178
  * @description
10762
11179
  * Subtract the specified number of milliseconds from the given date.
10763
11180
  *
11181
+ * ### v2.0.0 breaking changes:
11182
+ *
11183
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
11184
+ *
10764
11185
  * @param {Date|Number} date - the date to be changed
10765
11186
  * @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`.
10766
11187
  * @returns {Date} the new date with the milliseconds subtracted
@@ -10768,27 +11189,119 @@ function addMilliseconds(dirtyDate, dirtyAmount) {
10768
11189
  *
10769
11190
  * @example
10770
11191
  * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
10771
- * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
11192
+ * var result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
10772
11193
  * //=> Thu Jul 10 2014 12:45:29.250
10773
11194
  */
11195
+
10774
11196
  function subMilliseconds(dirtyDate, dirtyAmount) {
10775
11197
  requiredArgs(2, arguments);
10776
11198
  var amount = toInteger(dirtyAmount);
10777
11199
  return addMilliseconds(dirtyDate, -amount);
10778
11200
  }
10779
11201
 
10780
- var MILLISECONDS_IN_DAY = 86400000;
10781
- function getUTCDayOfYear(dirtyDate) {
10782
- requiredArgs(1, arguments);
10783
- var date = toDate(dirtyDate);
10784
- var timestamp = date.getTime();
10785
- date.setUTCMonth(0, 1);
10786
- date.setUTCHours(0, 0, 0, 0);
10787
- var startOfYearTimestamp = date.getTime();
10788
- var difference = timestamp - startOfYearTimestamp;
10789
- return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
10790
- }
10791
-
11202
+ function addLeadingZeros(number, targetLength) {
11203
+ var sign = number < 0 ? '-' : '';
11204
+ var output = Math.abs(number).toString();
11205
+ while (output.length < targetLength) {
11206
+ output = '0' + output;
11207
+ }
11208
+ return sign + output;
11209
+ }
11210
+
11211
+ /*
11212
+ * | | Unit | | Unit |
11213
+ * |-----|--------------------------------|-----|--------------------------------|
11214
+ * | a | AM, PM | A* | |
11215
+ * | d | Day of month | D | |
11216
+ * | h | Hour [1-12] | H | Hour [0-23] |
11217
+ * | m | Minute | M | Month |
11218
+ * | s | Second | S | Fraction of second |
11219
+ * | y | Year (abs) | Y | |
11220
+ *
11221
+ * Letters marked by * are not implemented but reserved by Unicode standard.
11222
+ */
11223
+
11224
+ var formatters$1 = {
11225
+ // Year
11226
+ y: function y(date, token) {
11227
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
11228
+ // | Year | y | yy | yyy | yyyy | yyyyy |
11229
+ // |----------|-------|----|-------|-------|-------|
11230
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
11231
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
11232
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
11233
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
11234
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
11235
+ var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
11236
+
11237
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
11238
+ return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
11239
+ },
11240
+ // Month
11241
+ M: function M(date, token) {
11242
+ var month = date.getUTCMonth();
11243
+ return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
11244
+ },
11245
+ // Day of the month
11246
+ d: function d(date, token) {
11247
+ return addLeadingZeros(date.getUTCDate(), token.length);
11248
+ },
11249
+ // AM or PM
11250
+ a: function a(date, token) {
11251
+ var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
11252
+ switch (token) {
11253
+ case 'a':
11254
+ case 'aa':
11255
+ case 'aaa':
11256
+ return dayPeriodEnumValue.toUpperCase();
11257
+ case 'aaaaa':
11258
+ return dayPeriodEnumValue[0];
11259
+ case 'aaaa':
11260
+ default:
11261
+ return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
11262
+ }
11263
+ },
11264
+ // Hour [1-12]
11265
+ h: function h(date, token) {
11266
+ return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
11267
+ },
11268
+ // Hour [0-23]
11269
+ H: function H(date, token) {
11270
+ return addLeadingZeros(date.getUTCHours(), token.length);
11271
+ },
11272
+ // Minute
11273
+ m: function m(date, token) {
11274
+ return addLeadingZeros(date.getUTCMinutes(), token.length);
11275
+ },
11276
+ // Second
11277
+ s: function s(date, token) {
11278
+ return addLeadingZeros(date.getUTCSeconds(), token.length);
11279
+ },
11280
+ // Fraction of second
11281
+ S: function S(date, token) {
11282
+ var numberOfDigits = token.length;
11283
+ var milliseconds = date.getUTCMilliseconds();
11284
+ var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
11285
+ return addLeadingZeros(fractionalSeconds, token.length);
11286
+ }
11287
+ };
11288
+
11289
+ var MILLISECONDS_IN_DAY = 86400000; // This function will be a part of public API when UTC function will be implemented.
11290
+ // See issue: https://github.com/date-fns/date-fns/issues/376
11291
+
11292
+ function getUTCDayOfYear(dirtyDate) {
11293
+ requiredArgs(1, arguments);
11294
+ var date = toDate(dirtyDate);
11295
+ var timestamp = date.getTime();
11296
+ date.setUTCMonth(0, 1);
11297
+ date.setUTCHours(0, 0, 0, 0);
11298
+ var startOfYearTimestamp = date.getTime();
11299
+ var difference = timestamp - startOfYearTimestamp;
11300
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
11301
+ }
11302
+
11303
+ // See issue: https://github.com/date-fns/date-fns/issues/376
11304
+
10792
11305
  function startOfUTCISOWeek(dirtyDate) {
10793
11306
  requiredArgs(1, arguments);
10794
11307
  var weekStartsOn = 1;
@@ -10800,6 +11313,8 @@ function startOfUTCISOWeek(dirtyDate) {
10800
11313
  return date;
10801
11314
  }
10802
11315
 
11316
+ // See issue: https://github.com/date-fns/date-fns/issues/376
11317
+
10803
11318
  function getUTCISOWeekYear(dirtyDate) {
10804
11319
  requiredArgs(1, arguments);
10805
11320
  var date = toDate(dirtyDate);
@@ -10821,6 +11336,8 @@ function getUTCISOWeekYear(dirtyDate) {
10821
11336
  }
10822
11337
  }
10823
11338
 
11339
+ // See issue: https://github.com/date-fns/date-fns/issues/376
11340
+
10824
11341
  function startOfUTCISOWeekYear(dirtyDate) {
10825
11342
  requiredArgs(1, arguments);
10826
11343
  var year = getUTCISOWeekYear(dirtyDate);
@@ -10831,30 +11348,29 @@ function startOfUTCISOWeekYear(dirtyDate) {
10831
11348
  return date;
10832
11349
  }
10833
11350
 
10834
- var MILLISECONDS_IN_WEEK$1 = 604800000;
11351
+ var MILLISECONDS_IN_WEEK$1 = 604800000; // This function will be a part of public API when UTC function will be implemented.
11352
+ // See issue: https://github.com/date-fns/date-fns/issues/376
11353
+
10835
11354
  function getUTCISOWeek(dirtyDate) {
10836
11355
  requiredArgs(1, arguments);
10837
11356
  var date = toDate(dirtyDate);
10838
- var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
10839
-
10840
- // Round the number of days to the nearest integer
11357
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer
10841
11358
  // because the number of milliseconds in a week is not constant
10842
11359
  // (e.g. it's different in the week of the daylight saving time clock shift)
11360
+
10843
11361
  return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
10844
11362
  }
10845
11363
 
10846
- var defaultOptions = {};
10847
- function getDefaultOptions() {
10848
- return defaultOptions;
10849
- }
11364
+ // See issue: https://github.com/date-fns/date-fns/issues/376
10850
11365
 
10851
- function startOfUTCWeek(dirtyDate, options) {
10852
- var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
11366
+ function startOfUTCWeek(dirtyDate, dirtyOptions) {
10853
11367
  requiredArgs(1, arguments);
10854
- var defaultOptions = getDefaultOptions();
10855
- 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);
11368
+ var options = dirtyOptions || {};
11369
+ var locale = options.locale;
11370
+ var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;
11371
+ var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
11372
+ var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
10856
11373
 
10857
- // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
10858
11374
  if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
10859
11375
  throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
10860
11376
  }
@@ -10866,26 +11382,29 @@ function startOfUTCWeek(dirtyDate, options) {
10866
11382
  return date;
10867
11383
  }
10868
11384
 
10869
- function getUTCWeekYear(dirtyDate, options) {
10870
- var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
11385
+ // See issue: https://github.com/date-fns/date-fns/issues/376
11386
+
11387
+ function getUTCWeekYear(dirtyDate, dirtyOptions) {
10871
11388
  requiredArgs(1, arguments);
10872
- var date = toDate(dirtyDate);
11389
+ var date = toDate(dirtyDate, dirtyOptions);
10873
11390
  var year = date.getUTCFullYear();
10874
- var defaultOptions = getDefaultOptions();
10875
- 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);
11391
+ var options = dirtyOptions || {};
11392
+ var locale = options.locale;
11393
+ var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
11394
+ var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
11395
+ var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
10876
11396
 
10877
- // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
10878
11397
  if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
10879
11398
  throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
10880
11399
  }
10881
11400
  var firstWeekOfNextYear = new Date(0);
10882
11401
  firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
10883
11402
  firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
10884
- var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
11403
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, dirtyOptions);
10885
11404
  var firstWeekOfThisYear = new Date(0);
10886
11405
  firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
10887
11406
  firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
10888
- var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
11407
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, dirtyOptions);
10889
11408
  if (date.getTime() >= startOfNextYear.getTime()) {
10890
11409
  return year + 1;
10891
11410
  } else if (date.getTime() >= startOfThisYear.getTime()) {
@@ -10895,119 +11414,36 @@ function getUTCWeekYear(dirtyDate, options) {
10895
11414
  }
10896
11415
  }
10897
11416
 
10898
- function startOfUTCWeekYear(dirtyDate, options) {
10899
- var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
11417
+ // See issue: https://github.com/date-fns/date-fns/issues/376
11418
+
11419
+ function startOfUTCWeekYear(dirtyDate, dirtyOptions) {
10900
11420
  requiredArgs(1, arguments);
10901
- var defaultOptions = getDefaultOptions();
10902
- 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);
10903
- var year = getUTCWeekYear(dirtyDate, options);
11421
+ var options = dirtyOptions || {};
11422
+ var locale = options.locale;
11423
+ var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
11424
+ var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
11425
+ var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
11426
+ var year = getUTCWeekYear(dirtyDate, dirtyOptions);
10904
11427
  var firstWeek = new Date(0);
10905
11428
  firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
10906
11429
  firstWeek.setUTCHours(0, 0, 0, 0);
10907
- var date = startOfUTCWeek(firstWeek, options);
11430
+ var date = startOfUTCWeek(firstWeek, dirtyOptions);
10908
11431
  return date;
10909
11432
  }
10910
11433
 
10911
- var MILLISECONDS_IN_WEEK = 604800000;
11434
+ var MILLISECONDS_IN_WEEK = 604800000; // This function will be a part of public API when UTC function will be implemented.
11435
+ // See issue: https://github.com/date-fns/date-fns/issues/376
11436
+
10912
11437
  function getUTCWeek(dirtyDate, options) {
10913
11438
  requiredArgs(1, arguments);
10914
11439
  var date = toDate(dirtyDate);
10915
- var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
10916
-
10917
- // Round the number of days to the nearest integer
11440
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer
10918
11441
  // because the number of milliseconds in a week is not constant
10919
11442
  // (e.g. it's different in the week of the daylight saving time clock shift)
10920
- return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
10921
- }
10922
11443
 
10923
- function addLeadingZeros(number, targetLength) {
10924
- var sign = number < 0 ? '-' : '';
10925
- var output = Math.abs(number).toString();
10926
- while (output.length < targetLength) {
10927
- output = '0' + output;
10928
- }
10929
- return sign + output;
11444
+ return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
10930
11445
  }
10931
11446
 
10932
- /*
10933
- * | | Unit | | Unit |
10934
- * |-----|--------------------------------|-----|--------------------------------|
10935
- * | a | AM, PM | A* | |
10936
- * | d | Day of month | D | |
10937
- * | h | Hour [1-12] | H | Hour [0-23] |
10938
- * | m | Minute | M | Month |
10939
- * | s | Second | S | Fraction of second |
10940
- * | y | Year (abs) | Y | |
10941
- *
10942
- * Letters marked by * are not implemented but reserved by Unicode standard.
10943
- */
10944
- var formatters$1 = {
10945
- // Year
10946
- y: function y(date, token) {
10947
- // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
10948
- // | Year | y | yy | yyy | yyyy | yyyyy |
10949
- // |----------|-------|----|-------|-------|-------|
10950
- // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
10951
- // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
10952
- // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
10953
- // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
10954
- // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
10955
-
10956
- var signedYear = date.getUTCFullYear();
10957
- // Returns 1 for 1 BC (which is year 0 in JavaScript)
10958
- var year = signedYear > 0 ? signedYear : 1 - signedYear;
10959
- return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
10960
- },
10961
- // Month
10962
- M: function M(date, token) {
10963
- var month = date.getUTCMonth();
10964
- return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
10965
- },
10966
- // Day of the month
10967
- d: function d(date, token) {
10968
- return addLeadingZeros(date.getUTCDate(), token.length);
10969
- },
10970
- // AM or PM
10971
- a: function a(date, token) {
10972
- var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
10973
- switch (token) {
10974
- case 'a':
10975
- case 'aa':
10976
- return dayPeriodEnumValue.toUpperCase();
10977
- case 'aaa':
10978
- return dayPeriodEnumValue;
10979
- case 'aaaaa':
10980
- return dayPeriodEnumValue[0];
10981
- case 'aaaa':
10982
- default:
10983
- return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
10984
- }
10985
- },
10986
- // Hour [1-12]
10987
- h: function h(date, token) {
10988
- return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
10989
- },
10990
- // Hour [0-23]
10991
- H: function H(date, token) {
10992
- return addLeadingZeros(date.getUTCHours(), token.length);
10993
- },
10994
- // Minute
10995
- m: function m(date, token) {
10996
- return addLeadingZeros(date.getUTCMinutes(), token.length);
10997
- },
10998
- // Second
10999
- s: function s(date, token) {
11000
- return addLeadingZeros(date.getUTCSeconds(), token.length);
11001
- },
11002
- // Fraction of second
11003
- S: function S(date, token) {
11004
- var numberOfDigits = token.length;
11005
- var milliseconds = date.getUTCMilliseconds();
11006
- var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
11007
- return addLeadingZeros(fractionalSeconds, token.length);
11008
- }
11009
- };
11010
-
11011
11447
  var dayPeriodEnum = {
11012
11448
  am: 'am',
11013
11449
  pm: 'pm',
@@ -11017,52 +11453,52 @@ var dayPeriodEnum = {
11017
11453
  afternoon: 'afternoon',
11018
11454
  evening: 'evening',
11019
11455
  night: 'night'
11456
+ /*
11457
+ * | | Unit | | Unit |
11458
+ * |-----|--------------------------------|-----|--------------------------------|
11459
+ * | a | AM, PM | A* | Milliseconds in day |
11460
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
11461
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
11462
+ * | d | Day of month | D | Day of year |
11463
+ * | e | Local day of week | E | Day of week |
11464
+ * | f | | F* | Day of week in month |
11465
+ * | g* | Modified Julian day | G | Era |
11466
+ * | h | Hour [1-12] | H | Hour [0-23] |
11467
+ * | i! | ISO day of week | I! | ISO week of year |
11468
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
11469
+ * | k | Hour [1-24] | K | Hour [0-11] |
11470
+ * | l* | (deprecated) | L | Stand-alone month |
11471
+ * | m | Minute | M | Month |
11472
+ * | n | | N | |
11473
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
11474
+ * | p! | Long localized time | P! | Long localized date |
11475
+ * | q | Stand-alone quarter | Q | Quarter |
11476
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
11477
+ * | s | Second | S | Fraction of second |
11478
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
11479
+ * | u | Extended year | U* | Cyclic year |
11480
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
11481
+ * | w | Local week of year | W* | Week of month |
11482
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
11483
+ * | y | Year (abs) | Y | Local week-numbering year |
11484
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
11485
+ *
11486
+ * Letters marked by * are not implemented but reserved by Unicode standard.
11487
+ *
11488
+ * Letters marked by ! are non-standard, but implemented by date-fns:
11489
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
11490
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
11491
+ * i.e. 7 for Sunday, 1 for Monday, etc.
11492
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
11493
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
11494
+ * `R` is supposed to be used in conjunction with `I` and `i`
11495
+ * for universal ISO week-numbering date, whereas
11496
+ * `Y` is supposed to be used in conjunction with `w` and `e`
11497
+ * for week-numbering date specific to the locale.
11498
+ * - `P` is long localized date format
11499
+ * - `p` is long localized time format
11500
+ */
11020
11501
  };
11021
- /*
11022
- * | | Unit | | Unit |
11023
- * |-----|--------------------------------|-----|--------------------------------|
11024
- * | a | AM, PM | A* | Milliseconds in day |
11025
- * | b | AM, PM, noon, midnight | B | Flexible day period |
11026
- * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
11027
- * | d | Day of month | D | Day of year |
11028
- * | e | Local day of week | E | Day of week |
11029
- * | f | | F* | Day of week in month |
11030
- * | g* | Modified Julian day | G | Era |
11031
- * | h | Hour [1-12] | H | Hour [0-23] |
11032
- * | i! | ISO day of week | I! | ISO week of year |
11033
- * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
11034
- * | k | Hour [1-24] | K | Hour [0-11] |
11035
- * | l* | (deprecated) | L | Stand-alone month |
11036
- * | m | Minute | M | Month |
11037
- * | n | | N | |
11038
- * | o! | Ordinal number modifier | O | Timezone (GMT) |
11039
- * | p! | Long localized time | P! | Long localized date |
11040
- * | q | Stand-alone quarter | Q | Quarter |
11041
- * | r* | Related Gregorian year | R! | ISO week-numbering year |
11042
- * | s | Second | S | Fraction of second |
11043
- * | t! | Seconds timestamp | T! | Milliseconds timestamp |
11044
- * | u | Extended year | U* | Cyclic year |
11045
- * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
11046
- * | w | Local week of year | W* | Week of month |
11047
- * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
11048
- * | y | Year (abs) | Y | Local week-numbering year |
11049
- * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
11050
- *
11051
- * Letters marked by * are not implemented but reserved by Unicode standard.
11052
- *
11053
- * Letters marked by ! are non-standard, but implemented by date-fns:
11054
- * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
11055
- * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
11056
- * i.e. 7 for Sunday, 1 for Monday, etc.
11057
- * - `I` is ISO week of year, as opposed to `w` which is local week of year.
11058
- * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
11059
- * `R` is supposed to be used in conjunction with `I` and `i`
11060
- * for universal ISO week-numbering date, whereas
11061
- * `Y` is supposed to be used in conjunction with `w` and `e`
11062
- * for week-numbering date specific to the locale.
11063
- * - `P` is long localized date format
11064
- * - `p` is long localized time format
11065
- */
11066
11502
 
11067
11503
  var formatters = {
11068
11504
  // Era
@@ -11077,11 +11513,13 @@ var formatters = {
11077
11513
  width: 'abbreviated'
11078
11514
  });
11079
11515
  // A, B
11516
+
11080
11517
  case 'GGGGG':
11081
11518
  return localize.era(era, {
11082
11519
  width: 'narrow'
11083
11520
  });
11084
11521
  // Anno Domini, Before Christ
11522
+
11085
11523
  case 'GGGG':
11086
11524
  default:
11087
11525
  return localize.era(era, {
@@ -11093,8 +11531,8 @@ var formatters = {
11093
11531
  y: function y(date, token, localize) {
11094
11532
  // Ordinal number
11095
11533
  if (token === 'yo') {
11096
- var signedYear = date.getUTCFullYear();
11097
- // Returns 1 for 1 BC (which is year 0 in JavaScript)
11534
+ var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
11535
+
11098
11536
  var year = signedYear > 0 ? signedYear : 1 - signedYear;
11099
11537
  return localize.ordinalNumber(year, {
11100
11538
  unit: 'year'
@@ -11104,31 +11542,27 @@ var formatters = {
11104
11542
  },
11105
11543
  // Local week-numbering year
11106
11544
  Y: function Y(date, token, localize, options) {
11107
- var signedWeekYear = getUTCWeekYear(date, options);
11108
- // Returns 1 for 1 BC (which is year 0 in JavaScript)
11109
- var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
11545
+ var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)
11546
+
11547
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year
11110
11548
 
11111
- // Two digit year
11112
11549
  if (token === 'YY') {
11113
11550
  var twoDigitYear = weekYear % 100;
11114
11551
  return addLeadingZeros(twoDigitYear, 2);
11115
- }
11552
+ } // Ordinal number
11116
11553
 
11117
- // Ordinal number
11118
11554
  if (token === 'Yo') {
11119
11555
  return localize.ordinalNumber(weekYear, {
11120
11556
  unit: 'year'
11121
11557
  });
11122
- }
11558
+ } // Padding
11123
11559
 
11124
- // Padding
11125
11560
  return addLeadingZeros(weekYear, token.length);
11126
11561
  },
11127
11562
  // ISO week-numbering year
11128
11563
  R: function R(date, token) {
11129
- var isoWeekYear = getUTCISOWeekYear(date);
11564
+ var isoWeekYear = getUTCISOWeekYear(date); // Padding
11130
11565
 
11131
- // Padding
11132
11566
  return addLeadingZeros(isoWeekYear, token.length);
11133
11567
  },
11134
11568
  // Extended year. This is a single number designating the year of this calendar system.
@@ -11152,26 +11586,31 @@ var formatters = {
11152
11586
  case 'Q':
11153
11587
  return String(quarter);
11154
11588
  // 01, 02, 03, 04
11589
+
11155
11590
  case 'QQ':
11156
11591
  return addLeadingZeros(quarter, 2);
11157
11592
  // 1st, 2nd, 3rd, 4th
11593
+
11158
11594
  case 'Qo':
11159
11595
  return localize.ordinalNumber(quarter, {
11160
11596
  unit: 'quarter'
11161
11597
  });
11162
11598
  // Q1, Q2, Q3, Q4
11599
+
11163
11600
  case 'QQQ':
11164
11601
  return localize.quarter(quarter, {
11165
11602
  width: 'abbreviated',
11166
11603
  context: 'formatting'
11167
11604
  });
11168
11605
  // 1, 2, 3, 4 (narrow quarter; could be not numerical)
11606
+
11169
11607
  case 'QQQQQ':
11170
11608
  return localize.quarter(quarter, {
11171
11609
  width: 'narrow',
11172
11610
  context: 'formatting'
11173
11611
  });
11174
11612
  // 1st quarter, 2nd quarter, ...
11613
+
11175
11614
  case 'QQQQ':
11176
11615
  default:
11177
11616
  return localize.quarter(quarter, {
@@ -11188,26 +11627,31 @@ var formatters = {
11188
11627
  case 'q':
11189
11628
  return String(quarter);
11190
11629
  // 01, 02, 03, 04
11630
+
11191
11631
  case 'qq':
11192
11632
  return addLeadingZeros(quarter, 2);
11193
11633
  // 1st, 2nd, 3rd, 4th
11634
+
11194
11635
  case 'qo':
11195
11636
  return localize.ordinalNumber(quarter, {
11196
11637
  unit: 'quarter'
11197
11638
  });
11198
11639
  // Q1, Q2, Q3, Q4
11640
+
11199
11641
  case 'qqq':
11200
11642
  return localize.quarter(quarter, {
11201
11643
  width: 'abbreviated',
11202
11644
  context: 'standalone'
11203
11645
  });
11204
11646
  // 1, 2, 3, 4 (narrow quarter; could be not numerical)
11647
+
11205
11648
  case 'qqqqq':
11206
11649
  return localize.quarter(quarter, {
11207
11650
  width: 'narrow',
11208
11651
  context: 'standalone'
11209
11652
  });
11210
11653
  // 1st quarter, 2nd quarter, ...
11654
+
11211
11655
  case 'qqqq':
11212
11656
  default:
11213
11657
  return localize.quarter(quarter, {
@@ -11224,23 +11668,27 @@ var formatters = {
11224
11668
  case 'MM':
11225
11669
  return formatters$1.M(date, token);
11226
11670
  // 1st, 2nd, ..., 12th
11671
+
11227
11672
  case 'Mo':
11228
11673
  return localize.ordinalNumber(month + 1, {
11229
11674
  unit: 'month'
11230
11675
  });
11231
11676
  // Jan, Feb, ..., Dec
11677
+
11232
11678
  case 'MMM':
11233
11679
  return localize.month(month, {
11234
11680
  width: 'abbreviated',
11235
11681
  context: 'formatting'
11236
11682
  });
11237
11683
  // J, F, ..., D
11684
+
11238
11685
  case 'MMMMM':
11239
11686
  return localize.month(month, {
11240
11687
  width: 'narrow',
11241
11688
  context: 'formatting'
11242
11689
  });
11243
11690
  // January, February, ..., December
11691
+
11244
11692
  case 'MMMM':
11245
11693
  default:
11246
11694
  return localize.month(month, {
@@ -11257,26 +11705,31 @@ var formatters = {
11257
11705
  case 'L':
11258
11706
  return String(month + 1);
11259
11707
  // 01, 02, ..., 12
11708
+
11260
11709
  case 'LL':
11261
11710
  return addLeadingZeros(month + 1, 2);
11262
11711
  // 1st, 2nd, ..., 12th
11712
+
11263
11713
  case 'Lo':
11264
11714
  return localize.ordinalNumber(month + 1, {
11265
11715
  unit: 'month'
11266
11716
  });
11267
11717
  // Jan, Feb, ..., Dec
11718
+
11268
11719
  case 'LLL':
11269
11720
  return localize.month(month, {
11270
11721
  width: 'abbreviated',
11271
11722
  context: 'standalone'
11272
11723
  });
11273
11724
  // J, F, ..., D
11725
+
11274
11726
  case 'LLLLL':
11275
11727
  return localize.month(month, {
11276
11728
  width: 'narrow',
11277
11729
  context: 'standalone'
11278
11730
  });
11279
11731
  // January, February, ..., December
11732
+
11280
11733
  case 'LLLL':
11281
11734
  default:
11282
11735
  return localize.month(month, {
@@ -11337,18 +11790,21 @@ var formatters = {
11337
11790
  context: 'formatting'
11338
11791
  });
11339
11792
  // T
11793
+
11340
11794
  case 'EEEEE':
11341
11795
  return localize.day(dayOfWeek, {
11342
11796
  width: 'narrow',
11343
11797
  context: 'formatting'
11344
11798
  });
11345
11799
  // Tu
11800
+
11346
11801
  case 'EEEEEE':
11347
11802
  return localize.day(dayOfWeek, {
11348
11803
  width: 'short',
11349
11804
  context: 'formatting'
11350
11805
  });
11351
11806
  // Tuesday
11807
+
11352
11808
  case 'EEEE':
11353
11809
  default:
11354
11810
  return localize.day(dayOfWeek, {
@@ -11366,9 +11822,11 @@ var formatters = {
11366
11822
  case 'e':
11367
11823
  return String(localDayOfWeek);
11368
11824
  // Padded numerical value
11825
+
11369
11826
  case 'ee':
11370
11827
  return addLeadingZeros(localDayOfWeek, 2);
11371
11828
  // 1st, 2nd, ..., 7th
11829
+
11372
11830
  case 'eo':
11373
11831
  return localize.ordinalNumber(localDayOfWeek, {
11374
11832
  unit: 'day'
@@ -11379,18 +11837,21 @@ var formatters = {
11379
11837
  context: 'formatting'
11380
11838
  });
11381
11839
  // T
11840
+
11382
11841
  case 'eeeee':
11383
11842
  return localize.day(dayOfWeek, {
11384
11843
  width: 'narrow',
11385
11844
  context: 'formatting'
11386
11845
  });
11387
11846
  // Tu
11847
+
11388
11848
  case 'eeeeee':
11389
11849
  return localize.day(dayOfWeek, {
11390
11850
  width: 'short',
11391
11851
  context: 'formatting'
11392
11852
  });
11393
11853
  // Tuesday
11854
+
11394
11855
  case 'eeee':
11395
11856
  default:
11396
11857
  return localize.day(dayOfWeek, {
@@ -11408,9 +11869,11 @@ var formatters = {
11408
11869
  case 'c':
11409
11870
  return String(localDayOfWeek);
11410
11871
  // Padded numerical value
11872
+
11411
11873
  case 'cc':
11412
11874
  return addLeadingZeros(localDayOfWeek, token.length);
11413
11875
  // 1st, 2nd, ..., 7th
11876
+
11414
11877
  case 'co':
11415
11878
  return localize.ordinalNumber(localDayOfWeek, {
11416
11879
  unit: 'day'
@@ -11421,18 +11884,21 @@ var formatters = {
11421
11884
  context: 'standalone'
11422
11885
  });
11423
11886
  // T
11887
+
11424
11888
  case 'ccccc':
11425
11889
  return localize.day(dayOfWeek, {
11426
11890
  width: 'narrow',
11427
11891
  context: 'standalone'
11428
11892
  });
11429
11893
  // Tu
11894
+
11430
11895
  case 'cccccc':
11431
11896
  return localize.day(dayOfWeek, {
11432
11897
  width: 'short',
11433
11898
  context: 'standalone'
11434
11899
  });
11435
11900
  // Tuesday
11901
+
11436
11902
  case 'cccc':
11437
11903
  default:
11438
11904
  return localize.day(dayOfWeek, {
@@ -11450,32 +11916,38 @@ var formatters = {
11450
11916
  case 'i':
11451
11917
  return String(isoDayOfWeek);
11452
11918
  // 02
11919
+
11453
11920
  case 'ii':
11454
11921
  return addLeadingZeros(isoDayOfWeek, token.length);
11455
11922
  // 2nd
11923
+
11456
11924
  case 'io':
11457
11925
  return localize.ordinalNumber(isoDayOfWeek, {
11458
11926
  unit: 'day'
11459
11927
  });
11460
11928
  // Tue
11929
+
11461
11930
  case 'iii':
11462
11931
  return localize.day(dayOfWeek, {
11463
11932
  width: 'abbreviated',
11464
11933
  context: 'formatting'
11465
11934
  });
11466
11935
  // T
11936
+
11467
11937
  case 'iiiii':
11468
11938
  return localize.day(dayOfWeek, {
11469
11939
  width: 'narrow',
11470
11940
  context: 'formatting'
11471
11941
  });
11472
11942
  // Tu
11943
+
11473
11944
  case 'iiiiii':
11474
11945
  return localize.day(dayOfWeek, {
11475
11946
  width: 'short',
11476
11947
  context: 'formatting'
11477
11948
  });
11478
11949
  // Tuesday
11950
+
11479
11951
  case 'iiii':
11480
11952
  default:
11481
11953
  return localize.day(dayOfWeek, {
@@ -11491,15 +11963,11 @@ var formatters = {
11491
11963
  switch (token) {
11492
11964
  case 'a':
11493
11965
  case 'aa':
11494
- return localize.dayPeriod(dayPeriodEnumValue, {
11495
- width: 'abbreviated',
11496
- context: 'formatting'
11497
- });
11498
11966
  case 'aaa':
11499
11967
  return localize.dayPeriod(dayPeriodEnumValue, {
11500
11968
  width: 'abbreviated',
11501
11969
  context: 'formatting'
11502
- }).toLowerCase();
11970
+ });
11503
11971
  case 'aaaaa':
11504
11972
  return localize.dayPeriod(dayPeriodEnumValue, {
11505
11973
  width: 'narrow',
@@ -11527,15 +11995,11 @@ var formatters = {
11527
11995
  switch (token) {
11528
11996
  case 'b':
11529
11997
  case 'bb':
11530
- return localize.dayPeriod(dayPeriodEnumValue, {
11531
- width: 'abbreviated',
11532
- context: 'formatting'
11533
- });
11534
11998
  case 'bbb':
11535
11999
  return localize.dayPeriod(dayPeriodEnumValue, {
11536
12000
  width: 'abbreviated',
11537
12001
  context: 'formatting'
11538
- }).toLowerCase();
12002
+ });
11539
12003
  case 'bbbbb':
11540
12004
  return localize.dayPeriod(dayPeriodEnumValue, {
11541
12005
  width: 'narrow',
@@ -11657,20 +12121,21 @@ var formatters = {
11657
12121
  // Hours and optional minutes
11658
12122
  case 'X':
11659
12123
  return formatTimezoneWithOptionalMinutes(timezoneOffset);
11660
-
11661
12124
  // Hours, minutes and optional seconds without `:` delimiter
11662
12125
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
11663
12126
  // so this token always has the same output as `XX`
12127
+
11664
12128
  case 'XXXX':
11665
12129
  case 'XX':
11666
12130
  // Hours and minutes without `:` delimiter
11667
12131
  return formatTimezone(timezoneOffset);
11668
-
11669
12132
  // Hours, minutes and optional seconds with `:` delimiter
11670
12133
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
11671
12134
  // so this token always has the same output as `XXX`
12135
+
11672
12136
  case 'XXXXX':
11673
12137
  case 'XXX': // Hours and minutes with `:` delimiter
12138
+
11674
12139
  default:
11675
12140
  return formatTimezone(timezoneOffset, ':');
11676
12141
  }
@@ -11683,20 +12148,21 @@ var formatters = {
11683
12148
  // Hours and optional minutes
11684
12149
  case 'x':
11685
12150
  return formatTimezoneWithOptionalMinutes(timezoneOffset);
11686
-
11687
12151
  // Hours, minutes and optional seconds without `:` delimiter
11688
12152
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
11689
12153
  // so this token always has the same output as `xx`
12154
+
11690
12155
  case 'xxxx':
11691
12156
  case 'xx':
11692
12157
  // Hours and minutes without `:` delimiter
11693
12158
  return formatTimezone(timezoneOffset);
11694
-
11695
12159
  // Hours, minutes and optional seconds with `:` delimiter
11696
12160
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
11697
12161
  // so this token always has the same output as `xxx`
12162
+
11698
12163
  case 'xxxxx':
11699
12164
  case 'xxx': // Hours and minutes with `:` delimiter
12165
+
11700
12166
  default:
11701
12167
  return formatTimezone(timezoneOffset, ':');
11702
12168
  }
@@ -11712,661 +12178,193 @@ var formatters = {
11712
12178
  case 'OOO':
11713
12179
  return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
11714
12180
  // Long
12181
+
11715
12182
  case 'OOOO':
11716
12183
  default:
11717
- return 'GMT' + formatTimezone(timezoneOffset, ':');
11718
- }
11719
- },
11720
- // Timezone (specific non-location)
11721
- z: function z(date, token, _localize, options) {
11722
- var originalDate = options._originalDate || date;
11723
- var timezoneOffset = originalDate.getTimezoneOffset();
11724
- switch (token) {
11725
- // Short
11726
- case 'z':
11727
- case 'zz':
11728
- case 'zzz':
11729
- return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
11730
- // Long
11731
- case 'zzzz':
11732
- default:
11733
- return 'GMT' + formatTimezone(timezoneOffset, ':');
11734
- }
11735
- },
11736
- // Seconds timestamp
11737
- t: function t(date, token, _localize, options) {
11738
- var originalDate = options._originalDate || date;
11739
- var timestamp = Math.floor(originalDate.getTime() / 1000);
11740
- return addLeadingZeros(timestamp, token.length);
11741
- },
11742
- // Milliseconds timestamp
11743
- T: function T(date, token, _localize, options) {
11744
- var originalDate = options._originalDate || date;
11745
- var timestamp = originalDate.getTime();
11746
- return addLeadingZeros(timestamp, token.length);
11747
- }
11748
- };
11749
- function formatTimezoneShort(offset, dirtyDelimiter) {
11750
- var sign = offset > 0 ? '-' : '+';
11751
- var absOffset = Math.abs(offset);
11752
- var hours = Math.floor(absOffset / 60);
11753
- var minutes = absOffset % 60;
11754
- if (minutes === 0) {
11755
- return sign + String(hours);
11756
- }
11757
- var delimiter = dirtyDelimiter;
11758
- return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
11759
- }
11760
- function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
11761
- if (offset % 60 === 0) {
11762
- var sign = offset > 0 ? '-' : '+';
11763
- return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
11764
- }
11765
- return formatTimezone(offset, dirtyDelimiter);
11766
- }
11767
- function formatTimezone(offset, dirtyDelimiter) {
11768
- var delimiter = dirtyDelimiter || '';
11769
- var sign = offset > 0 ? '-' : '+';
11770
- var absOffset = Math.abs(offset);
11771
- var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
11772
- var minutes = addLeadingZeros(absOffset % 60, 2);
11773
- return sign + hours + delimiter + minutes;
11774
- }
11775
-
11776
- var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
11777
- switch (pattern) {
11778
- case 'P':
11779
- return formatLong.date({
11780
- width: 'short'
11781
- });
11782
- case 'PP':
11783
- return formatLong.date({
11784
- width: 'medium'
11785
- });
11786
- case 'PPP':
11787
- return formatLong.date({
11788
- width: 'long'
11789
- });
11790
- case 'PPPP':
11791
- default:
11792
- return formatLong.date({
11793
- width: 'full'
11794
- });
11795
- }
11796
- };
11797
- var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
11798
- switch (pattern) {
11799
- case 'p':
11800
- return formatLong.time({
11801
- width: 'short'
11802
- });
11803
- case 'pp':
11804
- return formatLong.time({
11805
- width: 'medium'
11806
- });
11807
- case 'ppp':
11808
- return formatLong.time({
11809
- width: 'long'
11810
- });
11811
- case 'pppp':
11812
- default:
11813
- return formatLong.time({
11814
- width: 'full'
11815
- });
11816
- }
11817
- };
11818
- var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
11819
- var matchResult = pattern.match(/(P+)(p+)?/) || [];
11820
- var datePattern = matchResult[1];
11821
- var timePattern = matchResult[2];
11822
- if (!timePattern) {
11823
- return dateLongFormatter(pattern, formatLong);
11824
- }
11825
- var dateTimeFormat;
11826
- switch (datePattern) {
11827
- case 'P':
11828
- dateTimeFormat = formatLong.dateTime({
11829
- width: 'short'
11830
- });
11831
- break;
11832
- case 'PP':
11833
- dateTimeFormat = formatLong.dateTime({
11834
- width: 'medium'
11835
- });
11836
- break;
11837
- case 'PPP':
11838
- dateTimeFormat = formatLong.dateTime({
11839
- width: 'long'
11840
- });
11841
- break;
11842
- case 'PPPP':
11843
- default:
11844
- dateTimeFormat = formatLong.dateTime({
11845
- width: 'full'
11846
- });
11847
- break;
11848
- }
11849
- return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
11850
- };
11851
- var longFormatters = {
11852
- p: timeLongFormatter,
11853
- P: dateTimeLongFormatter
11854
- };
11855
-
11856
- /**
11857
- * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
11858
- * They usually appear for dates that denote time before the timezones were introduced
11859
- * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
11860
- * and GMT+01:00:00 after that date)
11861
- *
11862
- * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
11863
- * which would lead to incorrect calculations.
11864
- *
11865
- * This function returns the timezone offset in milliseconds that takes seconds in account.
11866
- */
11867
- function getTimezoneOffsetInMilliseconds(date) {
11868
- var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
11869
- utcDate.setUTCFullYear(date.getFullYear());
11870
- return date.getTime() - utcDate.getTime();
11871
- }
11872
-
11873
- var protectedDayOfYearTokens = ['D', 'DD'];
11874
- var protectedWeekYearTokens = ['YY', 'YYYY'];
11875
- function isProtectedDayOfYearToken(token) {
11876
- return protectedDayOfYearTokens.indexOf(token) !== -1;
11877
- }
11878
- function isProtectedWeekYearToken(token) {
11879
- return protectedWeekYearTokens.indexOf(token) !== -1;
11880
- }
11881
- function throwProtectedError(token, format, input) {
11882
- if (token === 'YYYY') {
11883
- 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"));
11884
- } else if (token === 'YY') {
11885
- 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"));
11886
- } else if (token === 'D') {
11887
- 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"));
11888
- } else if (token === 'DD') {
11889
- 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"));
11890
- }
11891
- }
11892
-
11893
- var formatDistanceLocale = {
11894
- lessThanXSeconds: {
11895
- one: 'less than a second',
11896
- other: 'less than {{count}} seconds'
11897
- },
11898
- xSeconds: {
11899
- one: '1 second',
11900
- other: '{{count}} seconds'
11901
- },
11902
- halfAMinute: 'half a minute',
11903
- lessThanXMinutes: {
11904
- one: 'less than a minute',
11905
- other: 'less than {{count}} minutes'
11906
- },
11907
- xMinutes: {
11908
- one: '1 minute',
11909
- other: '{{count}} minutes'
11910
- },
11911
- aboutXHours: {
11912
- one: 'about 1 hour',
11913
- other: 'about {{count}} hours'
11914
- },
11915
- xHours: {
11916
- one: '1 hour',
11917
- other: '{{count}} hours'
11918
- },
11919
- xDays: {
11920
- one: '1 day',
11921
- other: '{{count}} days'
11922
- },
11923
- aboutXWeeks: {
11924
- one: 'about 1 week',
11925
- other: 'about {{count}} weeks'
11926
- },
11927
- xWeeks: {
11928
- one: '1 week',
11929
- other: '{{count}} weeks'
11930
- },
11931
- aboutXMonths: {
11932
- one: 'about 1 month',
11933
- other: 'about {{count}} months'
11934
- },
11935
- xMonths: {
11936
- one: '1 month',
11937
- other: '{{count}} months'
11938
- },
11939
- aboutXYears: {
11940
- one: 'about 1 year',
11941
- other: 'about {{count}} years'
11942
- },
11943
- xYears: {
11944
- one: '1 year',
11945
- other: '{{count}} years'
11946
- },
11947
- overXYears: {
11948
- one: 'over 1 year',
11949
- other: 'over {{count}} years'
11950
- },
11951
- almostXYears: {
11952
- one: 'almost 1 year',
11953
- other: 'almost {{count}} years'
11954
- }
11955
- };
11956
- var formatDistance = function formatDistance(token, count, options) {
11957
- var result;
11958
- var tokenValue = formatDistanceLocale[token];
11959
- if (typeof tokenValue === 'string') {
11960
- result = tokenValue;
11961
- } else if (count === 1) {
11962
- result = tokenValue.one;
11963
- } else {
11964
- result = tokenValue.other.replace('{{count}}', count.toString());
11965
- }
11966
- if (options !== null && options !== void 0 && options.addSuffix) {
11967
- if (options.comparison && options.comparison > 0) {
11968
- return 'in ' + result;
11969
- } else {
11970
- return result + ' ago';
11971
- }
11972
- }
11973
- return result;
11974
- };
11975
-
11976
- function buildFormatLongFn(args) {
11977
- return function () {
11978
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
11979
- // TODO: Remove String()
11980
- var width = options.width ? String(options.width) : args.defaultWidth;
11981
- var format = args.formats[width] || args.formats[args.defaultWidth];
11982
- return format;
11983
- };
11984
- }
11985
-
11986
- var dateFormats = {
11987
- full: 'EEEE, MMMM do, y',
11988
- "long": 'MMMM do, y',
11989
- medium: 'MMM d, y',
11990
- "short": 'MM/dd/yyyy'
11991
- };
11992
- var timeFormats = {
11993
- full: 'h:mm:ss a zzzz',
11994
- "long": 'h:mm:ss a z',
11995
- medium: 'h:mm:ss a',
11996
- "short": 'h:mm a'
11997
- };
11998
- var dateTimeFormats = {
11999
- full: "{{date}} 'at' {{time}}",
12000
- "long": "{{date}} 'at' {{time}}",
12001
- medium: '{{date}}, {{time}}',
12002
- "short": '{{date}}, {{time}}'
12003
- };
12004
- var formatLong = {
12005
- date: buildFormatLongFn({
12006
- formats: dateFormats,
12007
- defaultWidth: 'full'
12008
- }),
12009
- time: buildFormatLongFn({
12010
- formats: timeFormats,
12011
- defaultWidth: 'full'
12012
- }),
12013
- dateTime: buildFormatLongFn({
12014
- formats: dateTimeFormats,
12015
- defaultWidth: 'full'
12016
- })
12017
- };
12018
-
12019
- var formatRelativeLocale = {
12020
- lastWeek: "'last' eeee 'at' p",
12021
- yesterday: "'yesterday at' p",
12022
- today: "'today at' p",
12023
- tomorrow: "'tomorrow at' p",
12024
- nextWeek: "eeee 'at' p",
12025
- other: 'P'
12026
- };
12027
- var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
12028
- return formatRelativeLocale[token];
12029
- };
12030
-
12031
- function buildLocalizeFn(args) {
12032
- return function (dirtyIndex, options) {
12033
- var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
12034
- var valuesArray;
12035
- if (context === 'formatting' && args.formattingValues) {
12036
- var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
12037
- var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
12038
- valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
12039
- } else {
12040
- var _defaultWidth = args.defaultWidth;
12041
- var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
12042
- valuesArray = args.values[_width] || args.values[_defaultWidth];
12043
- }
12044
- var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
12045
- // @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!
12046
- return valuesArray[index];
12047
- };
12048
- }
12049
-
12050
- var eraValues = {
12051
- narrow: ['B', 'A'],
12052
- abbreviated: ['BC', 'AD'],
12053
- wide: ['Before Christ', 'Anno Domini']
12054
- };
12055
- var quarterValues = {
12056
- narrow: ['1', '2', '3', '4'],
12057
- abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
12058
- wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
12059
- };
12060
-
12061
- // Note: in English, the names of days of the week and months are capitalized.
12062
- // If you are making a new locale based on this one, check if the same is true for the language you're working on.
12063
- // Generally, formatted dates should look like they are in the middle of a sentence,
12064
- // e.g. in Spanish language the weekdays and months should be in the lowercase.
12065
- var monthValues = {
12066
- narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
12067
- abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
12068
- wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
12069
- };
12070
- var dayValues = {
12071
- narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
12072
- "short": ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
12073
- abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
12074
- wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
12075
- };
12076
- var dayPeriodValues = {
12077
- narrow: {
12078
- am: 'a',
12079
- pm: 'p',
12080
- midnight: 'mi',
12081
- noon: 'n',
12082
- morning: 'morning',
12083
- afternoon: 'afternoon',
12084
- evening: 'evening',
12085
- night: 'night'
12086
- },
12087
- abbreviated: {
12088
- am: 'AM',
12089
- pm: 'PM',
12090
- midnight: 'midnight',
12091
- noon: 'noon',
12092
- morning: 'morning',
12093
- afternoon: 'afternoon',
12094
- evening: 'evening',
12095
- night: 'night'
12096
- },
12097
- wide: {
12098
- am: 'a.m.',
12099
- pm: 'p.m.',
12100
- midnight: 'midnight',
12101
- noon: 'noon',
12102
- morning: 'morning',
12103
- afternoon: 'afternoon',
12104
- evening: 'evening',
12105
- night: 'night'
12106
- }
12107
- };
12108
- var formattingDayPeriodValues = {
12109
- narrow: {
12110
- am: 'a',
12111
- pm: 'p',
12112
- midnight: 'mi',
12113
- noon: 'n',
12114
- morning: 'in the morning',
12115
- afternoon: 'in the afternoon',
12116
- evening: 'in the evening',
12117
- night: 'at night'
12118
- },
12119
- abbreviated: {
12120
- am: 'AM',
12121
- pm: 'PM',
12122
- midnight: 'midnight',
12123
- noon: 'noon',
12124
- morning: 'in the morning',
12125
- afternoon: 'in the afternoon',
12126
- evening: 'in the evening',
12127
- night: 'at night'
12128
- },
12129
- wide: {
12130
- am: 'a.m.',
12131
- pm: 'p.m.',
12132
- midnight: 'midnight',
12133
- noon: 'noon',
12134
- morning: 'in the morning',
12135
- afternoon: 'in the afternoon',
12136
- evening: 'in the evening',
12137
- night: 'at night'
12138
- }
12139
- };
12140
- var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
12141
- var number = Number(dirtyNumber);
12142
-
12143
- // If ordinal numbers depend on context, for example,
12144
- // if they are different for different grammatical genders,
12145
- // use `options.unit`.
12146
- //
12147
- // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
12148
- // 'day', 'hour', 'minute', 'second'.
12149
-
12150
- var rem100 = number % 100;
12151
- if (rem100 > 20 || rem100 < 10) {
12152
- switch (rem100 % 10) {
12153
- case 1:
12154
- return number + 'st';
12155
- case 2:
12156
- return number + 'nd';
12157
- case 3:
12158
- return number + 'rd';
12159
- }
12160
- }
12161
- return number + 'th';
12162
- };
12163
- var localize = {
12164
- ordinalNumber: ordinalNumber,
12165
- era: buildLocalizeFn({
12166
- values: eraValues,
12167
- defaultWidth: 'wide'
12168
- }),
12169
- quarter: buildLocalizeFn({
12170
- values: quarterValues,
12171
- defaultWidth: 'wide',
12172
- argumentCallback: function argumentCallback(quarter) {
12173
- return quarter - 1;
12174
- }
12175
- }),
12176
- month: buildLocalizeFn({
12177
- values: monthValues,
12178
- defaultWidth: 'wide'
12179
- }),
12180
- day: buildLocalizeFn({
12181
- values: dayValues,
12182
- defaultWidth: 'wide'
12183
- }),
12184
- dayPeriod: buildLocalizeFn({
12185
- values: dayPeriodValues,
12186
- defaultWidth: 'wide',
12187
- formattingValues: formattingDayPeriodValues,
12188
- defaultFormattingWidth: 'wide'
12189
- })
12190
- };
12191
-
12192
- function buildMatchFn(args) {
12193
- return function (string) {
12194
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12195
- var width = options.width;
12196
- var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
12197
- var matchResult = string.match(matchPattern);
12198
- if (!matchResult) {
12199
- return null;
12200
- }
12201
- var matchedString = matchResult[0];
12202
- var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
12203
- var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
12204
- return pattern.test(matchedString);
12205
- }) : findKey(parsePatterns, function (pattern) {
12206
- return pattern.test(matchedString);
12207
- });
12208
- var value;
12209
- value = args.valueCallback ? args.valueCallback(key) : key;
12210
- value = options.valueCallback ? options.valueCallback(value) : value;
12211
- var rest = string.slice(matchedString.length);
12212
- return {
12213
- value: value,
12214
- rest: rest
12215
- };
12216
- };
12217
- }
12218
- function findKey(object, predicate) {
12219
- for (var key in object) {
12220
- if (object.hasOwnProperty(key) && predicate(object[key])) {
12221
- return key;
12184
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
12185
+ }
12186
+ },
12187
+ // Timezone (specific non-location)
12188
+ z: function z(date, token, _localize, options) {
12189
+ var originalDate = options._originalDate || date;
12190
+ var timezoneOffset = originalDate.getTimezoneOffset();
12191
+ switch (token) {
12192
+ // Short
12193
+ case 'z':
12194
+ case 'zz':
12195
+ case 'zzz':
12196
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
12197
+ // Long
12198
+
12199
+ case 'zzzz':
12200
+ default:
12201
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
12222
12202
  }
12203
+ },
12204
+ // Seconds timestamp
12205
+ t: function t(date, token, _localize, options) {
12206
+ var originalDate = options._originalDate || date;
12207
+ var timestamp = Math.floor(originalDate.getTime() / 1000);
12208
+ return addLeadingZeros(timestamp, token.length);
12209
+ },
12210
+ // Milliseconds timestamp
12211
+ T: function T(date, token, _localize, options) {
12212
+ var originalDate = options._originalDate || date;
12213
+ var timestamp = originalDate.getTime();
12214
+ return addLeadingZeros(timestamp, token.length);
12223
12215
  }
12224
- return undefined;
12216
+ };
12217
+ function formatTimezoneShort(offset, dirtyDelimiter) {
12218
+ var sign = offset > 0 ? '-' : '+';
12219
+ var absOffset = Math.abs(offset);
12220
+ var hours = Math.floor(absOffset / 60);
12221
+ var minutes = absOffset % 60;
12222
+ if (minutes === 0) {
12223
+ return sign + String(hours);
12224
+ }
12225
+ var delimiter = dirtyDelimiter;
12226
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
12225
12227
  }
12226
- function findIndex(array, predicate) {
12227
- for (var key = 0; key < array.length; key++) {
12228
- if (predicate(array[key])) {
12229
- return key;
12230
- }
12228
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
12229
+ if (offset % 60 === 0) {
12230
+ var sign = offset > 0 ? '-' : '+';
12231
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
12231
12232
  }
12232
- return undefined;
12233
+ return formatTimezone(offset, dirtyDelimiter);
12233
12234
  }
12234
-
12235
- function buildMatchPatternFn(args) {
12236
- return function (string) {
12237
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12238
- var matchResult = string.match(args.matchPattern);
12239
- if (!matchResult) return null;
12240
- var matchedString = matchResult[0];
12241
- var parseResult = string.match(args.parsePattern);
12242
- if (!parseResult) return null;
12243
- var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
12244
- value = options.valueCallback ? options.valueCallback(value) : value;
12245
- var rest = string.slice(matchedString.length);
12246
- return {
12247
- value: value,
12248
- rest: rest
12249
- };
12250
- };
12235
+ function formatTimezone(offset, dirtyDelimiter) {
12236
+ var delimiter = dirtyDelimiter || '';
12237
+ var sign = offset > 0 ? '-' : '+';
12238
+ var absOffset = Math.abs(offset);
12239
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
12240
+ var minutes = addLeadingZeros(absOffset % 60, 2);
12241
+ return sign + hours + delimiter + minutes;
12251
12242
  }
12252
12243
 
12253
- var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
12254
- var parseOrdinalNumberPattern = /\d+/i;
12255
- var matchEraPatterns = {
12256
- narrow: /^(b|a)/i,
12257
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
12258
- wide: /^(before christ|before common era|anno domini|common era)/i
12259
- };
12260
- var parseEraPatterns = {
12261
- any: [/^b/i, /^(a|c)/i]
12262
- };
12263
- var matchQuarterPatterns = {
12264
- narrow: /^[1234]/i,
12265
- abbreviated: /^q[1234]/i,
12266
- wide: /^[1234](th|st|nd|rd)? quarter/i
12267
- };
12268
- var parseQuarterPatterns = {
12269
- any: [/1/i, /2/i, /3/i, /4/i]
12270
- };
12271
- var matchMonthPatterns = {
12272
- narrow: /^[jfmasond]/i,
12273
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
12274
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
12275
- };
12276
- var parseMonthPatterns = {
12277
- 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],
12278
- 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]
12279
- };
12280
- var matchDayPatterns = {
12281
- narrow: /^[smtwf]/i,
12282
- "short": /^(su|mo|tu|we|th|fr|sa)/i,
12283
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
12284
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
12285
- };
12286
- var parseDayPatterns = {
12287
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
12288
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
12289
- };
12290
- var matchDayPeriodPatterns = {
12291
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
12292
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
12293
- };
12294
- var parseDayPeriodPatterns = {
12295
- any: {
12296
- am: /^a/i,
12297
- pm: /^p/i,
12298
- midnight: /^mi/i,
12299
- noon: /^no/i,
12300
- morning: /morning/i,
12301
- afternoon: /afternoon/i,
12302
- evening: /evening/i,
12303
- night: /night/i
12244
+ function dateLongFormatter(pattern, formatLong) {
12245
+ switch (pattern) {
12246
+ case 'P':
12247
+ return formatLong.date({
12248
+ width: 'short'
12249
+ });
12250
+ case 'PP':
12251
+ return formatLong.date({
12252
+ width: 'medium'
12253
+ });
12254
+ case 'PPP':
12255
+ return formatLong.date({
12256
+ width: 'long'
12257
+ });
12258
+ case 'PPPP':
12259
+ default:
12260
+ return formatLong.date({
12261
+ width: 'full'
12262
+ });
12304
12263
  }
12305
- };
12306
- var match = {
12307
- ordinalNumber: buildMatchPatternFn({
12308
- matchPattern: matchOrdinalNumberPattern,
12309
- parsePattern: parseOrdinalNumberPattern,
12310
- valueCallback: function valueCallback(value) {
12311
- return parseInt(value, 10);
12312
- }
12313
- }),
12314
- era: buildMatchFn({
12315
- matchPatterns: matchEraPatterns,
12316
- defaultMatchWidth: 'wide',
12317
- parsePatterns: parseEraPatterns,
12318
- defaultParseWidth: 'any'
12319
- }),
12320
- quarter: buildMatchFn({
12321
- matchPatterns: matchQuarterPatterns,
12322
- defaultMatchWidth: 'wide',
12323
- parsePatterns: parseQuarterPatterns,
12324
- defaultParseWidth: 'any',
12325
- valueCallback: function valueCallback(index) {
12326
- return index + 1;
12327
- }
12328
- }),
12329
- month: buildMatchFn({
12330
- matchPatterns: matchMonthPatterns,
12331
- defaultMatchWidth: 'wide',
12332
- parsePatterns: parseMonthPatterns,
12333
- defaultParseWidth: 'any'
12334
- }),
12335
- day: buildMatchFn({
12336
- matchPatterns: matchDayPatterns,
12337
- defaultMatchWidth: 'wide',
12338
- parsePatterns: parseDayPatterns,
12339
- defaultParseWidth: 'any'
12340
- }),
12341
- dayPeriod: buildMatchFn({
12342
- matchPatterns: matchDayPeriodPatterns,
12343
- defaultMatchWidth: 'any',
12344
- parsePatterns: parseDayPeriodPatterns,
12345
- defaultParseWidth: 'any'
12346
- })
12264
+ }
12265
+ function timeLongFormatter(pattern, formatLong) {
12266
+ switch (pattern) {
12267
+ case 'p':
12268
+ return formatLong.time({
12269
+ width: 'short'
12270
+ });
12271
+ case 'pp':
12272
+ return formatLong.time({
12273
+ width: 'medium'
12274
+ });
12275
+ case 'ppp':
12276
+ return formatLong.time({
12277
+ width: 'long'
12278
+ });
12279
+ case 'pppp':
12280
+ default:
12281
+ return formatLong.time({
12282
+ width: 'full'
12283
+ });
12284
+ }
12285
+ }
12286
+ function dateTimeLongFormatter(pattern, formatLong) {
12287
+ var matchResult = pattern.match(/(P+)(p+)?/);
12288
+ var datePattern = matchResult[1];
12289
+ var timePattern = matchResult[2];
12290
+ if (!timePattern) {
12291
+ return dateLongFormatter(pattern, formatLong);
12292
+ }
12293
+ var dateTimeFormat;
12294
+ switch (datePattern) {
12295
+ case 'P':
12296
+ dateTimeFormat = formatLong.dateTime({
12297
+ width: 'short'
12298
+ });
12299
+ break;
12300
+ case 'PP':
12301
+ dateTimeFormat = formatLong.dateTime({
12302
+ width: 'medium'
12303
+ });
12304
+ break;
12305
+ case 'PPP':
12306
+ dateTimeFormat = formatLong.dateTime({
12307
+ width: 'long'
12308
+ });
12309
+ break;
12310
+ case 'PPPP':
12311
+ default:
12312
+ dateTimeFormat = formatLong.dateTime({
12313
+ width: 'full'
12314
+ });
12315
+ break;
12316
+ }
12317
+ return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
12318
+ }
12319
+ var longFormatters = {
12320
+ p: timeLongFormatter,
12321
+ P: dateTimeLongFormatter
12347
12322
  };
12348
12323
 
12324
+ var MILLISECONDS_IN_MINUTE = 60000;
12325
+ function getDateMillisecondsPart(date) {
12326
+ return date.getTime() % MILLISECONDS_IN_MINUTE;
12327
+ }
12349
12328
  /**
12350
- * @type {Locale}
12351
- * @category Locales
12352
- * @summary English locale (United States).
12353
- * @language English
12354
- * @iso-639-2 eng
12355
- * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
12356
- * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
12329
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
12330
+ * They usually appear for dates that denote time before the timezones were introduced
12331
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
12332
+ * and GMT+01:00:00 after that date)
12333
+ *
12334
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
12335
+ * which would lead to incorrect calculations.
12336
+ *
12337
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
12357
12338
  */
12358
- var locale = {
12359
- code: 'en-US',
12360
- formatDistance: formatDistance,
12361
- formatLong: formatLong,
12362
- formatRelative: formatRelative,
12363
- localize: localize,
12364
- match: match,
12365
- options: {
12366
- weekStartsOn: 0 /* Sunday */,
12367
- firstWeekContainsDate: 1
12339
+
12340
+ function getTimezoneOffsetInMilliseconds(dirtyDate) {
12341
+ var date = new Date(dirtyDate.getTime());
12342
+ var baseTimezoneOffset = Math.ceil(date.getTimezoneOffset());
12343
+ date.setSeconds(0, 0);
12344
+ var hasNegativeUTCOffset = baseTimezoneOffset > 0;
12345
+ var millisecondsPartOfTimezoneOffset = hasNegativeUTCOffset ? (MILLISECONDS_IN_MINUTE + getDateMillisecondsPart(date)) % MILLISECONDS_IN_MINUTE : getDateMillisecondsPart(date);
12346
+ return baseTimezoneOffset * MILLISECONDS_IN_MINUTE + millisecondsPartOfTimezoneOffset;
12347
+ }
12348
+
12349
+ var protectedDayOfYearTokens = ['D', 'DD'];
12350
+ var protectedWeekYearTokens = ['YY', 'YYYY'];
12351
+ function isProtectedDayOfYearToken(token) {
12352
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
12353
+ }
12354
+ function isProtectedWeekYearToken(token) {
12355
+ return protectedWeekYearTokens.indexOf(token) !== -1;
12356
+ }
12357
+ function throwProtectedError(token, format, input) {
12358
+ if (token === 'YYYY') {
12359
+ throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
12360
+ } else if (token === 'YY') {
12361
+ throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
12362
+ } else if (token === 'D') {
12363
+ 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"));
12364
+ } else if (token === 'DD') {
12365
+ 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"));
12368
12366
  }
12369
- };
12367
+ }
12370
12368
 
12371
12369
  // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
12372
12370
  // (one of the certain letters followed by `o`)
@@ -12378,15 +12376,14 @@ var locale = {
12378
12376
  // If there is no matching single quote
12379
12377
  // then the sequence will continue until the end of the string.
12380
12378
  // - . matches any single character unmatched by previous parts of the RegExps
12381
- var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
12382
12379
 
12383
- // This RegExp catches symbols escaped by quotes, and also
12380
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also
12384
12381
  // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
12382
+
12385
12383
  var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
12386
12384
  var escapedStringRegExp = /^'([^]*?)'?$/;
12387
12385
  var doubleQuoteRegExp = /''/g;
12388
12386
  var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12389
-
12390
12387
  /**
12391
12388
  * @name format
12392
12389
  * @category Common Helpers
@@ -12396,7 +12393,7 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12396
12393
  * Return the formatted date string in the given format. The result may vary by locale.
12397
12394
  *
12398
12395
  * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
12399
- * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12396
+ * > See: https://git.io/fxCyr
12400
12397
  *
12401
12398
  * The characters wrapped between two single quotes characters (') are escaped.
12402
12399
  * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
@@ -12475,34 +12472,32 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12475
12472
  * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
12476
12473
  * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
12477
12474
  * | | EEEEE | M, T, W, T, F, S, S | |
12478
- * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
12475
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |
12479
12476
  * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
12480
12477
  * | | io | 1st, 2nd, ..., 7th | 7 |
12481
12478
  * | | ii | 01, 02, ..., 07 | 7 |
12482
12479
  * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
12483
12480
  * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
12484
12481
  * | | iiiii | M, T, W, T, F, S, S | 7 |
12485
- * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
12482
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 |
12486
12483
  * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
12487
12484
  * | | eo | 2nd, 3rd, ..., 1st | 7 |
12488
12485
  * | | ee | 02, 03, ..., 01 | |
12489
12486
  * | | eee | Mon, Tue, Wed, ..., Sun | |
12490
12487
  * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
12491
12488
  * | | eeeee | M, T, W, T, F, S, S | |
12492
- * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
12489
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |
12493
12490
  * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
12494
12491
  * | | co | 2nd, 3rd, ..., 1st | 7 |
12495
12492
  * | | cc | 02, 03, ..., 01 | |
12496
12493
  * | | ccc | Mon, Tue, Wed, ..., Sun | |
12497
12494
  * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
12498
12495
  * | | ccccc | M, T, W, T, F, S, S | |
12499
- * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
12500
- * | AM, PM | a..aa | AM, PM | |
12501
- * | | aaa | am, pm | |
12496
+ * | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |
12497
+ * | AM, PM | a..aaa | AM, PM | |
12502
12498
  * | | aaaa | a.m., p.m. | 2 |
12503
12499
  * | | aaaaa | a, p | |
12504
- * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
12505
- * | | bbb | am, pm, noon, midnight | |
12500
+ * | AM, PM, noon, midnight | b..bbb | AM, PM, noon, midnight | |
12506
12501
  * | | bbbb | a.m., p.m., noon, midnight | 2 |
12507
12502
  * | | bbbbb | a, p, n, mi | |
12508
12503
  * | Flexible day period | B..BBB | at night, in the morning, ... | |
@@ -12528,7 +12523,7 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12528
12523
  * | | ss | 00, 01, ..., 59 | |
12529
12524
  * | Fraction of second | S | 0, 1, ..., 9 | |
12530
12525
  * | | SS | 00, 01, ..., 99 | |
12531
- * | | SSS | 000, 001, ..., 999 | |
12526
+ * | | SSS | 000, 0001, ..., 999 | |
12532
12527
  * | | SSSS | ... | 3 |
12533
12528
  * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
12534
12529
  * | | XX | -0800, +0530, Z | |
@@ -12548,18 +12543,18 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12548
12543
  * | | tt | ... | 3,7 |
12549
12544
  * | Milliseconds timestamp | T | 512969520900 | 7 |
12550
12545
  * | | TT | ... | 3,7 |
12551
- * | Long localized date | P | 04/29/1453 | 7 |
12552
- * | | PP | Apr 29, 1453 | 7 |
12553
- * | | PPP | April 29th, 1453 | 7 |
12554
- * | | PPPP | Friday, April 29th, 1453 | 2,7 |
12546
+ * | Long localized date | P | 05/29/1453 | 7 |
12547
+ * | | PP | May 29, 1453 | 7 |
12548
+ * | | PPP | May 29th, 1453 | 7 |
12549
+ * | | PPPP | Sunday, May 29th, 1453 | 2,7 |
12555
12550
  * | Long localized time | p | 12:00 AM | 7 |
12556
12551
  * | | pp | 12:00:00 AM | 7 |
12557
12552
  * | | ppp | 12:00:00 AM GMT+2 | 7 |
12558
12553
  * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
12559
- * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
12560
- * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
12561
- * | | PPPppp | April 29th, 1453 at ... | 7 |
12562
- * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
12554
+ * | Combination of date and time | Pp | 05/29/1453, 12:00 AM | 7 |
12555
+ * | | PPpp | May 29, 1453, 12:00:00 AM | 7 |
12556
+ * | | PPPppp | May 29th, 1453 at ... | 7 |
12557
+ * | | PPPPpppp| Sunday, May 29th, 1453 at ... | 2,7 |
12563
12558
  * Notes:
12564
12559
  * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
12565
12560
  * are the same as "stand-alone" units, but are different in some languages.
@@ -12632,10 +12627,30 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12632
12627
  * - `p`: long localized time
12633
12628
  *
12634
12629
  * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
12635
- * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12630
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://git.io/fxCyr
12631
+ *
12632
+ * 9. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.
12633
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://git.io/fxCyr
12634
+ *
12635
+ * ### v2.0.0 breaking changes:
12636
+ *
12637
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
12638
+ *
12639
+ * - The second argument is now required for the sake of explicitness.
12636
12640
  *
12637
- * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
12638
- * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12641
+ * ```javascript
12642
+ * // Before v2.0.0
12643
+ * format(new Date(2016, 0, 1))
12644
+ *
12645
+ * // v2.0.0 onward
12646
+ * format(new Date(2016, 0, 1), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")
12647
+ * ```
12648
+ *
12649
+ * - New format string API for `format` function
12650
+ * which is based on [Unicode Technical Standard #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).
12651
+ * See [this post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.
12652
+ *
12653
+ * - Characters are now escaped using single quote symbols (`'`) instead of square brackets.
12639
12654
  *
12640
12655
  * @param {Date|Number} date - the original date
12641
12656
  * @param {String} format - the string of tokens
@@ -12644,9 +12659,9 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12644
12659
  * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
12645
12660
  * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
12646
12661
  * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
12647
- * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12662
+ * see: https://git.io/fxCyr
12648
12663
  * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
12649
- * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
12664
+ * see: https://git.io/fxCyr
12650
12665
  * @returns {String} the formatted date string
12651
12666
  * @throws {TypeError} 2 arguments required
12652
12667
  * @throws {RangeError} `date` must not be Invalid Date
@@ -12654,46 +12669,47 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12654
12669
  * @throws {RangeError} `options.locale` must contain `formatLong` property
12655
12670
  * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
12656
12671
  * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
12657
- * @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
12658
- * @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
12659
- * @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
12660
- * @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
12672
+ * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
12673
+ * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
12674
+ * @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
12675
+ * @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
12661
12676
  * @throws {RangeError} format string contains an unescaped latin alphabet character
12662
12677
  *
12663
12678
  * @example
12664
12679
  * // Represent 11 February 2014 in middle-endian format:
12665
- * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
12680
+ * var result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
12666
12681
  * //=> '02/11/2014'
12667
12682
  *
12668
12683
  * @example
12669
12684
  * // Represent 2 July 2014 in Esperanto:
12670
12685
  * import { eoLocale } from 'date-fns/locale/eo'
12671
- * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
12686
+ * var result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
12672
12687
  * locale: eoLocale
12673
12688
  * })
12674
12689
  * //=> '2-a de julio 2014'
12675
12690
  *
12676
12691
  * @example
12677
12692
  * // Escape string by single quote characters:
12678
- * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
12693
+ * var result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
12679
12694
  * //=> "3 o'clock"
12680
12695
  */
12681
12696
 
12682
- function format(dirtyDate, dirtyFormatStr, options) {
12683
- 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;
12697
+ function format$1(dirtyDate, dirtyFormatStr, dirtyOptions) {
12684
12698
  requiredArgs(2, arguments);
12685
12699
  var formatStr = String(dirtyFormatStr);
12686
- var defaultOptions = getDefaultOptions();
12687
- var locale$1 = (_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;
12688
- 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);
12700
+ var options = dirtyOptions || {};
12701
+ var locale$1 = options.locale || locale;
12702
+ var localeFirstWeekContainsDate = locale$1.options && locale$1.options.firstWeekContainsDate;
12703
+ var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
12704
+ var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
12689
12705
 
12690
- // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
12691
12706
  if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
12692
12707
  throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
12693
12708
  }
12694
- 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);
12709
+ var localeWeekStartsOn = locale$1.options && locale$1.options.weekStartsOn;
12710
+ var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
12711
+ var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
12695
12712
 
12696
- // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
12697
12713
  if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
12698
12714
  throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
12699
12715
  }
@@ -12706,11 +12722,10 @@ function format(dirtyDate, dirtyFormatStr, options) {
12706
12722
  var originalDate = toDate(dirtyDate);
12707
12723
  if (!isValid(originalDate)) {
12708
12724
  throw new RangeError('Invalid time value');
12709
- }
12710
-
12711
- // Convert the date in system timezone to the same date in UTC+00:00 timezone.
12725
+ } // Convert the date in system timezone to the same date in UTC+00:00 timezone.
12712
12726
  // This ensures that when UTC functions will be implemented, locales will be compatible with them.
12713
12727
  // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
12728
+
12714
12729
  var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
12715
12730
  var utcDate = subMilliseconds(originalDate, timezoneOffset);
12716
12731
  var formatterOptions = {
@@ -12723,7 +12738,7 @@ function format(dirtyDate, dirtyFormatStr, options) {
12723
12738
  var firstCharacter = substring[0];
12724
12739
  if (firstCharacter === 'p' || firstCharacter === 'P') {
12725
12740
  var longFormatter = longFormatters[firstCharacter];
12726
- return longFormatter(substring, locale$1.formatLong);
12741
+ return longFormatter(substring, locale$1.formatLong, formatterOptions);
12727
12742
  }
12728
12743
  return substring;
12729
12744
  }).join('').match(formattingTokensRegExp).map(function (substring) {
@@ -12737,11 +12752,11 @@ function format(dirtyDate, dirtyFormatStr, options) {
12737
12752
  }
12738
12753
  var formatter = formatters[firstCharacter];
12739
12754
  if (formatter) {
12740
- if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
12741
- throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
12755
+ if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
12756
+ throwProtectedError(substring, dirtyFormatStr, dirtyDate);
12742
12757
  }
12743
- if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
12744
- throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
12758
+ if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
12759
+ throwProtectedError(substring, dirtyFormatStr, dirtyDate);
12745
12760
  }
12746
12761
  return formatter(utcDate, substring, locale$1.localize, formatterOptions);
12747
12762
  }
@@ -12753,28 +12768,22 @@ function format(dirtyDate, dirtyFormatStr, options) {
12753
12768
  return result;
12754
12769
  }
12755
12770
  function cleanEscapedString(input) {
12756
- var matched = input.match(escapedStringRegExp);
12757
- if (!matched) {
12758
- return input;
12759
- }
12760
- return matched[1].replace(doubleQuoteRegExp, "'");
12771
+ return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
12761
12772
  }
12762
12773
 
12763
- function convertToFP(fn, arity) {
12764
- var a = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
12774
+ function convertToFP(fn, arity, a) {
12775
+ a = a || [];
12765
12776
  if (a.length >= arity) {
12766
12777
  return fn.apply(null, a.slice(0, arity).reverse());
12767
12778
  }
12768
12779
  return function () {
12769
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12770
- args[_key] = arguments[_key];
12771
- }
12780
+ var args = Array.prototype.slice.call(arguments);
12772
12781
  return convertToFP(fn, arity, a.concat(args));
12773
12782
  };
12774
12783
  }
12775
12784
 
12776
- // This file is generated automatically by `scripts/build/fp.ts`. Please, don't change it.
12777
- var formatTime = convertToFP(format, 2);
12785
+ // This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
12786
+ var format = convertToFP(format$1, 2);
12778
12787
 
12779
12788
  var Wrapper = index$a(View)(function () {
12780
12789
  return {
@@ -12855,17 +12864,18 @@ var StyledCalendarDayNameCell = index$a(View)(function (_ref3) {
12855
12864
  var StyledCalendarCell = index$a(TouchableOpacity)(function (_ref4) {
12856
12865
  var theme = _ref4.theme,
12857
12866
  _ref4$variant = _ref4.variant,
12858
- variant = _ref4$variant === void 0 ? 'default' : _ref4$variant,
12859
- themeItemWidth = _ref4.themeItemWidth;
12867
+ variant = _ref4$variant === void 0 ? 'default' : _ref4$variant;
12860
12868
  return {
12861
12869
  borderColor: theme.__hd__.calendar.colors.border,
12862
12870
  borderWidth: variant === 'current' ? 1 : 0,
12863
- borderRadius: theme.__hd__.calendar.radii["default"],
12871
+ borderRadius: variant === 'highlighted' ? undefined : theme.__hd__.calendar.radii["default"],
12864
12872
  alignItems: 'center',
12865
12873
  justifyContent: 'center',
12866
- backgroundColor: variant === 'selected' ? theme.__hd__.calendar.colors.primary : undefined,
12867
- width: themeItemWidth || theme.__hd__.calendar.sizes.cellCircleWidth,
12868
- height: theme.__hd__.calendar.sizes.cellCircleHeight
12874
+ backgroundColor: variant === 'selected' ? theme.__hd__.calendar.colors.rowItem.selected : 'transparent',
12875
+ width: '100%',
12876
+ height: '100%',
12877
+ maxWidth: theme.__hd__.calendar.sizes.cellWidth,
12878
+ maxHeight: theme.__hd__.calendar.sizes.cellHeight
12869
12879
  };
12870
12880
  });
12871
12881
  var StyledCalendarRow = index$a(View)(function (_ref5) {
@@ -12873,18 +12883,24 @@ var StyledCalendarRow = index$a(View)(function (_ref5) {
12873
12883
  return {
12874
12884
  flexDirection: 'row',
12875
12885
  paddingHorizontal: theme.__hd__.calendar.space.rowVerticalPadding,
12876
- flexWrap: 'wrap'
12886
+ flexWrap: 'wrap',
12887
+ justifyContent: 'center',
12888
+ alignItems: 'center'
12877
12889
  };
12878
12890
  });
12879
12891
  var StyledCalendarRowItem = index$a(View)(function (_ref6) {
12880
12892
  var theme = _ref6.theme,
12881
- themeItemWidth = _ref6.themeItemWidth;
12893
+ themeItemWidth = _ref6.themeItemWidth,
12894
+ isHighlighted = _ref6.isHighlighted;
12882
12895
  return {
12883
12896
  flexBasis: "".concat(Math.floor(100.0 / 7.0), "%"),
12897
+ lineHeight: 0,
12884
12898
  alignItems: 'center',
12885
12899
  width: themeItemWidth || theme.__hd__.calendar.sizes.cellWidth,
12886
- height: theme.__hd__.calendar.sizes.cellHeight,
12887
- justifyContent: 'center'
12900
+ height: themeItemWidth || theme.__hd__.calendar.sizes.cellHeight,
12901
+ maxHeight: theme.__hd__.calendar.sizes.cellHeight,
12902
+ justifyContent: 'center',
12903
+ backgroundColor: isHighlighted ? theme.__hd__.calendar.colors.rowItem.highlighted : undefined
12888
12904
  };
12889
12905
  });
12890
12906
  var StyledDisabledCalendarRowItem = index$a(View)(function (_ref7) {
@@ -12894,7 +12910,8 @@ var StyledDisabledCalendarRowItem = index$a(View)(function (_ref7) {
12894
12910
  flexBasis: "".concat(Math.floor(100.0 / 7.0), "%"),
12895
12911
  alignItems: 'center',
12896
12912
  width: themeItemWidth || theme.__hd__.calendar.sizes.cellWidth,
12897
- height: theme.__hd__.calendar.sizes.cellHeight
12913
+ height: themeItemWidth || theme.__hd__.calendar.sizes.cellHeight,
12914
+ maxHeight: theme.__hd__.calendar.sizes.cellHeight
12898
12915
  };
12899
12916
  });
12900
12917
  var StyledMark = index$a(View)(function (_ref8) {
@@ -12914,8 +12931,10 @@ var StyledMark = index$a(View)(function (_ref8) {
12914
12931
  var getCellVariant = function getCellVariant() {
12915
12932
  var isSelected = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
12916
12933
  var isCurrent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
12934
+ var isHighlighted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
12917
12935
  if (isSelected) return 'selected';
12918
12936
  if (isCurrent) return 'current';
12937
+ if (isHighlighted) return 'highlighted';
12919
12938
  return 'default';
12920
12939
  };
12921
12940
  var CalendarRowItem = function CalendarRowItem(_ref) {
@@ -12927,12 +12946,14 @@ var CalendarRowItem = function CalendarRowItem(_ref) {
12927
12946
  textIntent = _ref$textIntent === void 0 ? 'body' : _ref$textIntent,
12928
12947
  _ref$marked = _ref.marked,
12929
12948
  marked = _ref$marked === void 0 ? false : _ref$marked,
12930
- itemWidth = _ref.itemWidth;
12949
+ itemWidth = _ref.itemWidth,
12950
+ isHighlighted = _ref.isHighlighted;
12931
12951
  return /*#__PURE__*/React__default.createElement(StyledCalendarRowItem, {
12932
12952
  testID: "calendar-date-cell",
12933
- themeItemWidth: itemWidth
12953
+ themeItemWidth: itemWidth,
12954
+ isHighlighted: isHighlighted
12934
12955
  }, /*#__PURE__*/React__default.createElement(StyledCalendarCell, {
12935
- variant: getCellVariant(isSelected, isCurrent),
12956
+ variant: getCellVariant(isSelected, isCurrent, isHighlighted),
12936
12957
  onPress: onPress
12937
12958
  }, /*#__PURE__*/React__default.createElement(Typography.Body, {
12938
12959
  variant: "small",
@@ -12951,6 +12972,14 @@ var initArray = function initArray(length, func) {
12951
12972
  var isEqDate = function isEqDate(dateA, dateB) {
12952
12973
  return (dateA === null || dateA === void 0 ? void 0 : dateA.toDateString()) === (dateB === null || dateB === void 0 ? void 0 : dateB.toDateString());
12953
12974
  };
12975
+ var isDateInRange = function isDateInRange(_ref) {
12976
+ var date = _ref.date,
12977
+ range = _ref.range;
12978
+ if (!range || range.startDate === undefined || range.endDate === undefined) {
12979
+ return false;
12980
+ }
12981
+ return date >= range.startDate && date <= range.endDate;
12982
+ };
12954
12983
  var getValidDate = function getValidDate(date, minDate, maxDate) {
12955
12984
  if (minDate === undefined && maxDate === undefined) {
12956
12985
  return date;
@@ -12966,6 +12995,297 @@ var getValidDate = function getValidDate(date, minDate, maxDate) {
12966
12995
  }
12967
12996
  return undefined;
12968
12997
  };
12998
+ var setStartOrEndDate = function setStartOrEndDate(_ref2) {
12999
+ var date = _ref2.date,
13000
+ startDate = _ref2.startDate,
13001
+ endDate = _ref2.endDate;
13002
+ // Prevent selecting same date
13003
+ if (isEqDate(date, startDate) || isEqDate(date, endDate)) {
13004
+ return {
13005
+ startDate: startDate,
13006
+ endDate: endDate
13007
+ };
13008
+ }
13009
+ // No start date yet - set as start
13010
+ if (!startDate) {
13011
+ return {
13012
+ startDate: date,
13013
+ endDate: undefined
13014
+ };
13015
+ }
13016
+ // Have start but no end - set as end and reorder if needed
13017
+ if (!endDate) {
13018
+ return date < startDate ? {
13019
+ startDate: date,
13020
+ endDate: startDate
13021
+ } : {
13022
+ startDate: startDate,
13023
+ endDate: date
13024
+ };
13025
+ }
13026
+ // Clicking within range - start new selection
13027
+ if (date >= startDate && date <= endDate) {
13028
+ return {
13029
+ startDate: date,
13030
+ endDate: undefined
13031
+ };
13032
+ }
13033
+ // Clicking outside range - extend range
13034
+ return date < startDate ? {
13035
+ startDate: date,
13036
+ endDate: endDate
13037
+ } : {
13038
+ startDate: startDate,
13039
+ endDate: date
13040
+ };
13041
+ };
13042
+
13043
+ var SelectedDate = function SelectedDate(_ref) {
13044
+ var date = _ref.date,
13045
+ onPress = _ref.onPress,
13046
+ marked = _ref.marked,
13047
+ isStart = _ref.isStart,
13048
+ showConnector = _ref.showConnector,
13049
+ itemWidth = _ref.itemWidth;
13050
+ return /*#__PURE__*/React__default.createElement(StyledCalendarRowItem, {
13051
+ themeItemWidth: itemWidth,
13052
+ testID: "calendar-date-cell"
13053
+ }, showConnector ? /*#__PURE__*/React__default.createElement(Box, {
13054
+ testID: "range-connector",
13055
+ style: _objectSpread2(_objectSpread2({
13056
+ width: '50%',
13057
+ height: '100%'
13058
+ }, StyleSheet$1.absoluteFillObject), {}, {
13059
+ transform: isStart ? [{
13060
+ translateX: itemWidth ? itemWidth / 2 : 0
13061
+ }] : undefined
13062
+ }),
13063
+ bgColor: "highlightedSurface"
13064
+ }) : null, /*#__PURE__*/React__default.createElement(StyledCalendarCell, {
13065
+ testID: "selected-date-cell",
13066
+ variant: "selected",
13067
+ onPress: onPress
13068
+ }, /*#__PURE__*/React__default.createElement(Typography.Body, {
13069
+ variant: "small",
13070
+ intent: "inverted"
13071
+ }, date ? date.getDate() : ''), marked ? /*#__PURE__*/React__default.createElement(StyledMark, {
13072
+ testID: "calendar-date-mark",
13073
+ variant: "inverted"
13074
+ }) : null));
13075
+ };
13076
+
13077
+ var DAYS_OF_WEEK$1 = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
13078
+ // Sunday first column => 0
13079
+ // Sunday last column => 1
13080
+ var WEEK_INDEX_OFFSET$1 = 1;
13081
+ var SUNDAY_INDEX$1 = 6;
13082
+ // Always render 7 rows x 6 items for consistent layout
13083
+ var TOTAL_DATES_ITEMS$1 = 7 * 6;
13084
+ var CalendarRange = function CalendarRange(_ref) {
13085
+ var value = _ref.value,
13086
+ visibleDate = _ref.visibleDate,
13087
+ onChange = _ref.onChange,
13088
+ _ref$onPreviousPress = _ref.onPreviousPress,
13089
+ onPreviousPress = _ref$onPreviousPress === void 0 ? noop$1 : _ref$onPreviousPress,
13090
+ _ref$onNextPress = _ref.onNextPress,
13091
+ onNextPress = _ref$onNextPress === void 0 ? noop$1 : _ref$onNextPress,
13092
+ _ref$onTitlePress = _ref.onTitlePress,
13093
+ onTitlePress = _ref$onTitlePress === void 0 ? noop$1 : _ref$onTitlePress,
13094
+ minDate = _ref.minDate,
13095
+ maxDate = _ref.maxDate,
13096
+ _ref$markedDates = _ref.markedDates,
13097
+ markedDates = _ref$markedDates === void 0 ? [] : _ref$markedDates,
13098
+ testID = _ref.testID,
13099
+ _ref$onMonthChange = _ref.onMonthChange,
13100
+ onMonthChange = _ref$onMonthChange === void 0 ? noop$1 : _ref$onMonthChange,
13101
+ _ref$onToggleMonthPic = _ref.onToggleMonthPicker,
13102
+ onToggleMonthPicker = _ref$onToggleMonthPic === void 0 ? noop$1 : _ref$onToggleMonthPic,
13103
+ monthPickerConfirmLabel = _ref.monthPickerConfirmLabel,
13104
+ monthPickerCancelLabel = _ref.monthPickerCancelLabel;
13105
+ var theme = useTheme();
13106
+ var currentMonth = visibleDate.getMonth();
13107
+ var currentYear = visibleDate.getFullYear();
13108
+ var now = new Date();
13109
+ var parsedMaskedDate = markedDates.reduce(function (current, markedDate) {
13110
+ return _objectSpread2(_objectSpread2({}, current), {}, _defineProperty({}, markedDate.toDateString(), true));
13111
+ }, {});
13112
+ var _useState = useState(false),
13113
+ _useState2 = _slicedToArray(_useState, 2),
13114
+ monthPickerVisible = _useState2[0],
13115
+ setMonthPickerVisible = _useState2[1];
13116
+ var _useState3 = useState(0),
13117
+ _useState4 = _slicedToArray(_useState3, 2),
13118
+ contentHeight = _useState4[0],
13119
+ setContentHeight = _useState4[1];
13120
+ var _useState5 = useState(0),
13121
+ _useState6 = _slicedToArray(_useState5, 2),
13122
+ contentWidth = _useState6[0],
13123
+ setContentWidth = _useState6[1];
13124
+ var calendarItemWidth = useMemo(function () {
13125
+ return contentWidth > 0 ? Math.floor((contentWidth - theme.__hd__.calendar.space.cellPadding) / 7) : undefined;
13126
+ }, [contentWidth, theme]);
13127
+ var useMonthPicker = onMonthChange !== noop$1;
13128
+ var firstDateOfMonth = new Date(currentYear, currentMonth, 1);
13129
+ var lastDateOfMonth = new Date(currentYear, currentMonth + 1, 0);
13130
+ var lastDateOfPreviousMonth = new Date(currentYear, currentMonth, 0);
13131
+ // Index of day in week is shifted by 1 due to Sunday is the last column
13132
+ var firstDayWeekIndexOfMonth = firstDateOfMonth.getDay() === 0 ? SUNDAY_INDEX$1 : firstDateOfMonth.getDay() - WEEK_INDEX_OFFSET$1;
13133
+ var lastDayIndexOfCurrentMonth = lastDateOfMonth.getDate();
13134
+ var lastDayIndexOfPreviousMonth = lastDateOfPreviousMonth.getDate();
13135
+ var daysOfPreviousMonth = initArray(firstDayWeekIndexOfMonth, function (index) {
13136
+ var reversedIndex = firstDayWeekIndexOfMonth - index - 1;
13137
+ var count = lastDayIndexOfPreviousMonth - reversedIndex;
13138
+ return getValidDate(new Date(currentYear, currentMonth - 1, count), minDate, maxDate);
13139
+ });
13140
+ var daysOfCurrentMonth = initArray(lastDayIndexOfCurrentMonth, function (index) {
13141
+ return getValidDate(new Date(currentYear, currentMonth, index + 1), minDate, maxDate);
13142
+ });
13143
+ var daysOfNextMonth = initArray(TOTAL_DATES_ITEMS$1 - (daysOfPreviousMonth.length + daysOfCurrentMonth.length), function (index) {
13144
+ return getValidDate(new Date(currentYear, currentMonth + 1, index + 1), minDate, maxDate);
13145
+ });
13146
+ var disablePrevButton = minDate === undefined ? false : !daysOfPreviousMonth.some(function (date) {
13147
+ return date !== undefined;
13148
+ }) && minDate >= firstDateOfMonth;
13149
+ var disableNextButton = maxDate === undefined ? false : !daysOfNextMonth.some(function (date) {
13150
+ return date !== undefined;
13151
+ }) || maxDate <= lastDateOfMonth;
13152
+ var onDateChange = function onDateChange(date) {
13153
+ var newDateRange = setStartOrEndDate({
13154
+ date: date,
13155
+ startDate: value === null || value === void 0 ? void 0 : value.startDate,
13156
+ endDate: value === null || value === void 0 ? void 0 : value.endDate
13157
+ });
13158
+ onChange === null || onChange === void 0 || onChange(newDateRange);
13159
+ };
13160
+ var renderDateCell = function renderDateCell(_ref2) {
13161
+ var date = _ref2.date,
13162
+ isCurrentMonth = _ref2.isCurrentMonth;
13163
+ if (!date) {
13164
+ return /*#__PURE__*/React__default.createElement(StyledDisabledCalendarRowItem, {
13165
+ themeItemWidth: calendarItemWidth,
13166
+ testID: "calendar-disabled-cell"
13167
+ });
13168
+ }
13169
+ if (isEqDate(value === null || value === void 0 ? void 0 : value.startDate, date) || isEqDate(value === null || value === void 0 ? void 0 : value.endDate, date)) {
13170
+ return /*#__PURE__*/React__default.createElement(SelectedDate, {
13171
+ isStart: isEqDate(date, value === null || value === void 0 ? void 0 : value.startDate),
13172
+ showConnector: !!(value !== null && value !== void 0 && value.startDate) && !!(value !== null && value !== void 0 && value.endDate),
13173
+ key: date.toDateString(),
13174
+ date: date,
13175
+ onPress: function onPress() {
13176
+ return onDateChange(date);
13177
+ },
13178
+ marked: parsedMaskedDate[date.toDateString()],
13179
+ itemWidth: calendarItemWidth
13180
+ });
13181
+ }
13182
+ return /*#__PURE__*/React__default.createElement(CalendarRowItem, {
13183
+ itemWidth: calendarItemWidth,
13184
+ key: date.toDateString(),
13185
+ date: date,
13186
+ isCurrent: isEqDate(now, date),
13187
+ isSelected: isEqDate(value === null || value === void 0 ? void 0 : value.startDate, date) || isEqDate(value === null || value === void 0 ? void 0 : value.endDate, date),
13188
+ isHighlighted: isDateInRange({
13189
+ date: date,
13190
+ range: value
13191
+ }),
13192
+ onPress: function onPress() {
13193
+ return onDateChange(date);
13194
+ },
13195
+ marked: parsedMaskedDate[date.toDateString()],
13196
+ textIntent: isCurrentMonth ? undefined : 'subdued'
13197
+ });
13198
+ };
13199
+ var onLayout = function onLayout(e) {
13200
+ var _e$nativeEvent$layout = e.nativeEvent.layout,
13201
+ width = _e$nativeEvent$layout.width,
13202
+ height = _e$nativeEvent$layout.height;
13203
+ setContentHeight(height);
13204
+ setContentWidth(width);
13205
+ };
13206
+ return /*#__PURE__*/React__default.createElement(StyledContainer$7, {
13207
+ testID: testID
13208
+ }, /*#__PURE__*/React__default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__default.createElement(ContentNavigator, {
13209
+ value: !useMonthPicker ? format('MMMM yyyy', visibleDate) : /*#__PURE__*/React__default.createElement(TouchableOpacity, {
13210
+ testID: "calendar-month-picker",
13211
+ onPress: function onPress() {
13212
+ onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(!monthPickerVisible);
13213
+ setMonthPickerVisible(!monthPickerVisible);
13214
+ }
13215
+ }, /*#__PURE__*/React__default.createElement(Box, {
13216
+ flexDirection: "row",
13217
+ justifyContent: "center",
13218
+ alignItems: "center"
13219
+ }, /*#__PURE__*/React__default.createElement(Typography.Title, {
13220
+ level: "h5",
13221
+ style: {
13222
+ textAlign: 'center',
13223
+ marginRight: theme.__hd__.calendar.space.headerMarginRight
13224
+ }
13225
+ }, format('MMMM yyyy', visibleDate)), /*#__PURE__*/React__default.createElement(Icon, {
13226
+ icon: monthPickerVisible ? 'arrow-up' : 'arrow-down',
13227
+ size: "small"
13228
+ }))),
13229
+ onPreviousPress: onPreviousPress,
13230
+ onNextPress: onNextPress,
13231
+ onPress: useMonthPicker ? undefined : onTitlePress,
13232
+ previousDisabled: disablePrevButton,
13233
+ nextDisabled: disableNextButton,
13234
+ fontSize: "large"
13235
+ })), Platform.OS === 'ios' && monthPickerVisible ? /*#__PURE__*/React__default.createElement(Box, {
13236
+ style: {
13237
+ overflow: 'hidden'
13238
+ }
13239
+ }, /*#__PURE__*/React__default.createElement(MonthYearPickerViewIOS, {
13240
+ value: value === null || value === void 0 ? void 0 : value.startDate,
13241
+ minimumDate: minDate,
13242
+ maximumDate: maxDate,
13243
+ onChange: onMonthChange,
13244
+ style: {
13245
+ height: contentHeight + theme.__hd__.calendar.space.iosPickerMarginVertical * 2,
13246
+ marginVertical: -theme.__hd__.calendar.space.iosPickerMarginVertical,
13247
+ width: contentWidth
13248
+ }
13249
+ })) : /*#__PURE__*/React__default.createElement(Box, {
13250
+ onLayout: onLayout
13251
+ }, /*#__PURE__*/React__default.createElement(StyledCalendarRow, null, DAYS_OF_WEEK$1.map(function (day) {
13252
+ return /*#__PURE__*/React__default.createElement(StyledCalendarRowItem, {
13253
+ key: day
13254
+ }, /*#__PURE__*/React__default.createElement(StyledCalendarDayNameCell, {
13255
+ themeItemWidth: calendarItemWidth
13256
+ }, /*#__PURE__*/React__default.createElement(Typography.Body, {
13257
+ variant: "small"
13258
+ }, day)));
13259
+ })), /*#__PURE__*/React__default.createElement(StyledCalendarRow, null, daysOfPreviousMonth.map(function (date) {
13260
+ return renderDateCell({
13261
+ date: date,
13262
+ isCurrentMonth: false
13263
+ });
13264
+ }), daysOfCurrentMonth.map(function (date) {
13265
+ return renderDateCell({
13266
+ date: date,
13267
+ isCurrentMonth: true
13268
+ });
13269
+ }), daysOfNextMonth.map(function (date) {
13270
+ return renderDateCell({
13271
+ date: date,
13272
+ isCurrentMonth: false
13273
+ });
13274
+ })), Platform.OS === 'android' && monthPickerVisible && /*#__PURE__*/React__default.createElement(MonthYearPickerDialogueAndroid, {
13275
+ doneButtonLabel: monthPickerConfirmLabel,
13276
+ cancelButtonLabel: monthPickerCancelLabel,
13277
+ value: value === null || value === void 0 ? void 0 : value.startDate,
13278
+ minimumDate: minDate,
13279
+ maximumDate: maxDate,
13280
+ onChange: function onChange(action, date) {
13281
+ setMonthPickerVisible(false);
13282
+ onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(false);
13283
+ if (action === 'dateSetAction' && !!date) {
13284
+ onMonthChange(date);
13285
+ }
13286
+ }
13287
+ })));
13288
+ };
12969
13289
 
12970
13290
  var DAYS_OF_WEEK = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
12971
13291
  // Sunday first column => 0
@@ -13015,8 +13335,8 @@ var Calendar = function Calendar(_ref) {
13015
13335
  contentWidth = _useState6[0],
13016
13336
  setContentWidth = _useState6[1];
13017
13337
  var calendarItemWidth = useMemo(function () {
13018
- return contentWidth > 0 ? contentWidth / 7 : undefined;
13019
- }, [contentWidth]);
13338
+ return contentWidth > 0 ? Math.floor((contentWidth - theme.__hd__.calendar.space.cellPadding) / 7) : undefined;
13339
+ }, [contentWidth, theme]);
13020
13340
  var useMonthPicker = onMonthChange !== noop$1;
13021
13341
  var firstDateOfMonth = new Date(currentYear, currentMonth, 1);
13022
13342
  var lastDateOfMonth = new Date(currentYear, currentMonth + 1, 0);
@@ -13042,10 +13362,17 @@ var Calendar = function Calendar(_ref) {
13042
13362
  var disableNextButton = maxDate === undefined ? false : !daysOfNextMonth.some(function (date) {
13043
13363
  return date !== undefined;
13044
13364
  }) || maxDate <= lastDateOfMonth;
13365
+ var onLayout = function onLayout(e) {
13366
+ var _e$nativeEvent$layout = e.nativeEvent.layout,
13367
+ width = _e$nativeEvent$layout.width,
13368
+ height = _e$nativeEvent$layout.height;
13369
+ setContentHeight(height);
13370
+ setContentWidth(width);
13371
+ };
13045
13372
  return /*#__PURE__*/React__default.createElement(StyledContainer$7, {
13046
13373
  testID: testID
13047
13374
  }, /*#__PURE__*/React__default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__default.createElement(ContentNavigator, {
13048
- value: !useMonthPicker ? formatTime('MMMM yyyy', visibleDate) : /*#__PURE__*/React__default.createElement(TouchableOpacity, {
13375
+ value: !useMonthPicker ? format('MMMM yyyy', visibleDate) : /*#__PURE__*/React__default.createElement(TouchableOpacity, {
13049
13376
  testID: "calendar-month-picker",
13050
13377
  onPress: function onPress() {
13051
13378
  onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(!monthPickerVisible);
@@ -13061,7 +13388,7 @@ var Calendar = function Calendar(_ref) {
13061
13388
  textAlign: 'center',
13062
13389
  marginRight: theme.__hd__.calendar.space.headerMarginRight
13063
13390
  }
13064
- }, formatTime('MMMM yyyy', visibleDate)), /*#__PURE__*/React__default.createElement(Icon, {
13391
+ }, format('MMMM yyyy', visibleDate)), /*#__PURE__*/React__default.createElement(Icon, {
13065
13392
  icon: monthPickerVisible ? 'arrow-up' : 'arrow-down',
13066
13393
  size: "small"
13067
13394
  }))),
@@ -13086,13 +13413,7 @@ var Calendar = function Calendar(_ref) {
13086
13413
  width: contentWidth
13087
13414
  }
13088
13415
  })) : /*#__PURE__*/React__default.createElement(Box, {
13089
- onLayout: Platform.OS === 'ios' ? function (e) {
13090
- var _e$nativeEvent$layout = e.nativeEvent.layout,
13091
- width = _e$nativeEvent$layout.width,
13092
- height = _e$nativeEvent$layout.height;
13093
- setContentHeight(height);
13094
- setContentWidth(width);
13095
- } : undefined
13416
+ onLayout: onLayout
13096
13417
  }, /*#__PURE__*/React__default.createElement(StyledCalendarRow, null, DAYS_OF_WEEK.map(function (day) {
13097
13418
  return /*#__PURE__*/React__default.createElement(StyledCalendarRowItem, {
13098
13419
  key: day
@@ -13163,6 +13484,9 @@ var Calendar = function Calendar(_ref) {
13163
13484
  }
13164
13485
  })));
13165
13486
  };
13487
+ var Calendar$1 = Object.assign(Calendar, {
13488
+ Range: CalendarRange
13489
+ });
13166
13490
 
13167
13491
  var StyledDataCard = index$a(View)(function (_ref) {
13168
13492
  var theme = _ref.theme;
@@ -13574,7 +13898,7 @@ var StyledPageControlWrapper = index$a(View)(function (_ref7) {
13574
13898
  });
13575
13899
 
13576
13900
  function isCarouselImageProps(image) {
13577
- return _typeof$1(image) === 'object';
13901
+ return _typeof(image) === 'object';
13578
13902
  }
13579
13903
  var CarouselItem = function CarouselItem(_ref) {
13580
13904
  var width = _ref.width,
@@ -14509,7 +14833,7 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
14509
14833
  _useState2 = _slicedToArray(_useState, 2),
14510
14834
  open = _useState2[0],
14511
14835
  setOpen = _useState2[1];
14512
- var displayValue = value ? formatTime(displayFormat, value) : '';
14836
+ var displayValue = value ? format(displayFormat, value) : '';
14513
14837
  var pickerInitValue = value || new Date();
14514
14838
  useCalculateDate({
14515
14839
  minDate: minDate,
@@ -14578,7 +14902,7 @@ var InternalCalendar = function InternalCalendar(_ref) {
14578
14902
  _useState4 = _slicedToArray(_useState3, 2),
14579
14903
  selectingDate = _useState4[0],
14580
14904
  setSelectingDate = _useState4[1];
14581
- return /*#__PURE__*/React__default.createElement(Calendar, {
14905
+ return /*#__PURE__*/React__default.createElement(Calendar$1, {
14582
14906
  testID: "calendar",
14583
14907
  value: selectingDate,
14584
14908
  visibleDate: visibleDate,
@@ -14640,7 +14964,7 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
14640
14964
  _useState10 = _slicedToArray(_useState9, 2),
14641
14965
  selectingDate = _useState10[0],
14642
14966
  setSelectingDate = _useState10[1];
14643
- var displayValue = value ? formatTime(displayFormat, value) : '';
14967
+ var displayValue = value ? format(displayFormat, value) : '';
14644
14968
  useCalculateDate({
14645
14969
  minDate: minDate,
14646
14970
  maxDate: maxDate,
@@ -14733,7 +15057,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
14733
15057
  _useState4 = _slicedToArray(_useState3, 2),
14734
15058
  open = _useState4[0],
14735
15059
  setOpen = _useState4[1];
14736
- var displayValue = value ? formatTime(displayFormat, value) : '';
15060
+ var displayValue = value ? format(displayFormat, value) : '';
14737
15061
  var theme = useTheme();
14738
15062
  useCalculateDate({
14739
15063
  minDate: minDate,
@@ -19905,7 +20229,7 @@ var TimePickerAndroid = function TimePickerAndroid(_ref) {
19905
20229
  open = _useState2[0],
19906
20230
  setOpen = _useState2[1];
19907
20231
  var is12Hour = displayFormat.includes('hh');
19908
- var displayValue = value ? formatTime(displayFormat, value) : '';
20232
+ var displayValue = value ? format(displayFormat, value) : '';
19909
20233
  var pickerInitValue = value || new Date();
19910
20234
  return /*#__PURE__*/React__default.createElement(TouchableOpacity, {
19911
20235
  onPress: function onPress() {
@@ -19976,7 +20300,7 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
19976
20300
  open = _useState4[0],
19977
20301
  setOpen = _useState4[1];
19978
20302
  var is12Hour = displayFormat.includes('hh');
19979
- var displayValue = value ? formatTime(displayFormat, value) : '';
20303
+ var displayValue = value ? format(displayFormat, value) : '';
19980
20304
  var theme = useTheme();
19981
20305
  useEffect(function () {
19982
20306
  setSelectingDate(value || new Date());
@@ -20715,7 +21039,7 @@ function requireScheduler_production_min() {
20715
21039
  var c = a.sortIndex - b.sortIndex;
20716
21040
  return 0 !== c ? c : a.id - b.id;
20717
21041
  }
20718
- if ("object" === (typeof performance === "undefined" ? "undefined" : _typeof$1(performance)) && "function" === typeof performance.now) {
21042
+ if ("object" === (typeof performance === "undefined" ? "undefined" : _typeof(performance)) && "function" === typeof performance.now) {
20719
21043
  var l = performance;
20720
21044
  exports.unstable_now = function () {
20721
21045
  return l.now();
@@ -20886,7 +21210,7 @@ function requireScheduler_production_min() {
20886
21210
  };
20887
21211
  exports.unstable_scheduleCallback = function (a, b, c) {
20888
21212
  var d = exports.unstable_now();
20889
- "object" === _typeof$1(c) && null !== c ? (c = c.delay, c = "number" === typeof c && 0 < c ? d + c : d) : c = d;
21213
+ "object" === _typeof(c) && null !== c ? (c = c.delay, c = "number" === typeof c && 0 < c ? d + c : d) : c = d;
20890
21214
  switch (a) {
20891
21215
  case 1:
20892
21216
  var e = -1;
@@ -20976,7 +21300,7 @@ function requireReactDom_production_min() {
20976
21300
  }
20977
21301
  function pa(a, b, c, d) {
20978
21302
  if (null !== c && 0 === c.type) return !1;
20979
- switch (_typeof$1(b)) {
21303
+ switch (_typeof(b)) {
20980
21304
  case "function":
20981
21305
  case "symbol":
20982
21306
  return !0;
@@ -21086,7 +21410,7 @@ function requireReactDom_production_min() {
21086
21410
  var Ia = Symbol["for"]("react.offscreen");
21087
21411
  var Ja = Symbol.iterator;
21088
21412
  function Ka(a) {
21089
- if (null === a || "object" !== _typeof$1(a)) return null;
21413
+ if (null === a || "object" !== _typeof(a)) return null;
21090
21414
  a = Ja && a[Ja] || a["@@iterator"];
21091
21415
  return "function" === typeof a ? a : null;
21092
21416
  }
@@ -21115,7 +21439,7 @@ function requireReactDom_production_min() {
21115
21439
  set: function set() {
21116
21440
  throw Error();
21117
21441
  }
21118
- }), "object" === (typeof Reflect === "undefined" ? "undefined" : _typeof$1(Reflect)) && Reflect.construct) {
21442
+ }), "object" === (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && Reflect.construct) {
21119
21443
  try {
21120
21444
  Reflect.construct(b, []);
21121
21445
  } catch (l) {
@@ -21197,7 +21521,7 @@ function requireReactDom_production_min() {
21197
21521
  case Fa:
21198
21522
  return "SuspenseList";
21199
21523
  }
21200
- if ("object" === _typeof$1(a)) switch (a.$$typeof) {
21524
+ if ("object" === _typeof(a)) switch (a.$$typeof) {
21201
21525
  case Ca:
21202
21526
  return (a.displayName || "Context") + ".Consumer";
21203
21527
  case Ba:
@@ -21269,7 +21593,7 @@ function requireReactDom_production_min() {
21269
21593
  return null;
21270
21594
  }
21271
21595
  function Sa(a) {
21272
- switch (_typeof$1(a)) {
21596
+ switch (_typeof(a)) {
21273
21597
  case "boolean":
21274
21598
  case "number":
21275
21599
  case "string":
@@ -21580,9 +21904,9 @@ function requireReactDom_production_min() {
21580
21904
  if (tb[a] && (null != b.children || null != b.dangerouslySetInnerHTML)) throw Error(p(137, a));
21581
21905
  if (null != b.dangerouslySetInnerHTML) {
21582
21906
  if (null != b.children) throw Error(p(60));
21583
- if ("object" !== _typeof$1(b.dangerouslySetInnerHTML) || !("__html" in b.dangerouslySetInnerHTML)) throw Error(p(61));
21907
+ if ("object" !== _typeof(b.dangerouslySetInnerHTML) || !("__html" in b.dangerouslySetInnerHTML)) throw Error(p(61));
21584
21908
  }
21585
- if (null != b.style && "object" !== _typeof$1(b.style)) throw Error(p(62));
21909
+ if (null != b.style && "object" !== _typeof(b.style)) throw Error(p(62));
21586
21910
  }
21587
21911
  }
21588
21912
  function vb(a, b) {
@@ -21668,7 +21992,7 @@ function requireReactDom_production_min() {
21668
21992
  a = !1;
21669
21993
  }
21670
21994
  if (a) return null;
21671
- if (c && "function" !== typeof c) throw Error(p(231, b, _typeof$1(c)));
21995
+ if (c && "function" !== typeof c) throw Error(p(231, b, _typeof(c)));
21672
21996
  return c;
21673
21997
  }
21674
21998
  var Lb = !1;
@@ -22582,7 +22906,7 @@ function requireReactDom_production_min() {
22582
22906
  }
22583
22907
  function he(a) {
22584
22908
  a = a.detail;
22585
- return "object" === _typeof$1(a) && "data" in a ? a.data : null;
22909
+ return "object" === _typeof(a) && "data" in a ? a.data : null;
22586
22910
  }
22587
22911
  var ie = !1;
22588
22912
  function je(a, b) {
@@ -22699,7 +23023,7 @@ function requireReactDom_production_min() {
22699
23023
  var He = "function" === typeof Object.is ? Object.is : Ge;
22700
23024
  function Ie(a, b) {
22701
23025
  if (He(a, b)) return !0;
22702
- if ("object" !== _typeof$1(a) || null === a || "object" !== _typeof$1(b) || null === b) return !1;
23026
+ if ("object" !== _typeof(a) || null === a || "object" !== _typeof(b) || null === b) return !1;
22703
23027
  var c = Object.keys(a),
22704
23028
  d = Object.keys(b);
22705
23029
  if (c.length !== d.length) return !1;
@@ -23226,7 +23550,7 @@ function requireReactDom_production_min() {
23226
23550
  var Cf = null,
23227
23551
  Df = null;
23228
23552
  function Ef(a, b) {
23229
- 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;
23553
+ return "textarea" === a || "noscript" === a || "string" === typeof b.children || "number" === typeof b.children || "object" === _typeof(b.dangerouslySetInnerHTML) && null !== b.dangerouslySetInnerHTML && null != b.dangerouslySetInnerHTML.__html;
23230
23554
  }
23231
23555
  var Ff = "function" === typeof setTimeout ? setTimeout : void 0,
23232
23556
  Gf = "function" === typeof clearTimeout ? clearTimeout : void 0,
@@ -23874,7 +24198,7 @@ function requireReactDom_production_min() {
23874
24198
  var d = !1,
23875
24199
  e = Vf;
23876
24200
  var f = b.contextType;
23877
- "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);
24201
+ "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);
23878
24202
  b = new b(c, f);
23879
24203
  a.memoizedState = null !== b.state && void 0 !== b.state ? b.state : null;
23880
24204
  b.updater = nh;
@@ -23896,7 +24220,7 @@ function requireReactDom_production_min() {
23896
24220
  e.refs = jh;
23897
24221
  ah(a);
23898
24222
  var f = b.contextType;
23899
- "object" === _typeof$1(f) && null !== f ? e.context = Vg(f) : (f = Zf(b) ? Xf : H.current, e.context = Yf(a, f));
24223
+ "object" === _typeof(f) && null !== f ? e.context = Vg(f) : (f = Zf(b) ? Xf : H.current, e.context = Yf(a, f));
23900
24224
  e.state = a.memoizedState;
23901
24225
  f = b.getDerivedStateFromProps;
23902
24226
  "function" === typeof f && (kh(a, b, f, c), e.state = a.memoizedState);
@@ -23905,7 +24229,7 @@ function requireReactDom_production_min() {
23905
24229
  }
23906
24230
  function sh(a, b, c) {
23907
24231
  a = c.ref;
23908
- if (null !== a && "function" !== typeof a && "object" !== _typeof$1(a)) {
24232
+ if (null !== a && "function" !== typeof a && "object" !== _typeof(a)) {
23909
24233
  if (c._owner) {
23910
24234
  c = c._owner;
23911
24235
  if (c) {
@@ -23980,7 +24304,7 @@ function requireReactDom_production_min() {
23980
24304
  function k(a, b, c, d) {
23981
24305
  var f = c.type;
23982
24306
  if (f === ya) return m(a, b, c.props.children, d, c.key);
23983
- 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;
24307
+ 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;
23984
24308
  d = yh(c.type, c.key, c.props, null, a.mode, d);
23985
24309
  d.ref = sh(a, b, c);
23986
24310
  d["return"] = a;
@@ -24000,7 +24324,7 @@ function requireReactDom_production_min() {
24000
24324
  }
24001
24325
  function q(a, b, c) {
24002
24326
  if ("string" === typeof b && "" !== b || "number" === typeof b) return b = xh("" + b, a.mode, c), b["return"] = a, b;
24003
- if ("object" === _typeof$1(b) && null !== b) {
24327
+ if ("object" === _typeof(b) && null !== b) {
24004
24328
  switch (b.$$typeof) {
24005
24329
  case va:
24006
24330
  return c = yh(b.type, b.key, b.props, null, a.mode, c), c.ref = sh(a, null, b), c["return"] = a, c;
@@ -24018,7 +24342,7 @@ function requireReactDom_production_min() {
24018
24342
  function r(a, b, c, d) {
24019
24343
  var e = null !== b ? b.key : null;
24020
24344
  if ("string" === typeof c && "" !== c || "number" === typeof c) return null !== e ? null : h(a, b, "" + c, d);
24021
- if ("object" === _typeof$1(c) && null !== c) {
24345
+ if ("object" === _typeof(c) && null !== c) {
24022
24346
  switch (c.$$typeof) {
24023
24347
  case va:
24024
24348
  return c.key === e ? k(a, b, c, d) : null;
@@ -24034,7 +24358,7 @@ function requireReactDom_production_min() {
24034
24358
  }
24035
24359
  function y(a, b, c, d, e) {
24036
24360
  if ("string" === typeof d && "" !== d || "number" === typeof d) return a = a.get(c) || null, h(b, a, "" + d, e);
24037
- if ("object" === _typeof$1(d) && null !== d) {
24361
+ if ("object" === _typeof(d) && null !== d) {
24038
24362
  switch (d.$$typeof) {
24039
24363
  case va:
24040
24364
  return a = a.get(null === d.key ? c : d.key) || null, k(b, a, d, e);
@@ -24108,8 +24432,8 @@ function requireReactDom_production_min() {
24108
24432
  return l;
24109
24433
  }
24110
24434
  function J(a, d, f, h) {
24111
- "object" === _typeof$1(f) && null !== f && f.type === ya && null === f.key && (f = f.props.children);
24112
- if ("object" === _typeof$1(f) && null !== f) {
24435
+ "object" === _typeof(f) && null !== f && f.type === ya && null === f.key && (f = f.props.children);
24436
+ if ("object" === _typeof(f) && null !== f) {
24113
24437
  switch (f.$$typeof) {
24114
24438
  case va:
24115
24439
  a: {
@@ -24124,7 +24448,7 @@ function requireReactDom_production_min() {
24124
24448
  a = d;
24125
24449
  break a;
24126
24450
  }
24127
- } else if (l.elementType === k || "object" === _typeof$1(k) && null !== k && k.$$typeof === Ha && uh(k) === l.type) {
24451
+ } else if (l.elementType === k || "object" === _typeof(k) && null !== k && k.$$typeof === Ha && uh(k) === l.type) {
24128
24452
  c(a, l.sibling);
24129
24453
  d = e(l, f.props);
24130
24454
  d.ref = sh(a, l, f);
@@ -25009,7 +25333,7 @@ function requireReactDom_production_min() {
25009
25333
  g.props = h;
25010
25334
  var k = g.context,
25011
25335
  l = c.contextType;
25012
- "object" === _typeof$1(l) && null !== l ? l = Vg(l) : (l = Zf(c) ? Xf : H.current, l = Yf(b, l));
25336
+ "object" === _typeof(l) && null !== l ? l = Vg(l) : (l = Zf(c) ? Xf : H.current, l = Yf(b, l));
25013
25337
  var m = c.getDerivedStateFromProps,
25014
25338
  q = "function" === typeof m || "function" === typeof g.getSnapshotBeforeUpdate;
25015
25339
  q || "function" !== typeof g.UNSAFE_componentWillReceiveProps && "function" !== typeof g.componentWillReceiveProps || (h !== d || k !== l) && qh(b, g, d, l);
@@ -25028,7 +25352,7 @@ function requireReactDom_production_min() {
25028
25352
  q = b.pendingProps;
25029
25353
  r = g.context;
25030
25354
  k = c.contextType;
25031
- "object" === _typeof$1(k) && null !== k ? k = Vg(k) : (k = Zf(c) ? Xf : H.current, k = Yf(b, k));
25355
+ "object" === _typeof(k) && null !== k ? k = Vg(k) : (k = Zf(c) ? Xf : H.current, k = Yf(b, k));
25032
25356
  var y = c.getDerivedStateFromProps;
25033
25357
  (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);
25034
25358
  $g = !1;
@@ -26941,7 +27265,7 @@ function requireReactDom_production_min() {
26941
27265
  k = b;
26942
27266
  b = Z;
26943
27267
  h.flags |= 32768;
26944
- if (null !== k && "object" === _typeof$1(k) && "function" === typeof k.then) {
27268
+ if (null !== k && "object" === _typeof(k) && "function" === typeof k.then) {
26945
27269
  var l = k,
26946
27270
  m = h,
26947
27271
  q = m.tag;
@@ -27362,7 +27686,7 @@ function requireReactDom_production_min() {
27362
27686
  e = Xh(null, b, d, a, e, c);
27363
27687
  var f = bi();
27364
27688
  b.flags |= 1;
27365
- "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);
27689
+ "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);
27366
27690
  return b;
27367
27691
  case 16:
27368
27692
  d = b.elementType;
@@ -27603,7 +27927,7 @@ function requireReactDom_production_min() {
27603
27927
  case Ia:
27604
27928
  return qj(c, e, f, b);
27605
27929
  default:
27606
- if ("object" === _typeof$1(a) && null !== a) switch (a.$$typeof) {
27930
+ if ("object" === _typeof(a) && null !== a) switch (a.$$typeof) {
27607
27931
  case Ba:
27608
27932
  g = 10;
27609
27933
  break a;
@@ -27621,7 +27945,7 @@ function requireReactDom_production_min() {
27621
27945
  d = null;
27622
27946
  break a;
27623
27947
  }
27624
- throw Error(p(130, null == a ? a : _typeof$1(a), ""));
27948
+ throw Error(p(130, null == a ? a : _typeof(a), ""));
27625
27949
  }
27626
27950
  b = Bg(g, c, b, e);
27627
27951
  b.elementType = a;
@@ -28269,7 +28593,7 @@ function requireLib() {
28269
28593
  };
28270
28594
  },
28271
28595
  380: function _(e, t, r) {
28272
- var n = "object" == _typeof$1(r.g) && r.g && r.g.Object === Object && r.g;
28596
+ var n = "object" == _typeof(r.g) && r.g && r.g.Object === Object && r.g;
28273
28597
  e.exports = n;
28274
28598
  },
28275
28599
  903: function _(e, t, r) {
@@ -28297,7 +28621,7 @@ function requireLib() {
28297
28621
  },
28298
28622
  433: function _(e, t, r) {
28299
28623
  var n = r(380),
28300
- u = "object" == (typeof self === "undefined" ? "undefined" : _typeof$1(self)) && self && self.Object === Object && self,
28624
+ u = "object" == (typeof self === "undefined" ? "undefined" : _typeof(self)) && self && self.Object === Object && self,
28301
28625
  o = n || u || Function("return this")();
28302
28626
  e.exports = o;
28303
28627
  },
@@ -28366,20 +28690,20 @@ function requireLib() {
28366
28690
  },
28367
28691
  953: function _(e) {
28368
28692
  e.exports = function (e) {
28369
- var t = _typeof$1(e);
28693
+ var t = _typeof(e);
28370
28694
  return null != e && ("object" == t || "function" == t);
28371
28695
  };
28372
28696
  },
28373
28697
  934: function _(e) {
28374
28698
  e.exports = function (e) {
28375
- return null != e && "object" == _typeof$1(e);
28699
+ return null != e && "object" == _typeof(e);
28376
28700
  };
28377
28701
  },
28378
28702
  414: function _(e, t, r) {
28379
28703
  var n = r(148),
28380
28704
  u = r(934);
28381
28705
  e.exports = function (e) {
28382
- return "symbol" == _typeof$1(e) || u(e) && "[object Symbol]" == n(e);
28706
+ return "symbol" == _typeof(e) || u(e) && "[object Symbol]" == n(e);
28383
28707
  };
28384
28708
  },
28385
28709
  664: function _(e, t, r) {
@@ -28456,11 +28780,11 @@ function requireLib() {
28456
28780
  get: t[r]
28457
28781
  });
28458
28782
  }, u.g = function () {
28459
- if ("object" == (typeof globalThis === "undefined" ? "undefined" : _typeof$1(globalThis))) return globalThis;
28783
+ if ("object" == (typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis))) return globalThis;
28460
28784
  try {
28461
28785
  return this || new Function("return this")();
28462
28786
  } catch (e) {
28463
- if ("object" == (typeof window === "undefined" ? "undefined" : _typeof$1(window))) return window;
28787
+ if ("object" == (typeof window === "undefined" ? "undefined" : _typeof(window))) return window;
28464
28788
  }
28465
28789
  }(), u.o = function (e, t) {
28466
28790
  return Object.prototype.hasOwnProperty.call(e, t);
@@ -28582,7 +28906,7 @@ function requireLib() {
28582
28906
  }
28583
28907
  var h = Object.prototype.constructor.toString();
28584
28908
  function p(e) {
28585
- if (!e || "object" != _typeof$1(e)) return !1;
28909
+ if (!e || "object" != _typeof(e)) return !1;
28586
28910
  var t = c(e);
28587
28911
  if (null === t) return !0;
28588
28912
  var r = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
@@ -28879,7 +29203,7 @@ function requireLib() {
28879
29203
  }
28880
29204
  return k(_u4, r), R(n, _u4);
28881
29205
  }
28882
- if (!e || "object" != _typeof$1(e)) {
29206
+ if (!e || "object" != _typeof(e)) {
28883
29207
  if (n = t(e), void 0 === n && (n = e), n === a && (n = void 0), _this.autoFreeze_ && E(n, !0), r) {
28884
29208
  var _t6 = [],
28885
29209
  _u5 = [];
@@ -29157,10 +29481,10 @@ function requireLib() {
29157
29481
  }
29158
29482
  };
29159
29483
  function se(e) {
29160
- return se = "function" == typeof Symbol && "symbol" == _typeof$1(Symbol.iterator) ? function (e) {
29161
- return _typeof$1(e);
29484
+ return se = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
29485
+ return _typeof(e);
29162
29486
  } : function (e) {
29163
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof$1(e);
29487
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
29164
29488
  }, se(e);
29165
29489
  }
29166
29490
  function le(e, t, r) {
@@ -33844,7 +34168,7 @@ function requireLib() {
33844
34168
  Jt = u(858),
33845
34169
  Yt = u.n(Jt);
33846
34170
  var Zt = function Zt(e) {
33847
- return "object" == _typeof$1(e) && null != e && 1 === e.nodeType;
34171
+ return "object" == _typeof(e) && null != e && 1 === e.nodeType;
33848
34172
  },
33849
34173
  Gt = function Gt(e, t) {
33850
34174
  return (!t || "hidden" !== e) && "visible" !== e && "clip" !== e;
@@ -34064,10 +34388,10 @@ function requireLib() {
34064
34388
  "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);
34065
34389
  var Tr = (!Or || !xr) && !Ar && "undefined" != typeof globalThis && globalThis.InputEvent && "function" == typeof globalThis.InputEvent.prototype.getTargetRanges;
34066
34390
  function Mr(e) {
34067
- return Mr = "function" == typeof Symbol && "symbol" == _typeof$1(Symbol.iterator) ? function (e) {
34068
- return _typeof$1(e);
34391
+ return Mr = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
34392
+ return _typeof(e);
34069
34393
  } : function (e) {
34070
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof$1(e);
34394
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
34071
34395
  }, Mr(e);
34072
34396
  }
34073
34397
  function Rr(e, t, r) {
@@ -35140,10 +35464,10 @@ function requireLib() {
35140
35464
  return u;
35141
35465
  }
35142
35466
  function mu(e) {
35143
- return mu = "function" == typeof Symbol && "symbol" == _typeof$1(Symbol.iterator) ? function (e) {
35144
- return _typeof$1(e);
35467
+ return mu = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
35468
+ return _typeof(e);
35145
35469
  } : function (e) {
35146
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof$1(e);
35470
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
35147
35471
  }, mu(e);
35148
35472
  }
35149
35473
  function yu(e, t, r) {
@@ -36895,7 +37219,7 @@ function requireLib() {
36895
37219
  };
36896
37220
  }(e);
36897
37221
  if (function (e) {
36898
- return "object" == _typeof$1(e) && "function" == typeof e.behavior;
37222
+ return "object" == _typeof(e) && "function" == typeof e.behavior;
36899
37223
  }(t)) return t.behavior(rr(e, t));
36900
37224
  var n = "boolean" == typeof t || null == t ? void 0 : t.behavior;
36901
37225
  var _iterator47 = _createForOfIteratorHelper(rr(e, function (e) {
@@ -39240,10 +39564,6 @@ var RichTextEditor = function RichTextEditor(_ref) {
39240
39564
  _React$useState2 = _slicedToArray(_React$useState, 2),
39241
39565
  inputSize = _React$useState2[0],
39242
39566
  setInputSize = _React$useState2[1];
39243
- var _React$useState3 = React__default.useState(0),
39244
- _React$useState4 = _slicedToArray(_React$useState3, 2),
39245
- labelWidth = _React$useState4[0],
39246
- setLabelWidth = _React$useState4[1];
39247
39567
  var focusAnimation = useRef(new Animated.Value(0)).current;
39248
39568
  useEffect(function () {
39249
39569
  Animated.timing(focusAnimation, {
@@ -39264,10 +39584,6 @@ var RichTextEditor = function RichTextEditor(_ref) {
39264
39584
  });
39265
39585
  });
39266
39586
  }, []);
39267
- var onLabelLayout = useCallback(function (event) {
39268
- var width = event.nativeEvent.layout.width;
39269
- setLabelWidth(width);
39270
- }, []);
39271
39587
  useEffect(function () {
39272
39588
  var removeFocusListener = on(emitter, normalizeEventName('editor-focus'), function () {
39273
39589
  return setIsFocused(true);
@@ -39394,12 +39710,12 @@ var RichTextEditor = function RichTextEditor(_ref) {
39394
39710
  transform: [{
39395
39711
  translateY: focusAnimation.interpolate({
39396
39712
  inputRange: [0, 1],
39397
- outputRange: [inputSize.height / 2, 0]
39713
+ outputRange: [inputSize.height / 2, theme.space.xsmall]
39398
39714
  })
39399
39715
  }, {
39400
39716
  translateX: focusAnimation.interpolate({
39401
39717
  inputRange: [0, 1],
39402
- outputRange: [-inputSize.width / 2 + labelWidth / 2 + theme.space.large, -inputSize.width / 2 + labelWidth / 2 + theme.space.small]
39718
+ outputRange: [theme.space.medium, -theme.space.xlarge + theme.space.xsmall]
39403
39719
  })
39404
39720
  }, {
39405
39721
  scale: focusAnimation.interpolate({
@@ -39408,19 +39724,18 @@ var RichTextEditor = function RichTextEditor(_ref) {
39408
39724
  })
39409
39725
  }]
39410
39726
  }]
39411
- }, required && /*#__PURE__*/React__default.createElement(StyledAsteriskLabelInsideTextInput, {
39727
+ }, !!label && /*#__PURE__*/React__default.createElement(StyledLabelInsideTextInput, {
39412
39728
  style: {
39413
39729
  backgroundColor: theme.__hd__.textInput.colors.labelBackground
39414
39730
  },
39731
+ testID: "input-label",
39415
39732
  themeState: state
39416
- }, "*"), !!label && /*#__PURE__*/React__default.createElement(StyledLabelInsideTextInput, {
39733
+ }, required && /*#__PURE__*/React__default.createElement(StyledAsteriskLabelInsideTextInput, {
39417
39734
  style: {
39418
39735
  backgroundColor: theme.__hd__.textInput.colors.labelBackground
39419
39736
  },
39420
- testID: "input-label",
39421
- themeState: state,
39422
- onLayout: onLabelLayout
39423
- }, label)), /*#__PURE__*/React__default.createElement(StyledTextInputContainer, {
39737
+ themeState: state
39738
+ }, "*"), label)), /*#__PURE__*/React__default.createElement(StyledTextInputContainer, {
39424
39739
  onLayout: onLayout
39425
39740
  }, /*#__PURE__*/React__default.createElement(StyledBorderBackDrop, {
39426
39741
  themeState: state,
@@ -40029,4 +40344,4 @@ var FloatingIsland = function FloatingIsland(_ref2) {
40029
40344
  }));
40030
40345
  };
40031
40346
 
40032
- export { Accordion, Alert, AppCue, Attachment, index$9 as Avatar, Badge$1 as Badge, BottomNavigation, BottomSheet$1 as BottomSheet, Box, CompoundButton as Button, 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, ehWorkDarkPalette, getTheme$1 as getTheme, jobsSystemPalette, scale, swagDarkSystemPalette, swagLightJobsSystemPalette, swagSystemPalette as swagLightSystemPalette, swagSystemPalette$1 as swagSystemPalette, defaultTheme as theme, useAvatarColors, useTheme, walletSystemPalette, withTheme, workSystemPalette };
40347
+ 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, getTheme$1 as getTheme, jobsSystemPalette, scale, swagDarkSystemPalette, swagLightJobsSystemPalette, swagSystemPalette as swagLightSystemPalette, swagSystemPalette$1 as swagSystemPalette, defaultTheme as theme, useAvatarColors, useTheme, walletSystemPalette, withTheme, workSystemPalette };