@hero-design/rn 8.89.0-alpha.0 → 8.89.0-alpha.1

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 (41) hide show
  1. package/es/index.js +1450 -1077
  2. package/lib/index.js +1450 -1077
  3. package/package.json +1 -1
  4. package/src/components/Calendar/CalendarRange.tsx +337 -0
  5. package/src/components/Calendar/CalendarRangeConnector.tsx +68 -0
  6. package/src/components/Calendar/CalendarRowItem.tsx +14 -3
  7. package/src/components/Calendar/StyledCalendar.tsx +23 -9
  8. package/src/components/Calendar/__tests__/CalendarRange.spec.tsx +284 -0
  9. package/src/components/Calendar/__tests__/CalendarRangeConnector.spec.tsx +73 -0
  10. package/src/components/Calendar/__tests__/__snapshots__/CalendarRangeConnector.spec.tsx.snap +632 -0
  11. package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +45 -20
  12. package/src/components/Calendar/__tests__/helper.spec.ts +110 -1
  13. package/src/components/Calendar/helpers.ts +75 -0
  14. package/src/components/Calendar/index.tsx +19 -15
  15. package/src/components/RichTextEditor/RichTextEditor.tsx +14 -20
  16. package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +2 -4
  17. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +9 -4
  18. package/src/theme/components/calendar.ts +6 -1
  19. package/src/theme/global/colors/ehWorkDark.ts +5 -6
  20. package/src/types.ts +2 -0
  21. package/stats/8.88.0/rn-stats.html +0 -2
  22. package/types/components/Calendar/CalendarRowItem.d.ts +3 -1
  23. package/types/components/Calendar/StyledCalendar.d.ts +2 -1
  24. package/types/components/Calendar/helpers.d.ts +15 -0
  25. package/types/components/Calendar/index.d.ts +4 -2
  26. package/types/theme/components/calendar.d.ts +5 -0
  27. package/types/theme/global/colors/ehWorkDark.d.ts +3 -2
  28. package/types/types.d.ts +2 -1
  29. package/types/components/Calendar/CalendarRangeSelectedItem.d.ts +0 -11
  30. package/types/components/Calendar/Sample.d.ts +0 -13
  31. package/types/components/Calendar/hooks/useCalendarLayout.d.ts +0 -7
  32. package/types/components/Calendar/useSetUpCalendar.d.ts +0 -0
  33. package/types/components/CompoundSearch/CompoundSearchHandler.d.ts +0 -31
  34. package/types/components/CompoundSearch/CompoundSearchTextInput.d.ts +0 -60
  35. package/types/components/CompoundSearch/StyledCompoundSearch.d.ts +0 -40
  36. package/types/components/CompoundSearch/index.d.ts +0 -8
  37. package/types/components/CompoundSearch/utils.d.ts +0 -8
  38. package/types/components/FloatingIsland/SingleLine/StyledSingleLine.d.ts +0 -15
  39. package/types/components/FloatingIsland/SingleLine/index.d.ts +0 -24
  40. package/types/test-utils.d.ts +0 -4
  41. package/types/theme/components/compoundSearch.d.ts +0 -36
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,7 +2062,9 @@ var eBensBrandSystemPallete = {
2062
2062
  };
2063
2063
  var eBensSystemPalette = _objectSpread2(_objectSpread2({}, swagSystemPalette$1), eBensBrandSystemPallete);
2064
2064
 
2065
- var ehWorkDarkPalette = _objectSpread2(_objectSpread2({}, swagLightGlobalPalette), {}, {
2065
+ var ehWorkDarkPalette = {
2066
+ black: '#000000',
2067
+ white: '#ffffff',
2066
2068
  // Surface
2067
2069
  defaultGlobalSurface: '#27272A',
2068
2070
  neutralGlobalSurface: '#121214',
@@ -2073,7 +2075,7 @@ var ehWorkDarkPalette = _objectSpread2(_objectSpread2({}, swagLightGlobalPalette
2073
2075
  mutedOnDefaultGlobalSurface: '#a9a9b2',
2074
2076
  inactiveOnDefaultGlobalSurface: '#71717a',
2075
2077
  disabledOnDefaultGlobalSurface: '#52525b',
2076
- onOnDarkGlobalSurface: '#121214',
2078
+ onDarkGlobalSurface: '#121214',
2077
2079
  // Outline:
2078
2080
  primaryOutline: '#a9a9b2',
2079
2081
  secondaryOutline: '#3f3f46',
@@ -2089,7 +2091,7 @@ var ehWorkDarkPalette = _objectSpread2(_objectSpread2({}, swagLightGlobalPalette
2089
2091
  mutedError: '#9b2508',
2090
2092
  error: '#bd2d09',
2091
2093
  onErrorSurface: '#fecfca',
2092
- // Warming:
2094
+ // Warning:
2093
2095
  warningSurface: '#963e03',
2094
2096
  mutedWarning: '#c35004',
2095
2097
  warning: '#dc6204',
@@ -2110,13 +2112,13 @@ var ehWorkDarkPalette = _objectSpread2(_objectSpread2({}, swagLightGlobalPalette
2110
2112
  secondary: '#7622d7',
2111
2113
  onSecondary: '#ffffff',
2112
2114
  defaultSurface: '#fdfbff',
2113
- highlightedSurface: '#280541',
2115
+ highlightedSurface: '#460078',
2114
2116
  pressedSurface: '#9a58fc',
2115
2117
  decorativePrimary: '#fdfbff',
2116
2118
  decorativePrimarySurface: '#74409a',
2117
2119
  decorativeSecondary: '#fdfbff',
2118
2120
  decorativeSecondarySurface: '#f0e6ff'
2119
- });
2121
+ };
2120
2122
 
2121
2123
  var BASE_WIDTH = 390; // Based on iPhone 13's viewport size
2122
2124
  var horizontalScale = function horizontalScale(size) {
@@ -2684,9 +2686,13 @@ var getCalendarTheme = function getCalendarTheme(theme) {
2684
2686
  background: theme.colors.defaultGlobalSurface,
2685
2687
  border: theme.colors.primaryOutline,
2686
2688
  primary: theme.colors.primary,
2687
- inverted: theme.colors.onDarkGlobalSurface
2689
+ inverted: theme.colors.onDarkGlobalSurface,
2690
+ rowItem: {
2691
+ selected: theme.colors.primary,
2692
+ highlighted: theme.colors.highlightedSurface
2693
+ }
2688
2694
  };
2689
- var cellSize = theme.sizes.xxxlarge;
2695
+ var cellSize = theme.sizes.xxxxlarge;
2690
2696
  var markSize = theme.sizes.xsmall;
2691
2697
  var sizes = {
2692
2698
  cellWidth: cellSize,
@@ -2701,7 +2707,8 @@ var getCalendarTheme = function getCalendarTheme(theme) {
2701
2707
  headerVerticalPadding: theme.space.medium,
2702
2708
  headerHorizontalPadding: theme.space.smallMedium,
2703
2709
  headerMarginRight: theme.space.small,
2704
- iosPickerMarginVertical: theme.space['5xlarge']
2710
+ iosPickerMarginVertical: theme.space['5xlarge'],
2711
+ cellPadding: theme.space.xlarge
2705
2712
  };
2706
2713
  var radii = {
2707
2714
  "default": theme.radii.rounded
@@ -5951,7 +5958,7 @@ function requireCamelize() {
5951
5958
  return walk(obj);
5952
5959
  };
5953
5960
  function walk(obj) {
5954
- if (!obj || _typeof$1(obj) !== 'object') return obj;
5961
+ if (!obj || _typeof(obj) !== 'object') return obj;
5955
5962
  if (isDate(obj) || isRegex(obj)) return obj;
5956
5963
  if (isArray(obj)) return map(obj, walk);
5957
5964
  return reduce(objectKeys(obj), function (acc, key) {
@@ -6314,7 +6321,7 @@ function requireCssToReactNative() {
6314
6321
  value: true
6315
6322
  });
6316
6323
  function _interopDefault(ex) {
6317
- return ex && _typeof$1(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
6324
+ return ex && _typeof(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
6318
6325
  }
6319
6326
  var parse = requireLib$1();
6320
6327
  var parse__default = _interopDefault(parse);
@@ -7038,7 +7045,7 @@ var generated = {};
7038
7045
  var buffer = '';
7039
7046
  var lastType;
7040
7047
  function handleInterpolation(interpolation, i, arr) {
7041
- var type = _typeof$1(interpolation);
7048
+ var type = _typeof(interpolation);
7042
7049
  if (type === 'string') {
7043
7050
  // strip comments
7044
7051
  interpolation = interpolation.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '');
@@ -10573,59 +10580,12 @@ var BottomSheet$1 = Object.assign(BottomSheet, {
10573
10580
  ScrollView: BottomSheetScrollView
10574
10581
  });
10575
10582
 
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
10583
  function requiredArgs(required, args) {
10587
10584
  if (args.length < required) {
10588
10585
  throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
10589
10586
  }
10590
10587
  }
10591
10588
 
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
10589
  /**
10630
10590
  * @name toDate
10631
10591
  * @category Common Helpers
@@ -10656,11 +10616,11 @@ function isDate(value) {
10656
10616
  * const result = toDate(1392098430000)
10657
10617
  * //=> Tue Feb 11 2014 11:30:30
10658
10618
  */
10619
+
10659
10620
  function toDate(argument) {
10660
10621
  requiredArgs(1, arguments);
10661
- var argStr = Object.prototype.toString.call(argument);
10622
+ var argStr = Object.prototype.toString.call(argument); // Clone the date
10662
10623
 
10663
- // Clone the date
10664
10624
  if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
10665
10625
  // Prevent the date to lose the milliseconds when passed to new Date() in IE10
10666
10626
  return new Date(argument.getTime());
@@ -10669,8 +10629,8 @@ function toDate(argument) {
10669
10629
  } else {
10670
10630
  if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
10671
10631
  // 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
10632
+ 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
10633
+
10674
10634
  console.warn(new Error().stack);
10675
10635
  }
10676
10636
  return new Date(NaN);
@@ -10689,34 +10649,544 @@ function toDate(argument) {
10689
10649
  *
10690
10650
  * Time value of Date: http://es5.github.io/#x15.9.1.1
10691
10651
  *
10652
+ * ### v2.0.0 breaking changes:
10653
+ *
10654
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
10655
+ *
10656
+ * - Now `isValid` doesn't throw an exception
10657
+ * if the first argument is not an instance of Date.
10658
+ * Instead, argument is converted beforehand using `toDate`.
10659
+ *
10660
+ * Examples:
10661
+ *
10662
+ * | `isValid` argument | Before v2.0.0 | v2.0.0 onward |
10663
+ * |---------------------------|---------------|---------------|
10664
+ * | `new Date()` | `true` | `true` |
10665
+ * | `new Date('2016-01-01')` | `true` | `true` |
10666
+ * | `new Date('')` | `false` | `false` |
10667
+ * | `new Date(1488370835081)` | `true` | `true` |
10668
+ * | `new Date(NaN)` | `false` | `false` |
10669
+ * | `'2016-01-01'` | `TypeError` | `false` |
10670
+ * | `''` | `TypeError` | `false` |
10671
+ * | `1488370835081` | `TypeError` | `true` |
10672
+ * | `NaN` | `TypeError` | `false` |
10673
+ *
10674
+ * We introduce this change to make *date-fns* consistent with ECMAScript behavior
10675
+ * that try to coerce arguments to the expected type
10676
+ * (which is also the case with other *date-fns* functions).
10677
+ *
10692
10678
  * @param {*} date - the date to check
10693
10679
  * @returns {Boolean} the date is valid
10694
10680
  * @throws {TypeError} 1 argument required
10695
10681
  *
10696
10682
  * @example
10697
10683
  * // For the valid date:
10698
- * const result = isValid(new Date(2014, 1, 31))
10684
+ * var result = isValid(new Date(2014, 1, 31))
10699
10685
  * //=> true
10700
10686
  *
10701
10687
  * @example
10702
10688
  * // For the value, convertable into a date:
10703
- * const result = isValid(1393804800000)
10689
+ * var result = isValid(1393804800000)
10704
10690
  * //=> true
10705
10691
  *
10706
10692
  * @example
10707
10693
  * // For the invalid date:
10708
- * const result = isValid(new Date(''))
10694
+ * var result = isValid(new Date(''))
10709
10695
  * //=> false
10710
10696
  */
10697
+
10711
10698
  function isValid(dirtyDate) {
10712
10699
  requiredArgs(1, arguments);
10713
- if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
10714
- return false;
10715
- }
10716
10700
  var date = toDate(dirtyDate);
10717
- return !isNaN(Number(date));
10701
+ return !isNaN(date);
10702
+ }
10703
+
10704
+ var formatDistanceLocale = {
10705
+ lessThanXSeconds: {
10706
+ one: 'less than a second',
10707
+ other: 'less than {{count}} seconds'
10708
+ },
10709
+ xSeconds: {
10710
+ one: '1 second',
10711
+ other: '{{count}} seconds'
10712
+ },
10713
+ halfAMinute: 'half a minute',
10714
+ lessThanXMinutes: {
10715
+ one: 'less than a minute',
10716
+ other: 'less than {{count}} minutes'
10717
+ },
10718
+ xMinutes: {
10719
+ one: '1 minute',
10720
+ other: '{{count}} minutes'
10721
+ },
10722
+ aboutXHours: {
10723
+ one: 'about 1 hour',
10724
+ other: 'about {{count}} hours'
10725
+ },
10726
+ xHours: {
10727
+ one: '1 hour',
10728
+ other: '{{count}} hours'
10729
+ },
10730
+ xDays: {
10731
+ one: '1 day',
10732
+ other: '{{count}} days'
10733
+ },
10734
+ aboutXWeeks: {
10735
+ one: 'about 1 week',
10736
+ other: 'about {{count}} weeks'
10737
+ },
10738
+ xWeeks: {
10739
+ one: '1 week',
10740
+ other: '{{count}} weeks'
10741
+ },
10742
+ aboutXMonths: {
10743
+ one: 'about 1 month',
10744
+ other: 'about {{count}} months'
10745
+ },
10746
+ xMonths: {
10747
+ one: '1 month',
10748
+ other: '{{count}} months'
10749
+ },
10750
+ aboutXYears: {
10751
+ one: 'about 1 year',
10752
+ other: 'about {{count}} years'
10753
+ },
10754
+ xYears: {
10755
+ one: '1 year',
10756
+ other: '{{count}} years'
10757
+ },
10758
+ overXYears: {
10759
+ one: 'over 1 year',
10760
+ other: 'over {{count}} years'
10761
+ },
10762
+ almostXYears: {
10763
+ one: 'almost 1 year',
10764
+ other: 'almost {{count}} years'
10765
+ }
10766
+ };
10767
+ function formatDistance(token, count, options) {
10768
+ options = options || {};
10769
+ var result;
10770
+ if (typeof formatDistanceLocale[token] === 'string') {
10771
+ result = formatDistanceLocale[token];
10772
+ } else if (count === 1) {
10773
+ result = formatDistanceLocale[token].one;
10774
+ } else {
10775
+ result = formatDistanceLocale[token].other.replace('{{count}}', count);
10776
+ }
10777
+ if (options.addSuffix) {
10778
+ if (options.comparison > 0) {
10779
+ return 'in ' + result;
10780
+ } else {
10781
+ return result + ' ago';
10782
+ }
10783
+ }
10784
+ return result;
10785
+ }
10786
+
10787
+ function buildFormatLongFn(args) {
10788
+ return function (dirtyOptions) {
10789
+ var options = dirtyOptions || {};
10790
+ var width = options.width ? String(options.width) : args.defaultWidth;
10791
+ var format = args.formats[width] || args.formats[args.defaultWidth];
10792
+ return format;
10793
+ };
10794
+ }
10795
+
10796
+ var dateFormats = {
10797
+ full: 'EEEE, MMMM do, y',
10798
+ "long": 'MMMM do, y',
10799
+ medium: 'MMM d, y',
10800
+ "short": 'MM/dd/yyyy'
10801
+ };
10802
+ var timeFormats = {
10803
+ full: 'h:mm:ss a zzzz',
10804
+ "long": 'h:mm:ss a z',
10805
+ medium: 'h:mm:ss a',
10806
+ "short": 'h:mm a'
10807
+ };
10808
+ var dateTimeFormats = {
10809
+ full: "{{date}} 'at' {{time}}",
10810
+ "long": "{{date}} 'at' {{time}}",
10811
+ medium: '{{date}}, {{time}}',
10812
+ "short": '{{date}}, {{time}}'
10813
+ };
10814
+ var formatLong = {
10815
+ date: buildFormatLongFn({
10816
+ formats: dateFormats,
10817
+ defaultWidth: 'full'
10818
+ }),
10819
+ time: buildFormatLongFn({
10820
+ formats: timeFormats,
10821
+ defaultWidth: 'full'
10822
+ }),
10823
+ dateTime: buildFormatLongFn({
10824
+ formats: dateTimeFormats,
10825
+ defaultWidth: 'full'
10826
+ })
10827
+ };
10828
+
10829
+ var formatRelativeLocale = {
10830
+ lastWeek: "'last' eeee 'at' p",
10831
+ yesterday: "'yesterday at' p",
10832
+ today: "'today at' p",
10833
+ tomorrow: "'tomorrow at' p",
10834
+ nextWeek: "eeee 'at' p",
10835
+ other: 'P'
10836
+ };
10837
+ function formatRelative(token, _date, _baseDate, _options) {
10838
+ return formatRelativeLocale[token];
10839
+ }
10840
+
10841
+ function buildLocalizeFn(args) {
10842
+ return function (dirtyIndex, dirtyOptions) {
10843
+ var options = dirtyOptions || {};
10844
+ var context = options.context ? String(options.context) : 'standalone';
10845
+ var valuesArray;
10846
+ if (context === 'formatting' && args.formattingValues) {
10847
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
10848
+ var width = options.width ? String(options.width) : defaultWidth;
10849
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
10850
+ } else {
10851
+ var _defaultWidth = args.defaultWidth;
10852
+ var _width = options.width ? String(options.width) : args.defaultWidth;
10853
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
10854
+ }
10855
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
10856
+ return valuesArray[index];
10857
+ };
10858
+ }
10859
+
10860
+ var eraValues = {
10861
+ narrow: ['B', 'A'],
10862
+ abbreviated: ['BC', 'AD'],
10863
+ wide: ['Before Christ', 'Anno Domini']
10864
+ };
10865
+ var quarterValues = {
10866
+ narrow: ['1', '2', '3', '4'],
10867
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
10868
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter'] // Note: in English, the names of days of the week and months are capitalized.
10869
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
10870
+ // Generally, formatted dates should look like they are in the middle of a sentence,
10871
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
10872
+ };
10873
+
10874
+ var monthValues = {
10875
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
10876
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
10877
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
10878
+ };
10879
+ var dayValues = {
10880
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
10881
+ "short": ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
10882
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
10883
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
10884
+ };
10885
+ var dayPeriodValues = {
10886
+ narrow: {
10887
+ am: 'a',
10888
+ pm: 'p',
10889
+ midnight: 'mi',
10890
+ noon: 'n',
10891
+ morning: 'morning',
10892
+ afternoon: 'afternoon',
10893
+ evening: 'evening',
10894
+ night: 'night'
10895
+ },
10896
+ abbreviated: {
10897
+ am: 'AM',
10898
+ pm: 'PM',
10899
+ midnight: 'midnight',
10900
+ noon: 'noon',
10901
+ morning: 'morning',
10902
+ afternoon: 'afternoon',
10903
+ evening: 'evening',
10904
+ night: 'night'
10905
+ },
10906
+ wide: {
10907
+ am: 'a.m.',
10908
+ pm: 'p.m.',
10909
+ midnight: 'midnight',
10910
+ noon: 'noon',
10911
+ morning: 'morning',
10912
+ afternoon: 'afternoon',
10913
+ evening: 'evening',
10914
+ night: 'night'
10915
+ }
10916
+ };
10917
+ var formattingDayPeriodValues = {
10918
+ narrow: {
10919
+ am: 'a',
10920
+ pm: 'p',
10921
+ midnight: 'mi',
10922
+ noon: 'n',
10923
+ morning: 'in the morning',
10924
+ afternoon: 'in the afternoon',
10925
+ evening: 'in the evening',
10926
+ night: 'at night'
10927
+ },
10928
+ abbreviated: {
10929
+ am: 'AM',
10930
+ pm: 'PM',
10931
+ midnight: 'midnight',
10932
+ noon: 'noon',
10933
+ morning: 'in the morning',
10934
+ afternoon: 'in the afternoon',
10935
+ evening: 'in the evening',
10936
+ night: 'at night'
10937
+ },
10938
+ wide: {
10939
+ am: 'a.m.',
10940
+ pm: 'p.m.',
10941
+ midnight: 'midnight',
10942
+ noon: 'noon',
10943
+ morning: 'in the morning',
10944
+ afternoon: 'in the afternoon',
10945
+ evening: 'in the evening',
10946
+ night: 'at night'
10947
+ }
10948
+ };
10949
+ function ordinalNumber(dirtyNumber, _dirtyOptions) {
10950
+ var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
10951
+ // if they are different for different grammatical genders,
10952
+ // use `options.unit`:
10953
+ //
10954
+ // var options = dirtyOptions || {}
10955
+ // var unit = String(options.unit)
10956
+ //
10957
+ // where `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
10958
+ // 'day', 'hour', 'minute', 'second'
10959
+
10960
+ var rem100 = number % 100;
10961
+ if (rem100 > 20 || rem100 < 10) {
10962
+ switch (rem100 % 10) {
10963
+ case 1:
10964
+ return number + 'st';
10965
+ case 2:
10966
+ return number + 'nd';
10967
+ case 3:
10968
+ return number + 'rd';
10969
+ }
10970
+ }
10971
+ return number + 'th';
10972
+ }
10973
+ var localize = {
10974
+ ordinalNumber: ordinalNumber,
10975
+ era: buildLocalizeFn({
10976
+ values: eraValues,
10977
+ defaultWidth: 'wide'
10978
+ }),
10979
+ quarter: buildLocalizeFn({
10980
+ values: quarterValues,
10981
+ defaultWidth: 'wide',
10982
+ argumentCallback: function argumentCallback(quarter) {
10983
+ return Number(quarter) - 1;
10984
+ }
10985
+ }),
10986
+ month: buildLocalizeFn({
10987
+ values: monthValues,
10988
+ defaultWidth: 'wide'
10989
+ }),
10990
+ day: buildLocalizeFn({
10991
+ values: dayValues,
10992
+ defaultWidth: 'wide'
10993
+ }),
10994
+ dayPeriod: buildLocalizeFn({
10995
+ values: dayPeriodValues,
10996
+ defaultWidth: 'wide',
10997
+ formattingValues: formattingDayPeriodValues,
10998
+ defaultFormattingWidth: 'wide'
10999
+ })
11000
+ };
11001
+
11002
+ function buildMatchPatternFn(args) {
11003
+ return function (dirtyString, dirtyOptions) {
11004
+ var string = String(dirtyString);
11005
+ var options = dirtyOptions || {};
11006
+ var matchResult = string.match(args.matchPattern);
11007
+ if (!matchResult) {
11008
+ return null;
11009
+ }
11010
+ var matchedString = matchResult[0];
11011
+ var parseResult = string.match(args.parsePattern);
11012
+ if (!parseResult) {
11013
+ return null;
11014
+ }
11015
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
11016
+ value = options.valueCallback ? options.valueCallback(value) : value;
11017
+ return {
11018
+ value: value,
11019
+ rest: string.slice(matchedString.length)
11020
+ };
11021
+ };
11022
+ }
11023
+
11024
+ function buildMatchFn(args) {
11025
+ return function (dirtyString, dirtyOptions) {
11026
+ var string = String(dirtyString);
11027
+ var options = dirtyOptions || {};
11028
+ var width = options.width;
11029
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
11030
+ var matchResult = string.match(matchPattern);
11031
+ if (!matchResult) {
11032
+ return null;
11033
+ }
11034
+ var matchedString = matchResult[0];
11035
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
11036
+ var value;
11037
+ if (Object.prototype.toString.call(parsePatterns) === '[object Array]') {
11038
+ value = findIndex(parsePatterns, function (pattern) {
11039
+ return pattern.test(matchedString);
11040
+ });
11041
+ } else {
11042
+ value = findKey(parsePatterns, function (pattern) {
11043
+ return pattern.test(matchedString);
11044
+ });
11045
+ }
11046
+ value = args.valueCallback ? args.valueCallback(value) : value;
11047
+ value = options.valueCallback ? options.valueCallback(value) : value;
11048
+ return {
11049
+ value: value,
11050
+ rest: string.slice(matchedString.length)
11051
+ };
11052
+ };
11053
+ }
11054
+ function findKey(object, predicate) {
11055
+ for (var key in object) {
11056
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
11057
+ return key;
11058
+ }
11059
+ }
11060
+ }
11061
+ function findIndex(array, predicate) {
11062
+ for (var key = 0; key < array.length; key++) {
11063
+ if (predicate(array[key])) {
11064
+ return key;
11065
+ }
11066
+ }
10718
11067
  }
10719
11068
 
11069
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
11070
+ var parseOrdinalNumberPattern = /\d+/i;
11071
+ var matchEraPatterns = {
11072
+ narrow: /^(b|a)/i,
11073
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
11074
+ wide: /^(before christ|before common era|anno domini|common era)/i
11075
+ };
11076
+ var parseEraPatterns = {
11077
+ any: [/^b/i, /^(a|c)/i]
11078
+ };
11079
+ var matchQuarterPatterns = {
11080
+ narrow: /^[1234]/i,
11081
+ abbreviated: /^q[1234]/i,
11082
+ wide: /^[1234](th|st|nd|rd)? quarter/i
11083
+ };
11084
+ var parseQuarterPatterns = {
11085
+ any: [/1/i, /2/i, /3/i, /4/i]
11086
+ };
11087
+ var matchMonthPatterns = {
11088
+ narrow: /^[jfmasond]/i,
11089
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
11090
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
11091
+ };
11092
+ var parseMonthPatterns = {
11093
+ 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],
11094
+ 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]
11095
+ };
11096
+ var matchDayPatterns = {
11097
+ narrow: /^[smtwf]/i,
11098
+ "short": /^(su|mo|tu|we|th|fr|sa)/i,
11099
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
11100
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
11101
+ };
11102
+ var parseDayPatterns = {
11103
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
11104
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
11105
+ };
11106
+ var matchDayPeriodPatterns = {
11107
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
11108
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
11109
+ };
11110
+ var parseDayPeriodPatterns = {
11111
+ any: {
11112
+ am: /^a/i,
11113
+ pm: /^p/i,
11114
+ midnight: /^mi/i,
11115
+ noon: /^no/i,
11116
+ morning: /morning/i,
11117
+ afternoon: /afternoon/i,
11118
+ evening: /evening/i,
11119
+ night: /night/i
11120
+ }
11121
+ };
11122
+ var match = {
11123
+ ordinalNumber: buildMatchPatternFn({
11124
+ matchPattern: matchOrdinalNumberPattern,
11125
+ parsePattern: parseOrdinalNumberPattern,
11126
+ valueCallback: function valueCallback(value) {
11127
+ return parseInt(value, 10);
11128
+ }
11129
+ }),
11130
+ era: buildMatchFn({
11131
+ matchPatterns: matchEraPatterns,
11132
+ defaultMatchWidth: 'wide',
11133
+ parsePatterns: parseEraPatterns,
11134
+ defaultParseWidth: 'any'
11135
+ }),
11136
+ quarter: buildMatchFn({
11137
+ matchPatterns: matchQuarterPatterns,
11138
+ defaultMatchWidth: 'wide',
11139
+ parsePatterns: parseQuarterPatterns,
11140
+ defaultParseWidth: 'any',
11141
+ valueCallback: function valueCallback(index) {
11142
+ return index + 1;
11143
+ }
11144
+ }),
11145
+ month: buildMatchFn({
11146
+ matchPatterns: matchMonthPatterns,
11147
+ defaultMatchWidth: 'wide',
11148
+ parsePatterns: parseMonthPatterns,
11149
+ defaultParseWidth: 'any'
11150
+ }),
11151
+ day: buildMatchFn({
11152
+ matchPatterns: matchDayPatterns,
11153
+ defaultMatchWidth: 'wide',
11154
+ parsePatterns: parseDayPatterns,
11155
+ defaultParseWidth: 'any'
11156
+ }),
11157
+ dayPeriod: buildMatchFn({
11158
+ matchPatterns: matchDayPeriodPatterns,
11159
+ defaultMatchWidth: 'any',
11160
+ parsePatterns: parseDayPeriodPatterns,
11161
+ defaultParseWidth: 'any'
11162
+ })
11163
+ };
11164
+
11165
+ /**
11166
+ * @type {Locale}
11167
+ * @category Locales
11168
+ * @summary English locale (United States).
11169
+ * @language English
11170
+ * @iso-639-2 eng
11171
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
11172
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
11173
+ */
11174
+
11175
+ var locale = {
11176
+ code: 'en-US',
11177
+ formatDistance: formatDistance,
11178
+ formatLong: formatLong,
11179
+ formatRelative: formatRelative,
11180
+ localize: localize,
11181
+ match: match,
11182
+ options: {
11183
+ weekStartsOn: 0
11184
+ /* Sunday */,
11185
+
11186
+ firstWeekContainsDate: 1
11187
+ }
11188
+ };
11189
+
10720
11190
  function toInteger(dirtyNumber) {
10721
11191
  if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
10722
11192
  return NaN;
@@ -10736,6 +11206,10 @@ function toInteger(dirtyNumber) {
10736
11206
  * @description
10737
11207
  * Add the specified number of milliseconds to the given date.
10738
11208
  *
11209
+ * ### v2.0.0 breaking changes:
11210
+ *
11211
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
11212
+ *
10739
11213
  * @param {Date|Number} date - the date to be changed
10740
11214
  * @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
11215
  * @returns {Date} the new date with the milliseconds added
@@ -10743,9 +11217,10 @@ function toInteger(dirtyNumber) {
10743
11217
  *
10744
11218
  * @example
10745
11219
  * // 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)
11220
+ * var result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
10747
11221
  * //=> Thu Jul 10 2014 12:45:30.750
10748
11222
  */
11223
+
10749
11224
  function addMilliseconds(dirtyDate, dirtyAmount) {
10750
11225
  requiredArgs(2, arguments);
10751
11226
  var timestamp = toDate(dirtyDate).getTime();
@@ -10761,6 +11236,10 @@ function addMilliseconds(dirtyDate, dirtyAmount) {
10761
11236
  * @description
10762
11237
  * Subtract the specified number of milliseconds from the given date.
10763
11238
  *
11239
+ * ### v2.0.0 breaking changes:
11240
+ *
11241
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
11242
+ *
10764
11243
  * @param {Date|Number} date - the date to be changed
10765
11244
  * @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
11245
  * @returns {Date} the new date with the milliseconds subtracted
@@ -10768,29 +11247,121 @@ function addMilliseconds(dirtyDate, dirtyAmount) {
10768
11247
  *
10769
11248
  * @example
10770
11249
  * // 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)
11250
+ * var result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
10772
11251
  * //=> Thu Jul 10 2014 12:45:29.250
10773
11252
  */
11253
+
10774
11254
  function subMilliseconds(dirtyDate, dirtyAmount) {
10775
11255
  requiredArgs(2, arguments);
10776
11256
  var amount = toInteger(dirtyAmount);
10777
11257
  return addMilliseconds(dirtyDate, -amount);
10778
11258
  }
10779
11259
 
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
-
10792
- function startOfUTCISOWeek(dirtyDate) {
10793
- requiredArgs(1, arguments);
11260
+ function addLeadingZeros(number, targetLength) {
11261
+ var sign = number < 0 ? '-' : '';
11262
+ var output = Math.abs(number).toString();
11263
+ while (output.length < targetLength) {
11264
+ output = '0' + output;
11265
+ }
11266
+ return sign + output;
11267
+ }
11268
+
11269
+ /*
11270
+ * | | Unit | | Unit |
11271
+ * |-----|--------------------------------|-----|--------------------------------|
11272
+ * | a | AM, PM | A* | |
11273
+ * | d | Day of month | D | |
11274
+ * | h | Hour [1-12] | H | Hour [0-23] |
11275
+ * | m | Minute | M | Month |
11276
+ * | s | Second | S | Fraction of second |
11277
+ * | y | Year (abs) | Y | |
11278
+ *
11279
+ * Letters marked by * are not implemented but reserved by Unicode standard.
11280
+ */
11281
+
11282
+ var formatters$1 = {
11283
+ // Year
11284
+ y: function y(date, token) {
11285
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
11286
+ // | Year | y | yy | yyy | yyyy | yyyyy |
11287
+ // |----------|-------|----|-------|-------|-------|
11288
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
11289
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
11290
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
11291
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
11292
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
11293
+ var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
11294
+
11295
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
11296
+ return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
11297
+ },
11298
+ // Month
11299
+ M: function M(date, token) {
11300
+ var month = date.getUTCMonth();
11301
+ return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
11302
+ },
11303
+ // Day of the month
11304
+ d: function d(date, token) {
11305
+ return addLeadingZeros(date.getUTCDate(), token.length);
11306
+ },
11307
+ // AM or PM
11308
+ a: function a(date, token) {
11309
+ var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
11310
+ switch (token) {
11311
+ case 'a':
11312
+ case 'aa':
11313
+ case 'aaa':
11314
+ return dayPeriodEnumValue.toUpperCase();
11315
+ case 'aaaaa':
11316
+ return dayPeriodEnumValue[0];
11317
+ case 'aaaa':
11318
+ default:
11319
+ return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
11320
+ }
11321
+ },
11322
+ // Hour [1-12]
11323
+ h: function h(date, token) {
11324
+ return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
11325
+ },
11326
+ // Hour [0-23]
11327
+ H: function H(date, token) {
11328
+ return addLeadingZeros(date.getUTCHours(), token.length);
11329
+ },
11330
+ // Minute
11331
+ m: function m(date, token) {
11332
+ return addLeadingZeros(date.getUTCMinutes(), token.length);
11333
+ },
11334
+ // Second
11335
+ s: function s(date, token) {
11336
+ return addLeadingZeros(date.getUTCSeconds(), token.length);
11337
+ },
11338
+ // Fraction of second
11339
+ S: function S(date, token) {
11340
+ var numberOfDigits = token.length;
11341
+ var milliseconds = date.getUTCMilliseconds();
11342
+ var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
11343
+ return addLeadingZeros(fractionalSeconds, token.length);
11344
+ }
11345
+ };
11346
+
11347
+ var MILLISECONDS_IN_DAY = 86400000; // This function will be a part of public API when UTC function will be implemented.
11348
+ // See issue: https://github.com/date-fns/date-fns/issues/376
11349
+
11350
+ function getUTCDayOfYear(dirtyDate) {
11351
+ requiredArgs(1, arguments);
11352
+ var date = toDate(dirtyDate);
11353
+ var timestamp = date.getTime();
11354
+ date.setUTCMonth(0, 1);
11355
+ date.setUTCHours(0, 0, 0, 0);
11356
+ var startOfYearTimestamp = date.getTime();
11357
+ var difference = timestamp - startOfYearTimestamp;
11358
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
11359
+ }
11360
+
11361
+ // See issue: https://github.com/date-fns/date-fns/issues/376
11362
+
11363
+ function startOfUTCISOWeek(dirtyDate) {
11364
+ requiredArgs(1, arguments);
10794
11365
  var weekStartsOn = 1;
10795
11366
  var date = toDate(dirtyDate);
10796
11367
  var day = date.getUTCDay();
@@ -10800,6 +11371,8 @@ function startOfUTCISOWeek(dirtyDate) {
10800
11371
  return date;
10801
11372
  }
10802
11373
 
11374
+ // See issue: https://github.com/date-fns/date-fns/issues/376
11375
+
10803
11376
  function getUTCISOWeekYear(dirtyDate) {
10804
11377
  requiredArgs(1, arguments);
10805
11378
  var date = toDate(dirtyDate);
@@ -10821,6 +11394,8 @@ function getUTCISOWeekYear(dirtyDate) {
10821
11394
  }
10822
11395
  }
10823
11396
 
11397
+ // See issue: https://github.com/date-fns/date-fns/issues/376
11398
+
10824
11399
  function startOfUTCISOWeekYear(dirtyDate) {
10825
11400
  requiredArgs(1, arguments);
10826
11401
  var year = getUTCISOWeekYear(dirtyDate);
@@ -10831,30 +11406,29 @@ function startOfUTCISOWeekYear(dirtyDate) {
10831
11406
  return date;
10832
11407
  }
10833
11408
 
10834
- var MILLISECONDS_IN_WEEK$1 = 604800000;
11409
+ var MILLISECONDS_IN_WEEK$1 = 604800000; // This function will be a part of public API when UTC function will be implemented.
11410
+ // See issue: https://github.com/date-fns/date-fns/issues/376
11411
+
10835
11412
  function getUTCISOWeek(dirtyDate) {
10836
11413
  requiredArgs(1, arguments);
10837
11414
  var date = toDate(dirtyDate);
10838
- var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
10839
-
10840
- // Round the number of days to the nearest integer
11415
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer
10841
11416
  // because the number of milliseconds in a week is not constant
10842
11417
  // (e.g. it's different in the week of the daylight saving time clock shift)
11418
+
10843
11419
  return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
10844
11420
  }
10845
11421
 
10846
- var defaultOptions = {};
10847
- function getDefaultOptions() {
10848
- return defaultOptions;
10849
- }
11422
+ // See issue: https://github.com/date-fns/date-fns/issues/376
10850
11423
 
10851
- function startOfUTCWeek(dirtyDate, options) {
10852
- var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
11424
+ function startOfUTCWeek(dirtyDate, dirtyOptions) {
10853
11425
  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);
11426
+ var options = dirtyOptions || {};
11427
+ var locale = options.locale;
11428
+ var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;
11429
+ var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
11430
+ var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
10856
11431
 
10857
- // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
10858
11432
  if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
10859
11433
  throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
10860
11434
  }
@@ -10866,26 +11440,29 @@ function startOfUTCWeek(dirtyDate, options) {
10866
11440
  return date;
10867
11441
  }
10868
11442
 
10869
- function getUTCWeekYear(dirtyDate, options) {
10870
- var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
11443
+ // See issue: https://github.com/date-fns/date-fns/issues/376
11444
+
11445
+ function getUTCWeekYear(dirtyDate, dirtyOptions) {
10871
11446
  requiredArgs(1, arguments);
10872
- var date = toDate(dirtyDate);
11447
+ var date = toDate(dirtyDate, dirtyOptions);
10873
11448
  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);
11449
+ var options = dirtyOptions || {};
11450
+ var locale = options.locale;
11451
+ var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
11452
+ var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
11453
+ var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
10876
11454
 
10877
- // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
10878
11455
  if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
10879
11456
  throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
10880
11457
  }
10881
11458
  var firstWeekOfNextYear = new Date(0);
10882
11459
  firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
10883
11460
  firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
10884
- var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
11461
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, dirtyOptions);
10885
11462
  var firstWeekOfThisYear = new Date(0);
10886
11463
  firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
10887
11464
  firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
10888
- var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
11465
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, dirtyOptions);
10889
11466
  if (date.getTime() >= startOfNextYear.getTime()) {
10890
11467
  return year + 1;
10891
11468
  } else if (date.getTime() >= startOfThisYear.getTime()) {
@@ -10895,119 +11472,36 @@ function getUTCWeekYear(dirtyDate, options) {
10895
11472
  }
10896
11473
  }
10897
11474
 
10898
- function startOfUTCWeekYear(dirtyDate, options) {
10899
- var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
11475
+ // See issue: https://github.com/date-fns/date-fns/issues/376
11476
+
11477
+ function startOfUTCWeekYear(dirtyDate, dirtyOptions) {
10900
11478
  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);
11479
+ var options = dirtyOptions || {};
11480
+ var locale = options.locale;
11481
+ var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
11482
+ var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
11483
+ var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
11484
+ var year = getUTCWeekYear(dirtyDate, dirtyOptions);
10904
11485
  var firstWeek = new Date(0);
10905
11486
  firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
10906
11487
  firstWeek.setUTCHours(0, 0, 0, 0);
10907
- var date = startOfUTCWeek(firstWeek, options);
11488
+ var date = startOfUTCWeek(firstWeek, dirtyOptions);
10908
11489
  return date;
10909
11490
  }
10910
11491
 
10911
- var MILLISECONDS_IN_WEEK = 604800000;
11492
+ var MILLISECONDS_IN_WEEK = 604800000; // This function will be a part of public API when UTC function will be implemented.
11493
+ // See issue: https://github.com/date-fns/date-fns/issues/376
11494
+
10912
11495
  function getUTCWeek(dirtyDate, options) {
10913
11496
  requiredArgs(1, arguments);
10914
11497
  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
11498
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer
10918
11499
  // because the number of milliseconds in a week is not constant
10919
11500
  // (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
11501
 
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;
11502
+ return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
10930
11503
  }
10931
11504
 
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
11505
  var dayPeriodEnum = {
11012
11506
  am: 'am',
11013
11507
  pm: 'pm',
@@ -11017,52 +11511,52 @@ var dayPeriodEnum = {
11017
11511
  afternoon: 'afternoon',
11018
11512
  evening: 'evening',
11019
11513
  night: 'night'
11514
+ /*
11515
+ * | | Unit | | Unit |
11516
+ * |-----|--------------------------------|-----|--------------------------------|
11517
+ * | a | AM, PM | A* | Milliseconds in day |
11518
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
11519
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
11520
+ * | d | Day of month | D | Day of year |
11521
+ * | e | Local day of week | E | Day of week |
11522
+ * | f | | F* | Day of week in month |
11523
+ * | g* | Modified Julian day | G | Era |
11524
+ * | h | Hour [1-12] | H | Hour [0-23] |
11525
+ * | i! | ISO day of week | I! | ISO week of year |
11526
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
11527
+ * | k | Hour [1-24] | K | Hour [0-11] |
11528
+ * | l* | (deprecated) | L | Stand-alone month |
11529
+ * | m | Minute | M | Month |
11530
+ * | n | | N | |
11531
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
11532
+ * | p! | Long localized time | P! | Long localized date |
11533
+ * | q | Stand-alone quarter | Q | Quarter |
11534
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
11535
+ * | s | Second | S | Fraction of second |
11536
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
11537
+ * | u | Extended year | U* | Cyclic year |
11538
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
11539
+ * | w | Local week of year | W* | Week of month |
11540
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
11541
+ * | y | Year (abs) | Y | Local week-numbering year |
11542
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
11543
+ *
11544
+ * Letters marked by * are not implemented but reserved by Unicode standard.
11545
+ *
11546
+ * Letters marked by ! are non-standard, but implemented by date-fns:
11547
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
11548
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
11549
+ * i.e. 7 for Sunday, 1 for Monday, etc.
11550
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
11551
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
11552
+ * `R` is supposed to be used in conjunction with `I` and `i`
11553
+ * for universal ISO week-numbering date, whereas
11554
+ * `Y` is supposed to be used in conjunction with `w` and `e`
11555
+ * for week-numbering date specific to the locale.
11556
+ * - `P` is long localized date format
11557
+ * - `p` is long localized time format
11558
+ */
11020
11559
  };
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
11560
 
11067
11561
  var formatters = {
11068
11562
  // Era
@@ -11077,11 +11571,13 @@ var formatters = {
11077
11571
  width: 'abbreviated'
11078
11572
  });
11079
11573
  // A, B
11574
+
11080
11575
  case 'GGGGG':
11081
11576
  return localize.era(era, {
11082
11577
  width: 'narrow'
11083
11578
  });
11084
11579
  // Anno Domini, Before Christ
11580
+
11085
11581
  case 'GGGG':
11086
11582
  default:
11087
11583
  return localize.era(era, {
@@ -11093,8 +11589,8 @@ var formatters = {
11093
11589
  y: function y(date, token, localize) {
11094
11590
  // Ordinal number
11095
11591
  if (token === 'yo') {
11096
- var signedYear = date.getUTCFullYear();
11097
- // Returns 1 for 1 BC (which is year 0 in JavaScript)
11592
+ var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
11593
+
11098
11594
  var year = signedYear > 0 ? signedYear : 1 - signedYear;
11099
11595
  return localize.ordinalNumber(year, {
11100
11596
  unit: 'year'
@@ -11104,31 +11600,27 @@ var formatters = {
11104
11600
  },
11105
11601
  // Local week-numbering year
11106
11602
  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;
11603
+ var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)
11604
+
11605
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year
11110
11606
 
11111
- // Two digit year
11112
11607
  if (token === 'YY') {
11113
11608
  var twoDigitYear = weekYear % 100;
11114
11609
  return addLeadingZeros(twoDigitYear, 2);
11115
- }
11610
+ } // Ordinal number
11116
11611
 
11117
- // Ordinal number
11118
11612
  if (token === 'Yo') {
11119
11613
  return localize.ordinalNumber(weekYear, {
11120
11614
  unit: 'year'
11121
11615
  });
11122
- }
11616
+ } // Padding
11123
11617
 
11124
- // Padding
11125
11618
  return addLeadingZeros(weekYear, token.length);
11126
11619
  },
11127
11620
  // ISO week-numbering year
11128
11621
  R: function R(date, token) {
11129
- var isoWeekYear = getUTCISOWeekYear(date);
11622
+ var isoWeekYear = getUTCISOWeekYear(date); // Padding
11130
11623
 
11131
- // Padding
11132
11624
  return addLeadingZeros(isoWeekYear, token.length);
11133
11625
  },
11134
11626
  // Extended year. This is a single number designating the year of this calendar system.
@@ -11152,26 +11644,31 @@ var formatters = {
11152
11644
  case 'Q':
11153
11645
  return String(quarter);
11154
11646
  // 01, 02, 03, 04
11647
+
11155
11648
  case 'QQ':
11156
11649
  return addLeadingZeros(quarter, 2);
11157
11650
  // 1st, 2nd, 3rd, 4th
11651
+
11158
11652
  case 'Qo':
11159
11653
  return localize.ordinalNumber(quarter, {
11160
11654
  unit: 'quarter'
11161
11655
  });
11162
11656
  // Q1, Q2, Q3, Q4
11657
+
11163
11658
  case 'QQQ':
11164
11659
  return localize.quarter(quarter, {
11165
11660
  width: 'abbreviated',
11166
11661
  context: 'formatting'
11167
11662
  });
11168
11663
  // 1, 2, 3, 4 (narrow quarter; could be not numerical)
11664
+
11169
11665
  case 'QQQQQ':
11170
11666
  return localize.quarter(quarter, {
11171
11667
  width: 'narrow',
11172
11668
  context: 'formatting'
11173
11669
  });
11174
11670
  // 1st quarter, 2nd quarter, ...
11671
+
11175
11672
  case 'QQQQ':
11176
11673
  default:
11177
11674
  return localize.quarter(quarter, {
@@ -11188,26 +11685,31 @@ var formatters = {
11188
11685
  case 'q':
11189
11686
  return String(quarter);
11190
11687
  // 01, 02, 03, 04
11688
+
11191
11689
  case 'qq':
11192
11690
  return addLeadingZeros(quarter, 2);
11193
11691
  // 1st, 2nd, 3rd, 4th
11692
+
11194
11693
  case 'qo':
11195
11694
  return localize.ordinalNumber(quarter, {
11196
11695
  unit: 'quarter'
11197
11696
  });
11198
11697
  // Q1, Q2, Q3, Q4
11698
+
11199
11699
  case 'qqq':
11200
11700
  return localize.quarter(quarter, {
11201
11701
  width: 'abbreviated',
11202
11702
  context: 'standalone'
11203
11703
  });
11204
11704
  // 1, 2, 3, 4 (narrow quarter; could be not numerical)
11705
+
11205
11706
  case 'qqqqq':
11206
11707
  return localize.quarter(quarter, {
11207
11708
  width: 'narrow',
11208
11709
  context: 'standalone'
11209
11710
  });
11210
11711
  // 1st quarter, 2nd quarter, ...
11712
+
11211
11713
  case 'qqqq':
11212
11714
  default:
11213
11715
  return localize.quarter(quarter, {
@@ -11224,23 +11726,27 @@ var formatters = {
11224
11726
  case 'MM':
11225
11727
  return formatters$1.M(date, token);
11226
11728
  // 1st, 2nd, ..., 12th
11729
+
11227
11730
  case 'Mo':
11228
11731
  return localize.ordinalNumber(month + 1, {
11229
11732
  unit: 'month'
11230
11733
  });
11231
11734
  // Jan, Feb, ..., Dec
11735
+
11232
11736
  case 'MMM':
11233
11737
  return localize.month(month, {
11234
11738
  width: 'abbreviated',
11235
11739
  context: 'formatting'
11236
11740
  });
11237
11741
  // J, F, ..., D
11742
+
11238
11743
  case 'MMMMM':
11239
11744
  return localize.month(month, {
11240
11745
  width: 'narrow',
11241
11746
  context: 'formatting'
11242
11747
  });
11243
11748
  // January, February, ..., December
11749
+
11244
11750
  case 'MMMM':
11245
11751
  default:
11246
11752
  return localize.month(month, {
@@ -11257,26 +11763,31 @@ var formatters = {
11257
11763
  case 'L':
11258
11764
  return String(month + 1);
11259
11765
  // 01, 02, ..., 12
11766
+
11260
11767
  case 'LL':
11261
11768
  return addLeadingZeros(month + 1, 2);
11262
11769
  // 1st, 2nd, ..., 12th
11770
+
11263
11771
  case 'Lo':
11264
11772
  return localize.ordinalNumber(month + 1, {
11265
11773
  unit: 'month'
11266
11774
  });
11267
11775
  // Jan, Feb, ..., Dec
11776
+
11268
11777
  case 'LLL':
11269
11778
  return localize.month(month, {
11270
11779
  width: 'abbreviated',
11271
11780
  context: 'standalone'
11272
11781
  });
11273
11782
  // J, F, ..., D
11783
+
11274
11784
  case 'LLLLL':
11275
11785
  return localize.month(month, {
11276
11786
  width: 'narrow',
11277
11787
  context: 'standalone'
11278
11788
  });
11279
11789
  // January, February, ..., December
11790
+
11280
11791
  case 'LLLL':
11281
11792
  default:
11282
11793
  return localize.month(month, {
@@ -11337,18 +11848,21 @@ var formatters = {
11337
11848
  context: 'formatting'
11338
11849
  });
11339
11850
  // T
11851
+
11340
11852
  case 'EEEEE':
11341
11853
  return localize.day(dayOfWeek, {
11342
11854
  width: 'narrow',
11343
11855
  context: 'formatting'
11344
11856
  });
11345
11857
  // Tu
11858
+
11346
11859
  case 'EEEEEE':
11347
11860
  return localize.day(dayOfWeek, {
11348
11861
  width: 'short',
11349
11862
  context: 'formatting'
11350
11863
  });
11351
11864
  // Tuesday
11865
+
11352
11866
  case 'EEEE':
11353
11867
  default:
11354
11868
  return localize.day(dayOfWeek, {
@@ -11366,9 +11880,11 @@ var formatters = {
11366
11880
  case 'e':
11367
11881
  return String(localDayOfWeek);
11368
11882
  // Padded numerical value
11883
+
11369
11884
  case 'ee':
11370
11885
  return addLeadingZeros(localDayOfWeek, 2);
11371
11886
  // 1st, 2nd, ..., 7th
11887
+
11372
11888
  case 'eo':
11373
11889
  return localize.ordinalNumber(localDayOfWeek, {
11374
11890
  unit: 'day'
@@ -11379,18 +11895,21 @@ var formatters = {
11379
11895
  context: 'formatting'
11380
11896
  });
11381
11897
  // T
11898
+
11382
11899
  case 'eeeee':
11383
11900
  return localize.day(dayOfWeek, {
11384
11901
  width: 'narrow',
11385
11902
  context: 'formatting'
11386
11903
  });
11387
11904
  // Tu
11905
+
11388
11906
  case 'eeeeee':
11389
11907
  return localize.day(dayOfWeek, {
11390
11908
  width: 'short',
11391
11909
  context: 'formatting'
11392
11910
  });
11393
11911
  // Tuesday
11912
+
11394
11913
  case 'eeee':
11395
11914
  default:
11396
11915
  return localize.day(dayOfWeek, {
@@ -11408,9 +11927,11 @@ var formatters = {
11408
11927
  case 'c':
11409
11928
  return String(localDayOfWeek);
11410
11929
  // Padded numerical value
11930
+
11411
11931
  case 'cc':
11412
11932
  return addLeadingZeros(localDayOfWeek, token.length);
11413
11933
  // 1st, 2nd, ..., 7th
11934
+
11414
11935
  case 'co':
11415
11936
  return localize.ordinalNumber(localDayOfWeek, {
11416
11937
  unit: 'day'
@@ -11421,18 +11942,21 @@ var formatters = {
11421
11942
  context: 'standalone'
11422
11943
  });
11423
11944
  // T
11945
+
11424
11946
  case 'ccccc':
11425
11947
  return localize.day(dayOfWeek, {
11426
11948
  width: 'narrow',
11427
11949
  context: 'standalone'
11428
11950
  });
11429
11951
  // Tu
11952
+
11430
11953
  case 'cccccc':
11431
11954
  return localize.day(dayOfWeek, {
11432
11955
  width: 'short',
11433
11956
  context: 'standalone'
11434
11957
  });
11435
11958
  // Tuesday
11959
+
11436
11960
  case 'cccc':
11437
11961
  default:
11438
11962
  return localize.day(dayOfWeek, {
@@ -11450,32 +11974,38 @@ var formatters = {
11450
11974
  case 'i':
11451
11975
  return String(isoDayOfWeek);
11452
11976
  // 02
11977
+
11453
11978
  case 'ii':
11454
11979
  return addLeadingZeros(isoDayOfWeek, token.length);
11455
11980
  // 2nd
11981
+
11456
11982
  case 'io':
11457
11983
  return localize.ordinalNumber(isoDayOfWeek, {
11458
11984
  unit: 'day'
11459
11985
  });
11460
11986
  // Tue
11987
+
11461
11988
  case 'iii':
11462
11989
  return localize.day(dayOfWeek, {
11463
11990
  width: 'abbreviated',
11464
11991
  context: 'formatting'
11465
11992
  });
11466
11993
  // T
11994
+
11467
11995
  case 'iiiii':
11468
11996
  return localize.day(dayOfWeek, {
11469
11997
  width: 'narrow',
11470
11998
  context: 'formatting'
11471
11999
  });
11472
12000
  // Tu
12001
+
11473
12002
  case 'iiiiii':
11474
12003
  return localize.day(dayOfWeek, {
11475
12004
  width: 'short',
11476
12005
  context: 'formatting'
11477
12006
  });
11478
12007
  // Tuesday
12008
+
11479
12009
  case 'iiii':
11480
12010
  default:
11481
12011
  return localize.day(dayOfWeek, {
@@ -11491,15 +12021,11 @@ var formatters = {
11491
12021
  switch (token) {
11492
12022
  case 'a':
11493
12023
  case 'aa':
11494
- return localize.dayPeriod(dayPeriodEnumValue, {
11495
- width: 'abbreviated',
11496
- context: 'formatting'
11497
- });
11498
12024
  case 'aaa':
11499
12025
  return localize.dayPeriod(dayPeriodEnumValue, {
11500
12026
  width: 'abbreviated',
11501
12027
  context: 'formatting'
11502
- }).toLowerCase();
12028
+ });
11503
12029
  case 'aaaaa':
11504
12030
  return localize.dayPeriod(dayPeriodEnumValue, {
11505
12031
  width: 'narrow',
@@ -11527,15 +12053,11 @@ var formatters = {
11527
12053
  switch (token) {
11528
12054
  case 'b':
11529
12055
  case 'bb':
11530
- return localize.dayPeriod(dayPeriodEnumValue, {
11531
- width: 'abbreviated',
11532
- context: 'formatting'
11533
- });
11534
12056
  case 'bbb':
11535
12057
  return localize.dayPeriod(dayPeriodEnumValue, {
11536
12058
  width: 'abbreviated',
11537
12059
  context: 'formatting'
11538
- }).toLowerCase();
12060
+ });
11539
12061
  case 'bbbbb':
11540
12062
  return localize.dayPeriod(dayPeriodEnumValue, {
11541
12063
  width: 'narrow',
@@ -11657,20 +12179,21 @@ var formatters = {
11657
12179
  // Hours and optional minutes
11658
12180
  case 'X':
11659
12181
  return formatTimezoneWithOptionalMinutes(timezoneOffset);
11660
-
11661
12182
  // Hours, minutes and optional seconds without `:` delimiter
11662
12183
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
11663
12184
  // so this token always has the same output as `XX`
12185
+
11664
12186
  case 'XXXX':
11665
12187
  case 'XX':
11666
12188
  // Hours and minutes without `:` delimiter
11667
12189
  return formatTimezone(timezoneOffset);
11668
-
11669
12190
  // Hours, minutes and optional seconds with `:` delimiter
11670
12191
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
11671
12192
  // so this token always has the same output as `XXX`
12193
+
11672
12194
  case 'XXXXX':
11673
12195
  case 'XXX': // Hours and minutes with `:` delimiter
12196
+
11674
12197
  default:
11675
12198
  return formatTimezone(timezoneOffset, ':');
11676
12199
  }
@@ -11683,20 +12206,21 @@ var formatters = {
11683
12206
  // Hours and optional minutes
11684
12207
  case 'x':
11685
12208
  return formatTimezoneWithOptionalMinutes(timezoneOffset);
11686
-
11687
12209
  // Hours, minutes and optional seconds without `:` delimiter
11688
12210
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
11689
12211
  // so this token always has the same output as `xx`
12212
+
11690
12213
  case 'xxxx':
11691
12214
  case 'xx':
11692
12215
  // Hours and minutes without `:` delimiter
11693
12216
  return formatTimezone(timezoneOffset);
11694
-
11695
12217
  // Hours, minutes and optional seconds with `:` delimiter
11696
12218
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
11697
12219
  // so this token always has the same output as `xxx`
12220
+
11698
12221
  case 'xxxxx':
11699
12222
  case 'xxx': // Hours and minutes with `:` delimiter
12223
+
11700
12224
  default:
11701
12225
  return formatTimezone(timezoneOffset, ':');
11702
12226
  }
@@ -11712,661 +12236,193 @@ var formatters = {
11712
12236
  case 'OOO':
11713
12237
  return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
11714
12238
  // Long
12239
+
11715
12240
  case 'OOOO':
11716
12241
  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;
12242
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
12243
+ }
12244
+ },
12245
+ // Timezone (specific non-location)
12246
+ z: function z(date, token, _localize, options) {
12247
+ var originalDate = options._originalDate || date;
12248
+ var timezoneOffset = originalDate.getTimezoneOffset();
12249
+ switch (token) {
12250
+ // Short
12251
+ case 'z':
12252
+ case 'zz':
12253
+ case 'zzz':
12254
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
12255
+ // Long
12256
+
12257
+ case 'zzzz':
12258
+ default:
12259
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
12222
12260
  }
12261
+ },
12262
+ // Seconds timestamp
12263
+ t: function t(date, token, _localize, options) {
12264
+ var originalDate = options._originalDate || date;
12265
+ var timestamp = Math.floor(originalDate.getTime() / 1000);
12266
+ return addLeadingZeros(timestamp, token.length);
12267
+ },
12268
+ // Milliseconds timestamp
12269
+ T: function T(date, token, _localize, options) {
12270
+ var originalDate = options._originalDate || date;
12271
+ var timestamp = originalDate.getTime();
12272
+ return addLeadingZeros(timestamp, token.length);
12223
12273
  }
12224
- return undefined;
12274
+ };
12275
+ function formatTimezoneShort(offset, dirtyDelimiter) {
12276
+ var sign = offset > 0 ? '-' : '+';
12277
+ var absOffset = Math.abs(offset);
12278
+ var hours = Math.floor(absOffset / 60);
12279
+ var minutes = absOffset % 60;
12280
+ if (minutes === 0) {
12281
+ return sign + String(hours);
12282
+ }
12283
+ var delimiter = dirtyDelimiter;
12284
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
12225
12285
  }
12226
- function findIndex(array, predicate) {
12227
- for (var key = 0; key < array.length; key++) {
12228
- if (predicate(array[key])) {
12229
- return key;
12230
- }
12286
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
12287
+ if (offset % 60 === 0) {
12288
+ var sign = offset > 0 ? '-' : '+';
12289
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
12231
12290
  }
12232
- return undefined;
12291
+ return formatTimezone(offset, dirtyDelimiter);
12233
12292
  }
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
- };
12293
+ function formatTimezone(offset, dirtyDelimiter) {
12294
+ var delimiter = dirtyDelimiter || '';
12295
+ var sign = offset > 0 ? '-' : '+';
12296
+ var absOffset = Math.abs(offset);
12297
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
12298
+ var minutes = addLeadingZeros(absOffset % 60, 2);
12299
+ return sign + hours + delimiter + minutes;
12251
12300
  }
12252
12301
 
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
12302
+ function dateLongFormatter(pattern, formatLong) {
12303
+ switch (pattern) {
12304
+ case 'P':
12305
+ return formatLong.date({
12306
+ width: 'short'
12307
+ });
12308
+ case 'PP':
12309
+ return formatLong.date({
12310
+ width: 'medium'
12311
+ });
12312
+ case 'PPP':
12313
+ return formatLong.date({
12314
+ width: 'long'
12315
+ });
12316
+ case 'PPPP':
12317
+ default:
12318
+ return formatLong.date({
12319
+ width: 'full'
12320
+ });
12304
12321
  }
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
- })
12322
+ }
12323
+ function timeLongFormatter(pattern, formatLong) {
12324
+ switch (pattern) {
12325
+ case 'p':
12326
+ return formatLong.time({
12327
+ width: 'short'
12328
+ });
12329
+ case 'pp':
12330
+ return formatLong.time({
12331
+ width: 'medium'
12332
+ });
12333
+ case 'ppp':
12334
+ return formatLong.time({
12335
+ width: 'long'
12336
+ });
12337
+ case 'pppp':
12338
+ default:
12339
+ return formatLong.time({
12340
+ width: 'full'
12341
+ });
12342
+ }
12343
+ }
12344
+ function dateTimeLongFormatter(pattern, formatLong) {
12345
+ var matchResult = pattern.match(/(P+)(p+)?/);
12346
+ var datePattern = matchResult[1];
12347
+ var timePattern = matchResult[2];
12348
+ if (!timePattern) {
12349
+ return dateLongFormatter(pattern, formatLong);
12350
+ }
12351
+ var dateTimeFormat;
12352
+ switch (datePattern) {
12353
+ case 'P':
12354
+ dateTimeFormat = formatLong.dateTime({
12355
+ width: 'short'
12356
+ });
12357
+ break;
12358
+ case 'PP':
12359
+ dateTimeFormat = formatLong.dateTime({
12360
+ width: 'medium'
12361
+ });
12362
+ break;
12363
+ case 'PPP':
12364
+ dateTimeFormat = formatLong.dateTime({
12365
+ width: 'long'
12366
+ });
12367
+ break;
12368
+ case 'PPPP':
12369
+ default:
12370
+ dateTimeFormat = formatLong.dateTime({
12371
+ width: 'full'
12372
+ });
12373
+ break;
12374
+ }
12375
+ return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
12376
+ }
12377
+ var longFormatters = {
12378
+ p: timeLongFormatter,
12379
+ P: dateTimeLongFormatter
12347
12380
  };
12348
12381
 
12382
+ var MILLISECONDS_IN_MINUTE = 60000;
12383
+ function getDateMillisecondsPart(date) {
12384
+ return date.getTime() % MILLISECONDS_IN_MINUTE;
12385
+ }
12349
12386
  /**
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}
12387
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
12388
+ * They usually appear for dates that denote time before the timezones were introduced
12389
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
12390
+ * and GMT+01:00:00 after that date)
12391
+ *
12392
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
12393
+ * which would lead to incorrect calculations.
12394
+ *
12395
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
12357
12396
  */
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
12397
+
12398
+ function getTimezoneOffsetInMilliseconds(dirtyDate) {
12399
+ var date = new Date(dirtyDate.getTime());
12400
+ var baseTimezoneOffset = Math.ceil(date.getTimezoneOffset());
12401
+ date.setSeconds(0, 0);
12402
+ var hasNegativeUTCOffset = baseTimezoneOffset > 0;
12403
+ var millisecondsPartOfTimezoneOffset = hasNegativeUTCOffset ? (MILLISECONDS_IN_MINUTE + getDateMillisecondsPart(date)) % MILLISECONDS_IN_MINUTE : getDateMillisecondsPart(date);
12404
+ return baseTimezoneOffset * MILLISECONDS_IN_MINUTE + millisecondsPartOfTimezoneOffset;
12405
+ }
12406
+
12407
+ var protectedDayOfYearTokens = ['D', 'DD'];
12408
+ var protectedWeekYearTokens = ['YY', 'YYYY'];
12409
+ function isProtectedDayOfYearToken(token) {
12410
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
12411
+ }
12412
+ function isProtectedWeekYearToken(token) {
12413
+ return protectedWeekYearTokens.indexOf(token) !== -1;
12414
+ }
12415
+ function throwProtectedError(token, format, input) {
12416
+ if (token === 'YYYY') {
12417
+ throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
12418
+ } else if (token === 'YY') {
12419
+ throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
12420
+ } else if (token === 'D') {
12421
+ 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"));
12422
+ } else if (token === 'DD') {
12423
+ 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
12424
  }
12369
- };
12425
+ }
12370
12426
 
12371
12427
  // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
12372
12428
  // (one of the certain letters followed by `o`)
@@ -12378,15 +12434,14 @@ var locale = {
12378
12434
  // If there is no matching single quote
12379
12435
  // then the sequence will continue until the end of the string.
12380
12436
  // - . matches any single character unmatched by previous parts of the RegExps
12381
- var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
12382
12437
 
12383
- // This RegExp catches symbols escaped by quotes, and also
12438
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also
12384
12439
  // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
12440
+
12385
12441
  var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
12386
12442
  var escapedStringRegExp = /^'([^]*?)'?$/;
12387
12443
  var doubleQuoteRegExp = /''/g;
12388
12444
  var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12389
-
12390
12445
  /**
12391
12446
  * @name format
12392
12447
  * @category Common Helpers
@@ -12396,7 +12451,7 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12396
12451
  * Return the formatted date string in the given format. The result may vary by locale.
12397
12452
  *
12398
12453
  * > ⚠️ 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
12454
+ * > See: https://git.io/fxCyr
12400
12455
  *
12401
12456
  * The characters wrapped between two single quotes characters (') are escaped.
12402
12457
  * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
@@ -12475,34 +12530,32 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12475
12530
  * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
12476
12531
  * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
12477
12532
  * | | EEEEE | M, T, W, T, F, S, S | |
12478
- * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
12533
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |
12479
12534
  * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
12480
12535
  * | | io | 1st, 2nd, ..., 7th | 7 |
12481
12536
  * | | ii | 01, 02, ..., 07 | 7 |
12482
12537
  * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
12483
12538
  * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
12484
12539
  * | | iiiii | M, T, W, T, F, S, S | 7 |
12485
- * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
12540
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 |
12486
12541
  * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
12487
12542
  * | | eo | 2nd, 3rd, ..., 1st | 7 |
12488
12543
  * | | ee | 02, 03, ..., 01 | |
12489
12544
  * | | eee | Mon, Tue, Wed, ..., Sun | |
12490
12545
  * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
12491
12546
  * | | eeeee | M, T, W, T, F, S, S | |
12492
- * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
12547
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |
12493
12548
  * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
12494
12549
  * | | co | 2nd, 3rd, ..., 1st | 7 |
12495
12550
  * | | cc | 02, 03, ..., 01 | |
12496
12551
  * | | ccc | Mon, Tue, Wed, ..., Sun | |
12497
12552
  * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
12498
12553
  * | | 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 | |
12554
+ * | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |
12555
+ * | AM, PM | a..aaa | AM, PM | |
12502
12556
  * | | aaaa | a.m., p.m. | 2 |
12503
12557
  * | | aaaaa | a, p | |
12504
- * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
12505
- * | | bbb | am, pm, noon, midnight | |
12558
+ * | AM, PM, noon, midnight | b..bbb | AM, PM, noon, midnight | |
12506
12559
  * | | bbbb | a.m., p.m., noon, midnight | 2 |
12507
12560
  * | | bbbbb | a, p, n, mi | |
12508
12561
  * | Flexible day period | B..BBB | at night, in the morning, ... | |
@@ -12528,7 +12581,7 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12528
12581
  * | | ss | 00, 01, ..., 59 | |
12529
12582
  * | Fraction of second | S | 0, 1, ..., 9 | |
12530
12583
  * | | SS | 00, 01, ..., 99 | |
12531
- * | | SSS | 000, 001, ..., 999 | |
12584
+ * | | SSS | 000, 0001, ..., 999 | |
12532
12585
  * | | SSSS | ... | 3 |
12533
12586
  * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
12534
12587
  * | | XX | -0800, +0530, Z | |
@@ -12548,18 +12601,18 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12548
12601
  * | | tt | ... | 3,7 |
12549
12602
  * | Milliseconds timestamp | T | 512969520900 | 7 |
12550
12603
  * | | 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 |
12604
+ * | Long localized date | P | 05/29/1453 | 7 |
12605
+ * | | PP | May 29, 1453 | 7 |
12606
+ * | | PPP | May 29th, 1453 | 7 |
12607
+ * | | PPPP | Sunday, May 29th, 1453 | 2,7 |
12555
12608
  * | Long localized time | p | 12:00 AM | 7 |
12556
12609
  * | | pp | 12:00:00 AM | 7 |
12557
12610
  * | | ppp | 12:00:00 AM GMT+2 | 7 |
12558
12611
  * | | 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 |
12612
+ * | Combination of date and time | Pp | 05/29/1453, 12:00 AM | 7 |
12613
+ * | | PPpp | May 29, 1453, 12:00:00 AM | 7 |
12614
+ * | | PPPppp | May 29th, 1453 at ... | 7 |
12615
+ * | | PPPPpppp| Sunday, May 29th, 1453 at ... | 2,7 |
12563
12616
  * Notes:
12564
12617
  * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
12565
12618
  * are the same as "stand-alone" units, but are different in some languages.
@@ -12632,10 +12685,30 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12632
12685
  * - `p`: long localized time
12633
12686
  *
12634
12687
  * 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
12688
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://git.io/fxCyr
12689
+ *
12690
+ * 9. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.
12691
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://git.io/fxCyr
12692
+ *
12693
+ * ### v2.0.0 breaking changes:
12694
+ *
12695
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
12696
+ *
12697
+ * - The second argument is now required for the sake of explicitness.
12636
12698
  *
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
12699
+ * ```javascript
12700
+ * // Before v2.0.0
12701
+ * format(new Date(2016, 0, 1))
12702
+ *
12703
+ * // v2.0.0 onward
12704
+ * format(new Date(2016, 0, 1), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")
12705
+ * ```
12706
+ *
12707
+ * - New format string API for `format` function
12708
+ * which is based on [Unicode Technical Standard #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).
12709
+ * See [this post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.
12710
+ *
12711
+ * - Characters are now escaped using single quote symbols (`'`) instead of square brackets.
12639
12712
  *
12640
12713
  * @param {Date|Number} date - the original date
12641
12714
  * @param {String} format - the string of tokens
@@ -12644,9 +12717,9 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12644
12717
  * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
12645
12718
  * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
12646
12719
  * @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
12720
+ * see: https://git.io/fxCyr
12648
12721
  * @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
12722
+ * see: https://git.io/fxCyr
12650
12723
  * @returns {String} the formatted date string
12651
12724
  * @throws {TypeError} 2 arguments required
12652
12725
  * @throws {RangeError} `date` must not be Invalid Date
@@ -12654,46 +12727,47 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12654
12727
  * @throws {RangeError} `options.locale` must contain `formatLong` property
12655
12728
  * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
12656
12729
  * @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
12730
+ * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
12731
+ * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
12732
+ * @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
12733
+ * @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
12734
  * @throws {RangeError} format string contains an unescaped latin alphabet character
12662
12735
  *
12663
12736
  * @example
12664
12737
  * // Represent 11 February 2014 in middle-endian format:
12665
- * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
12738
+ * var result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
12666
12739
  * //=> '02/11/2014'
12667
12740
  *
12668
12741
  * @example
12669
12742
  * // Represent 2 July 2014 in Esperanto:
12670
12743
  * import { eoLocale } from 'date-fns/locale/eo'
12671
- * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
12744
+ * var result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
12672
12745
  * locale: eoLocale
12673
12746
  * })
12674
12747
  * //=> '2-a de julio 2014'
12675
12748
  *
12676
12749
  * @example
12677
12750
  * // Escape string by single quote characters:
12678
- * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
12751
+ * var result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
12679
12752
  * //=> "3 o'clock"
12680
12753
  */
12681
12754
 
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;
12755
+ function format$1(dirtyDate, dirtyFormatStr, dirtyOptions) {
12684
12756
  requiredArgs(2, arguments);
12685
12757
  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);
12758
+ var options = dirtyOptions || {};
12759
+ var locale$1 = options.locale || locale;
12760
+ var localeFirstWeekContainsDate = locale$1.options && locale$1.options.firstWeekContainsDate;
12761
+ var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
12762
+ var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
12689
12763
 
12690
- // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
12691
12764
  if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
12692
12765
  throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
12693
12766
  }
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);
12767
+ var localeWeekStartsOn = locale$1.options && locale$1.options.weekStartsOn;
12768
+ var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
12769
+ var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
12695
12770
 
12696
- // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
12697
12771
  if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
12698
12772
  throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
12699
12773
  }
@@ -12706,11 +12780,10 @@ function format(dirtyDate, dirtyFormatStr, options) {
12706
12780
  var originalDate = toDate(dirtyDate);
12707
12781
  if (!isValid(originalDate)) {
12708
12782
  throw new RangeError('Invalid time value');
12709
- }
12710
-
12711
- // Convert the date in system timezone to the same date in UTC+00:00 timezone.
12783
+ } // Convert the date in system timezone to the same date in UTC+00:00 timezone.
12712
12784
  // This ensures that when UTC functions will be implemented, locales will be compatible with them.
12713
12785
  // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
12786
+
12714
12787
  var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
12715
12788
  var utcDate = subMilliseconds(originalDate, timezoneOffset);
12716
12789
  var formatterOptions = {
@@ -12723,7 +12796,7 @@ function format(dirtyDate, dirtyFormatStr, options) {
12723
12796
  var firstCharacter = substring[0];
12724
12797
  if (firstCharacter === 'p' || firstCharacter === 'P') {
12725
12798
  var longFormatter = longFormatters[firstCharacter];
12726
- return longFormatter(substring, locale$1.formatLong);
12799
+ return longFormatter(substring, locale$1.formatLong, formatterOptions);
12727
12800
  }
12728
12801
  return substring;
12729
12802
  }).join('').match(formattingTokensRegExp).map(function (substring) {
@@ -12737,11 +12810,11 @@ function format(dirtyDate, dirtyFormatStr, options) {
12737
12810
  }
12738
12811
  var formatter = formatters[firstCharacter];
12739
12812
  if (formatter) {
12740
- if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
12741
- throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
12813
+ if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
12814
+ throwProtectedError(substring, dirtyFormatStr, dirtyDate);
12742
12815
  }
12743
- if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
12744
- throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
12816
+ if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
12817
+ throwProtectedError(substring, dirtyFormatStr, dirtyDate);
12745
12818
  }
12746
12819
  return formatter(utcDate, substring, locale$1.localize, formatterOptions);
12747
12820
  }
@@ -12753,28 +12826,22 @@ function format(dirtyDate, dirtyFormatStr, options) {
12753
12826
  return result;
12754
12827
  }
12755
12828
  function cleanEscapedString(input) {
12756
- var matched = input.match(escapedStringRegExp);
12757
- if (!matched) {
12758
- return input;
12759
- }
12760
- return matched[1].replace(doubleQuoteRegExp, "'");
12829
+ return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
12761
12830
  }
12762
12831
 
12763
- function convertToFP(fn, arity) {
12764
- var a = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
12832
+ function convertToFP(fn, arity, a) {
12833
+ a = a || [];
12765
12834
  if (a.length >= arity) {
12766
12835
  return fn.apply(null, a.slice(0, arity).reverse());
12767
12836
  }
12768
12837
  return function () {
12769
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12770
- args[_key] = arguments[_key];
12771
- }
12838
+ var args = Array.prototype.slice.call(arguments);
12772
12839
  return convertToFP(fn, arity, a.concat(args));
12773
12840
  };
12774
12841
  }
12775
12842
 
12776
- // This file is generated automatically by `scripts/build/fp.ts`. Please, don't change it.
12777
- var formatTime = convertToFP(format, 2);
12843
+ // This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
12844
+ var format = convertToFP(format$1, 2);
12778
12845
 
12779
12846
  var Wrapper = index$a(View)(function () {
12780
12847
  return {
@@ -12855,17 +12922,18 @@ var StyledCalendarDayNameCell = index$a(View)(function (_ref3) {
12855
12922
  var StyledCalendarCell = index$a(TouchableOpacity)(function (_ref4) {
12856
12923
  var theme = _ref4.theme,
12857
12924
  _ref4$variant = _ref4.variant,
12858
- variant = _ref4$variant === void 0 ? 'default' : _ref4$variant,
12859
- themeItemWidth = _ref4.themeItemWidth;
12925
+ variant = _ref4$variant === void 0 ? 'default' : _ref4$variant;
12860
12926
  return {
12861
12927
  borderColor: theme.__hd__.calendar.colors.border,
12862
12928
  borderWidth: variant === 'current' ? 1 : 0,
12863
- borderRadius: theme.__hd__.calendar.radii["default"],
12929
+ borderRadius: variant === 'highlighted' ? undefined : theme.__hd__.calendar.radii["default"],
12864
12930
  alignItems: 'center',
12865
12931
  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
12932
+ backgroundColor: variant === 'selected' ? theme.__hd__.calendar.colors.rowItem.selected : 'transparent',
12933
+ width: '100%',
12934
+ height: '100%',
12935
+ maxWidth: theme.__hd__.calendar.sizes.cellWidth,
12936
+ maxHeight: theme.__hd__.calendar.sizes.cellHeight
12869
12937
  };
12870
12938
  });
12871
12939
  var StyledCalendarRow = index$a(View)(function (_ref5) {
@@ -12873,18 +12941,24 @@ var StyledCalendarRow = index$a(View)(function (_ref5) {
12873
12941
  return {
12874
12942
  flexDirection: 'row',
12875
12943
  paddingHorizontal: theme.__hd__.calendar.space.rowVerticalPadding,
12876
- flexWrap: 'wrap'
12944
+ flexWrap: 'wrap',
12945
+ justifyContent: 'center',
12946
+ alignItems: 'center'
12877
12947
  };
12878
12948
  });
12879
12949
  var StyledCalendarRowItem = index$a(View)(function (_ref6) {
12880
12950
  var theme = _ref6.theme,
12881
- themeItemWidth = _ref6.themeItemWidth;
12951
+ themeItemWidth = _ref6.themeItemWidth,
12952
+ isHighlighted = _ref6.isHighlighted;
12882
12953
  return {
12883
12954
  flexBasis: "".concat(Math.floor(100.0 / 7.0), "%"),
12955
+ lineHeight: 0,
12884
12956
  alignItems: 'center',
12885
12957
  width: themeItemWidth || theme.__hd__.calendar.sizes.cellWidth,
12886
- height: theme.__hd__.calendar.sizes.cellHeight,
12887
- justifyContent: 'center'
12958
+ height: themeItemWidth || theme.__hd__.calendar.sizes.cellHeight,
12959
+ maxHeight: theme.__hd__.calendar.sizes.cellHeight,
12960
+ justifyContent: 'center',
12961
+ backgroundColor: isHighlighted ? theme.__hd__.calendar.colors.rowItem.highlighted : undefined
12888
12962
  };
12889
12963
  });
12890
12964
  var StyledDisabledCalendarRowItem = index$a(View)(function (_ref7) {
@@ -12894,7 +12968,8 @@ var StyledDisabledCalendarRowItem = index$a(View)(function (_ref7) {
12894
12968
  flexBasis: "".concat(Math.floor(100.0 / 7.0), "%"),
12895
12969
  alignItems: 'center',
12896
12970
  width: themeItemWidth || theme.__hd__.calendar.sizes.cellWidth,
12897
- height: theme.__hd__.calendar.sizes.cellHeight
12971
+ height: themeItemWidth || theme.__hd__.calendar.sizes.cellHeight,
12972
+ maxHeight: theme.__hd__.calendar.sizes.cellHeight
12898
12973
  };
12899
12974
  });
12900
12975
  var StyledMark = index$a(View)(function (_ref8) {
@@ -12914,8 +12989,10 @@ var StyledMark = index$a(View)(function (_ref8) {
12914
12989
  var getCellVariant = function getCellVariant() {
12915
12990
  var isSelected = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
12916
12991
  var isCurrent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
12992
+ var isHighlighted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
12917
12993
  if (isSelected) return 'selected';
12918
12994
  if (isCurrent) return 'current';
12995
+ if (isHighlighted) return 'highlighted';
12919
12996
  return 'default';
12920
12997
  };
12921
12998
  var CalendarRowItem = function CalendarRowItem(_ref) {
@@ -12927,12 +13004,14 @@ var CalendarRowItem = function CalendarRowItem(_ref) {
12927
13004
  textIntent = _ref$textIntent === void 0 ? 'body' : _ref$textIntent,
12928
13005
  _ref$marked = _ref.marked,
12929
13006
  marked = _ref$marked === void 0 ? false : _ref$marked,
12930
- itemWidth = _ref.itemWidth;
13007
+ itemWidth = _ref.itemWidth,
13008
+ isHighlighted = _ref.isHighlighted;
12931
13009
  return /*#__PURE__*/React__default.createElement(StyledCalendarRowItem, {
12932
13010
  testID: "calendar-date-cell",
12933
- themeItemWidth: itemWidth
13011
+ themeItemWidth: itemWidth,
13012
+ isHighlighted: isHighlighted
12934
13013
  }, /*#__PURE__*/React__default.createElement(StyledCalendarCell, {
12935
- variant: getCellVariant(isSelected, isCurrent),
13014
+ variant: getCellVariant(isSelected, isCurrent, isHighlighted),
12936
13015
  onPress: onPress
12937
13016
  }, /*#__PURE__*/React__default.createElement(Typography.Body, {
12938
13017
  variant: "small",
@@ -12951,6 +13030,14 @@ var initArray = function initArray(length, func) {
12951
13030
  var isEqDate = function isEqDate(dateA, dateB) {
12952
13031
  return (dateA === null || dateA === void 0 ? void 0 : dateA.toDateString()) === (dateB === null || dateB === void 0 ? void 0 : dateB.toDateString());
12953
13032
  };
13033
+ var isDateInRange = function isDateInRange(_ref) {
13034
+ var date = _ref.date,
13035
+ range = _ref.range;
13036
+ if (!range || range.startDate === undefined || range.endDate === undefined) {
13037
+ return false;
13038
+ }
13039
+ return date >= range.startDate && date <= range.endDate;
13040
+ };
12954
13041
  var getValidDate = function getValidDate(date, minDate, maxDate) {
12955
13042
  if (minDate === undefined && maxDate === undefined) {
12956
13043
  return date;
@@ -12966,6 +13053,297 @@ var getValidDate = function getValidDate(date, minDate, maxDate) {
12966
13053
  }
12967
13054
  return undefined;
12968
13055
  };
13056
+ var setStartOrEndDate = function setStartOrEndDate(_ref2) {
13057
+ var date = _ref2.date,
13058
+ startDate = _ref2.startDate,
13059
+ endDate = _ref2.endDate;
13060
+ // Prevent selecting same date
13061
+ if (isEqDate(date, startDate) || isEqDate(date, endDate)) {
13062
+ return {
13063
+ startDate: startDate,
13064
+ endDate: endDate
13065
+ };
13066
+ }
13067
+ // No start date yet - set as start
13068
+ if (!startDate) {
13069
+ return {
13070
+ startDate: date,
13071
+ endDate: undefined
13072
+ };
13073
+ }
13074
+ // Have start but no end - set as end and reorder if needed
13075
+ if (!endDate) {
13076
+ return date < startDate ? {
13077
+ startDate: date,
13078
+ endDate: startDate
13079
+ } : {
13080
+ startDate: startDate,
13081
+ endDate: date
13082
+ };
13083
+ }
13084
+ // Clicking within range - start new selection
13085
+ if (date >= startDate && date <= endDate) {
13086
+ return {
13087
+ startDate: date,
13088
+ endDate: undefined
13089
+ };
13090
+ }
13091
+ // Clicking outside range - extend range
13092
+ return date < startDate ? {
13093
+ startDate: date,
13094
+ endDate: endDate
13095
+ } : {
13096
+ startDate: startDate,
13097
+ endDate: date
13098
+ };
13099
+ };
13100
+
13101
+ var SelectedDate = function SelectedDate(_ref) {
13102
+ var date = _ref.date,
13103
+ onPress = _ref.onPress,
13104
+ marked = _ref.marked,
13105
+ isStart = _ref.isStart,
13106
+ showConnector = _ref.showConnector,
13107
+ itemWidth = _ref.itemWidth;
13108
+ return /*#__PURE__*/React__default.createElement(StyledCalendarRowItem, {
13109
+ themeItemWidth: itemWidth,
13110
+ testID: "calendar-date-cell"
13111
+ }, showConnector ? /*#__PURE__*/React__default.createElement(Box, {
13112
+ testID: "range-connector",
13113
+ style: _objectSpread2(_objectSpread2({
13114
+ width: '50%',
13115
+ height: '100%'
13116
+ }, StyleSheet$1.absoluteFillObject), {}, {
13117
+ transform: isStart ? [{
13118
+ translateX: itemWidth ? itemWidth / 2 : 0
13119
+ }] : undefined
13120
+ }),
13121
+ bgColor: "highlightedSurface"
13122
+ }) : null, /*#__PURE__*/React__default.createElement(StyledCalendarCell, {
13123
+ testID: "selected-date-cell",
13124
+ variant: "selected",
13125
+ onPress: onPress
13126
+ }, /*#__PURE__*/React__default.createElement(Typography.Body, {
13127
+ variant: "small",
13128
+ intent: "inverted"
13129
+ }, date ? date.getDate() : ''), marked ? /*#__PURE__*/React__default.createElement(StyledMark, {
13130
+ testID: "calendar-date-mark",
13131
+ variant: "inverted"
13132
+ }) : null));
13133
+ };
13134
+
13135
+ var DAYS_OF_WEEK$1 = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
13136
+ // Sunday first column => 0
13137
+ // Sunday last column => 1
13138
+ var WEEK_INDEX_OFFSET$1 = 1;
13139
+ var SUNDAY_INDEX$1 = 6;
13140
+ // Always render 7 rows x 6 items for consistent layout
13141
+ var TOTAL_DATES_ITEMS$1 = 7 * 6;
13142
+ var CalendarRange = function CalendarRange(_ref) {
13143
+ var value = _ref.value,
13144
+ visibleDate = _ref.visibleDate,
13145
+ onChange = _ref.onChange,
13146
+ _ref$onPreviousPress = _ref.onPreviousPress,
13147
+ onPreviousPress = _ref$onPreviousPress === void 0 ? noop$1 : _ref$onPreviousPress,
13148
+ _ref$onNextPress = _ref.onNextPress,
13149
+ onNextPress = _ref$onNextPress === void 0 ? noop$1 : _ref$onNextPress,
13150
+ _ref$onTitlePress = _ref.onTitlePress,
13151
+ onTitlePress = _ref$onTitlePress === void 0 ? noop$1 : _ref$onTitlePress,
13152
+ minDate = _ref.minDate,
13153
+ maxDate = _ref.maxDate,
13154
+ _ref$markedDates = _ref.markedDates,
13155
+ markedDates = _ref$markedDates === void 0 ? [] : _ref$markedDates,
13156
+ testID = _ref.testID,
13157
+ _ref$onMonthChange = _ref.onMonthChange,
13158
+ onMonthChange = _ref$onMonthChange === void 0 ? noop$1 : _ref$onMonthChange,
13159
+ _ref$onToggleMonthPic = _ref.onToggleMonthPicker,
13160
+ onToggleMonthPicker = _ref$onToggleMonthPic === void 0 ? noop$1 : _ref$onToggleMonthPic,
13161
+ monthPickerConfirmLabel = _ref.monthPickerConfirmLabel,
13162
+ monthPickerCancelLabel = _ref.monthPickerCancelLabel;
13163
+ var theme = useTheme();
13164
+ var currentMonth = visibleDate.getMonth();
13165
+ var currentYear = visibleDate.getFullYear();
13166
+ var now = new Date();
13167
+ var parsedMaskedDate = markedDates.reduce(function (current, markedDate) {
13168
+ return _objectSpread2(_objectSpread2({}, current), {}, _defineProperty({}, markedDate.toDateString(), true));
13169
+ }, {});
13170
+ var _useState = useState(false),
13171
+ _useState2 = _slicedToArray(_useState, 2),
13172
+ monthPickerVisible = _useState2[0],
13173
+ setMonthPickerVisible = _useState2[1];
13174
+ var _useState3 = useState(0),
13175
+ _useState4 = _slicedToArray(_useState3, 2),
13176
+ contentHeight = _useState4[0],
13177
+ setContentHeight = _useState4[1];
13178
+ var _useState5 = useState(0),
13179
+ _useState6 = _slicedToArray(_useState5, 2),
13180
+ contentWidth = _useState6[0],
13181
+ setContentWidth = _useState6[1];
13182
+ var calendarItemWidth = useMemo(function () {
13183
+ return contentWidth > 0 ? Math.floor((contentWidth - theme.__hd__.calendar.space.cellPadding) / 7) : undefined;
13184
+ }, [contentWidth, theme]);
13185
+ var useMonthPicker = onMonthChange !== noop$1;
13186
+ var firstDateOfMonth = new Date(currentYear, currentMonth, 1);
13187
+ var lastDateOfMonth = new Date(currentYear, currentMonth + 1, 0);
13188
+ var lastDateOfPreviousMonth = new Date(currentYear, currentMonth, 0);
13189
+ // Index of day in week is shifted by 1 due to Sunday is the last column
13190
+ var firstDayWeekIndexOfMonth = firstDateOfMonth.getDay() === 0 ? SUNDAY_INDEX$1 : firstDateOfMonth.getDay() - WEEK_INDEX_OFFSET$1;
13191
+ var lastDayIndexOfCurrentMonth = lastDateOfMonth.getDate();
13192
+ var lastDayIndexOfPreviousMonth = lastDateOfPreviousMonth.getDate();
13193
+ var daysOfPreviousMonth = initArray(firstDayWeekIndexOfMonth, function (index) {
13194
+ var reversedIndex = firstDayWeekIndexOfMonth - index - 1;
13195
+ var count = lastDayIndexOfPreviousMonth - reversedIndex;
13196
+ return getValidDate(new Date(currentYear, currentMonth - 1, count), minDate, maxDate);
13197
+ });
13198
+ var daysOfCurrentMonth = initArray(lastDayIndexOfCurrentMonth, function (index) {
13199
+ return getValidDate(new Date(currentYear, currentMonth, index + 1), minDate, maxDate);
13200
+ });
13201
+ var daysOfNextMonth = initArray(TOTAL_DATES_ITEMS$1 - (daysOfPreviousMonth.length + daysOfCurrentMonth.length), function (index) {
13202
+ return getValidDate(new Date(currentYear, currentMonth + 1, index + 1), minDate, maxDate);
13203
+ });
13204
+ var disablePrevButton = minDate === undefined ? false : !daysOfPreviousMonth.some(function (date) {
13205
+ return date !== undefined;
13206
+ }) && minDate >= firstDateOfMonth;
13207
+ var disableNextButton = maxDate === undefined ? false : !daysOfNextMonth.some(function (date) {
13208
+ return date !== undefined;
13209
+ }) || maxDate <= lastDateOfMonth;
13210
+ var onDateChange = function onDateChange(date) {
13211
+ var newDateRange = setStartOrEndDate({
13212
+ date: date,
13213
+ startDate: value === null || value === void 0 ? void 0 : value.startDate,
13214
+ endDate: value === null || value === void 0 ? void 0 : value.endDate
13215
+ });
13216
+ onChange === null || onChange === void 0 || onChange(newDateRange);
13217
+ };
13218
+ var renderDateCell = function renderDateCell(_ref2) {
13219
+ var date = _ref2.date,
13220
+ isCurrentMonth = _ref2.isCurrentMonth;
13221
+ if (!date) {
13222
+ return /*#__PURE__*/React__default.createElement(StyledDisabledCalendarRowItem, {
13223
+ themeItemWidth: calendarItemWidth,
13224
+ testID: "calendar-disabled-cell"
13225
+ });
13226
+ }
13227
+ if (isEqDate(value === null || value === void 0 ? void 0 : value.startDate, date) || isEqDate(value === null || value === void 0 ? void 0 : value.endDate, date)) {
13228
+ return /*#__PURE__*/React__default.createElement(SelectedDate, {
13229
+ isStart: isEqDate(date, value === null || value === void 0 ? void 0 : value.startDate),
13230
+ showConnector: !!(value !== null && value !== void 0 && value.startDate) && !!(value !== null && value !== void 0 && value.endDate),
13231
+ key: date.toDateString(),
13232
+ date: date,
13233
+ onPress: function onPress() {
13234
+ return onDateChange(date);
13235
+ },
13236
+ marked: parsedMaskedDate[date.toDateString()],
13237
+ itemWidth: calendarItemWidth
13238
+ });
13239
+ }
13240
+ return /*#__PURE__*/React__default.createElement(CalendarRowItem, {
13241
+ itemWidth: calendarItemWidth,
13242
+ key: date.toDateString(),
13243
+ date: date,
13244
+ isCurrent: isEqDate(now, date),
13245
+ isSelected: isEqDate(value === null || value === void 0 ? void 0 : value.startDate, date) || isEqDate(value === null || value === void 0 ? void 0 : value.endDate, date),
13246
+ isHighlighted: isDateInRange({
13247
+ date: date,
13248
+ range: value
13249
+ }),
13250
+ onPress: function onPress() {
13251
+ return onDateChange(date);
13252
+ },
13253
+ marked: parsedMaskedDate[date.toDateString()],
13254
+ textIntent: isCurrentMonth ? undefined : 'subdued'
13255
+ });
13256
+ };
13257
+ var onLayout = function onLayout(e) {
13258
+ var _e$nativeEvent$layout = e.nativeEvent.layout,
13259
+ width = _e$nativeEvent$layout.width,
13260
+ height = _e$nativeEvent$layout.height;
13261
+ setContentHeight(height);
13262
+ setContentWidth(width);
13263
+ };
13264
+ return /*#__PURE__*/React__default.createElement(StyledContainer$7, {
13265
+ testID: testID
13266
+ }, /*#__PURE__*/React__default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__default.createElement(ContentNavigator, {
13267
+ value: !useMonthPicker ? format('MMMM yyyy', visibleDate) : /*#__PURE__*/React__default.createElement(TouchableOpacity, {
13268
+ testID: "calendar-month-picker",
13269
+ onPress: function onPress() {
13270
+ onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(!monthPickerVisible);
13271
+ setMonthPickerVisible(!monthPickerVisible);
13272
+ }
13273
+ }, /*#__PURE__*/React__default.createElement(Box, {
13274
+ flexDirection: "row",
13275
+ justifyContent: "center",
13276
+ alignItems: "center"
13277
+ }, /*#__PURE__*/React__default.createElement(Typography.Title, {
13278
+ level: "h5",
13279
+ style: {
13280
+ textAlign: 'center',
13281
+ marginRight: theme.__hd__.calendar.space.headerMarginRight
13282
+ }
13283
+ }, format('MMMM yyyy', visibleDate)), /*#__PURE__*/React__default.createElement(Icon, {
13284
+ icon: monthPickerVisible ? 'arrow-up' : 'arrow-down',
13285
+ size: "small"
13286
+ }))),
13287
+ onPreviousPress: onPreviousPress,
13288
+ onNextPress: onNextPress,
13289
+ onPress: useMonthPicker ? undefined : onTitlePress,
13290
+ previousDisabled: disablePrevButton,
13291
+ nextDisabled: disableNextButton,
13292
+ fontSize: "large"
13293
+ })), Platform.OS === 'ios' && monthPickerVisible ? /*#__PURE__*/React__default.createElement(Box, {
13294
+ style: {
13295
+ overflow: 'hidden'
13296
+ }
13297
+ }, /*#__PURE__*/React__default.createElement(MonthYearPickerViewIOS, {
13298
+ value: value === null || value === void 0 ? void 0 : value.startDate,
13299
+ minimumDate: minDate,
13300
+ maximumDate: maxDate,
13301
+ onChange: onMonthChange,
13302
+ style: {
13303
+ height: contentHeight + theme.__hd__.calendar.space.iosPickerMarginVertical * 2,
13304
+ marginVertical: -theme.__hd__.calendar.space.iosPickerMarginVertical,
13305
+ width: contentWidth
13306
+ }
13307
+ })) : /*#__PURE__*/React__default.createElement(Box, {
13308
+ onLayout: onLayout
13309
+ }, /*#__PURE__*/React__default.createElement(StyledCalendarRow, null, DAYS_OF_WEEK$1.map(function (day) {
13310
+ return /*#__PURE__*/React__default.createElement(StyledCalendarRowItem, {
13311
+ key: day
13312
+ }, /*#__PURE__*/React__default.createElement(StyledCalendarDayNameCell, {
13313
+ themeItemWidth: calendarItemWidth
13314
+ }, /*#__PURE__*/React__default.createElement(Typography.Body, {
13315
+ variant: "small"
13316
+ }, day)));
13317
+ })), /*#__PURE__*/React__default.createElement(StyledCalendarRow, null, daysOfPreviousMonth.map(function (date) {
13318
+ return renderDateCell({
13319
+ date: date,
13320
+ isCurrentMonth: false
13321
+ });
13322
+ }), daysOfCurrentMonth.map(function (date) {
13323
+ return renderDateCell({
13324
+ date: date,
13325
+ isCurrentMonth: true
13326
+ });
13327
+ }), daysOfNextMonth.map(function (date) {
13328
+ return renderDateCell({
13329
+ date: date,
13330
+ isCurrentMonth: false
13331
+ });
13332
+ })), Platform.OS === 'android' && monthPickerVisible && /*#__PURE__*/React__default.createElement(MonthYearPickerDialogueAndroid, {
13333
+ doneButtonLabel: monthPickerConfirmLabel,
13334
+ cancelButtonLabel: monthPickerCancelLabel,
13335
+ value: value === null || value === void 0 ? void 0 : value.startDate,
13336
+ minimumDate: minDate,
13337
+ maximumDate: maxDate,
13338
+ onChange: function onChange(action, date) {
13339
+ setMonthPickerVisible(false);
13340
+ onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(false);
13341
+ if (action === 'dateSetAction' && !!date) {
13342
+ onMonthChange(date);
13343
+ }
13344
+ }
13345
+ })));
13346
+ };
12969
13347
 
12970
13348
  var DAYS_OF_WEEK = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
12971
13349
  // Sunday first column => 0
@@ -13015,8 +13393,8 @@ var Calendar = function Calendar(_ref) {
13015
13393
  contentWidth = _useState6[0],
13016
13394
  setContentWidth = _useState6[1];
13017
13395
  var calendarItemWidth = useMemo(function () {
13018
- return contentWidth > 0 ? contentWidth / 7 : undefined;
13019
- }, [contentWidth]);
13396
+ return contentWidth > 0 ? Math.floor((contentWidth - theme.__hd__.calendar.space.cellPadding) / 7) : undefined;
13397
+ }, [contentWidth, theme]);
13020
13398
  var useMonthPicker = onMonthChange !== noop$1;
13021
13399
  var firstDateOfMonth = new Date(currentYear, currentMonth, 1);
13022
13400
  var lastDateOfMonth = new Date(currentYear, currentMonth + 1, 0);
@@ -13042,10 +13420,17 @@ var Calendar = function Calendar(_ref) {
13042
13420
  var disableNextButton = maxDate === undefined ? false : !daysOfNextMonth.some(function (date) {
13043
13421
  return date !== undefined;
13044
13422
  }) || maxDate <= lastDateOfMonth;
13423
+ var onLayout = function onLayout(e) {
13424
+ var _e$nativeEvent$layout = e.nativeEvent.layout,
13425
+ width = _e$nativeEvent$layout.width,
13426
+ height = _e$nativeEvent$layout.height;
13427
+ setContentHeight(height);
13428
+ setContentWidth(width);
13429
+ };
13045
13430
  return /*#__PURE__*/React__default.createElement(StyledContainer$7, {
13046
13431
  testID: testID
13047
13432
  }, /*#__PURE__*/React__default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__default.createElement(ContentNavigator, {
13048
- value: !useMonthPicker ? formatTime('MMMM yyyy', visibleDate) : /*#__PURE__*/React__default.createElement(TouchableOpacity, {
13433
+ value: !useMonthPicker ? format('MMMM yyyy', visibleDate) : /*#__PURE__*/React__default.createElement(TouchableOpacity, {
13049
13434
  testID: "calendar-month-picker",
13050
13435
  onPress: function onPress() {
13051
13436
  onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(!monthPickerVisible);
@@ -13061,7 +13446,7 @@ var Calendar = function Calendar(_ref) {
13061
13446
  textAlign: 'center',
13062
13447
  marginRight: theme.__hd__.calendar.space.headerMarginRight
13063
13448
  }
13064
- }, formatTime('MMMM yyyy', visibleDate)), /*#__PURE__*/React__default.createElement(Icon, {
13449
+ }, format('MMMM yyyy', visibleDate)), /*#__PURE__*/React__default.createElement(Icon, {
13065
13450
  icon: monthPickerVisible ? 'arrow-up' : 'arrow-down',
13066
13451
  size: "small"
13067
13452
  }))),
@@ -13086,13 +13471,7 @@ var Calendar = function Calendar(_ref) {
13086
13471
  width: contentWidth
13087
13472
  }
13088
13473
  })) : /*#__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
13474
+ onLayout: onLayout
13096
13475
  }, /*#__PURE__*/React__default.createElement(StyledCalendarRow, null, DAYS_OF_WEEK.map(function (day) {
13097
13476
  return /*#__PURE__*/React__default.createElement(StyledCalendarRowItem, {
13098
13477
  key: day
@@ -13163,6 +13542,9 @@ var Calendar = function Calendar(_ref) {
13163
13542
  }
13164
13543
  })));
13165
13544
  };
13545
+ var Calendar$1 = Object.assign(Calendar, {
13546
+ Range: CalendarRange
13547
+ });
13166
13548
 
13167
13549
  var StyledDataCard = index$a(View)(function (_ref) {
13168
13550
  var theme = _ref.theme;
@@ -13574,7 +13956,7 @@ var StyledPageControlWrapper = index$a(View)(function (_ref7) {
13574
13956
  });
13575
13957
 
13576
13958
  function isCarouselImageProps(image) {
13577
- return _typeof$1(image) === 'object';
13959
+ return _typeof(image) === 'object';
13578
13960
  }
13579
13961
  var CarouselItem = function CarouselItem(_ref) {
13580
13962
  var width = _ref.width,
@@ -14509,7 +14891,7 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
14509
14891
  _useState2 = _slicedToArray(_useState, 2),
14510
14892
  open = _useState2[0],
14511
14893
  setOpen = _useState2[1];
14512
- var displayValue = value ? formatTime(displayFormat, value) : '';
14894
+ var displayValue = value ? format(displayFormat, value) : '';
14513
14895
  var pickerInitValue = value || new Date();
14514
14896
  useCalculateDate({
14515
14897
  minDate: minDate,
@@ -14578,7 +14960,7 @@ var InternalCalendar = function InternalCalendar(_ref) {
14578
14960
  _useState4 = _slicedToArray(_useState3, 2),
14579
14961
  selectingDate = _useState4[0],
14580
14962
  setSelectingDate = _useState4[1];
14581
- return /*#__PURE__*/React__default.createElement(Calendar, {
14963
+ return /*#__PURE__*/React__default.createElement(Calendar$1, {
14582
14964
  testID: "calendar",
14583
14965
  value: selectingDate,
14584
14966
  visibleDate: visibleDate,
@@ -14640,7 +15022,7 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
14640
15022
  _useState10 = _slicedToArray(_useState9, 2),
14641
15023
  selectingDate = _useState10[0],
14642
15024
  setSelectingDate = _useState10[1];
14643
- var displayValue = value ? formatTime(displayFormat, value) : '';
15025
+ var displayValue = value ? format(displayFormat, value) : '';
14644
15026
  useCalculateDate({
14645
15027
  minDate: minDate,
14646
15028
  maxDate: maxDate,
@@ -14733,7 +15115,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
14733
15115
  _useState4 = _slicedToArray(_useState3, 2),
14734
15116
  open = _useState4[0],
14735
15117
  setOpen = _useState4[1];
14736
- var displayValue = value ? formatTime(displayFormat, value) : '';
15118
+ var displayValue = value ? format(displayFormat, value) : '';
14737
15119
  var theme = useTheme();
14738
15120
  useCalculateDate({
14739
15121
  minDate: minDate,
@@ -19905,7 +20287,7 @@ var TimePickerAndroid = function TimePickerAndroid(_ref) {
19905
20287
  open = _useState2[0],
19906
20288
  setOpen = _useState2[1];
19907
20289
  var is12Hour = displayFormat.includes('hh');
19908
- var displayValue = value ? formatTime(displayFormat, value) : '';
20290
+ var displayValue = value ? format(displayFormat, value) : '';
19909
20291
  var pickerInitValue = value || new Date();
19910
20292
  return /*#__PURE__*/React__default.createElement(TouchableOpacity, {
19911
20293
  onPress: function onPress() {
@@ -19976,7 +20358,7 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
19976
20358
  open = _useState4[0],
19977
20359
  setOpen = _useState4[1];
19978
20360
  var is12Hour = displayFormat.includes('hh');
19979
- var displayValue = value ? formatTime(displayFormat, value) : '';
20361
+ var displayValue = value ? format(displayFormat, value) : '';
19980
20362
  var theme = useTheme();
19981
20363
  useEffect(function () {
19982
20364
  setSelectingDate(value || new Date());
@@ -20715,7 +21097,7 @@ function requireScheduler_production_min() {
20715
21097
  var c = a.sortIndex - b.sortIndex;
20716
21098
  return 0 !== c ? c : a.id - b.id;
20717
21099
  }
20718
- if ("object" === (typeof performance === "undefined" ? "undefined" : _typeof$1(performance)) && "function" === typeof performance.now) {
21100
+ if ("object" === (typeof performance === "undefined" ? "undefined" : _typeof(performance)) && "function" === typeof performance.now) {
20719
21101
  var l = performance;
20720
21102
  exports.unstable_now = function () {
20721
21103
  return l.now();
@@ -20886,7 +21268,7 @@ function requireScheduler_production_min() {
20886
21268
  };
20887
21269
  exports.unstable_scheduleCallback = function (a, b, c) {
20888
21270
  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;
21271
+ "object" === _typeof(c) && null !== c ? (c = c.delay, c = "number" === typeof c && 0 < c ? d + c : d) : c = d;
20890
21272
  switch (a) {
20891
21273
  case 1:
20892
21274
  var e = -1;
@@ -20976,7 +21358,7 @@ function requireReactDom_production_min() {
20976
21358
  }
20977
21359
  function pa(a, b, c, d) {
20978
21360
  if (null !== c && 0 === c.type) return !1;
20979
- switch (_typeof$1(b)) {
21361
+ switch (_typeof(b)) {
20980
21362
  case "function":
20981
21363
  case "symbol":
20982
21364
  return !0;
@@ -21086,7 +21468,7 @@ function requireReactDom_production_min() {
21086
21468
  var Ia = Symbol["for"]("react.offscreen");
21087
21469
  var Ja = Symbol.iterator;
21088
21470
  function Ka(a) {
21089
- if (null === a || "object" !== _typeof$1(a)) return null;
21471
+ if (null === a || "object" !== _typeof(a)) return null;
21090
21472
  a = Ja && a[Ja] || a["@@iterator"];
21091
21473
  return "function" === typeof a ? a : null;
21092
21474
  }
@@ -21115,7 +21497,7 @@ function requireReactDom_production_min() {
21115
21497
  set: function set() {
21116
21498
  throw Error();
21117
21499
  }
21118
- }), "object" === (typeof Reflect === "undefined" ? "undefined" : _typeof$1(Reflect)) && Reflect.construct) {
21500
+ }), "object" === (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && Reflect.construct) {
21119
21501
  try {
21120
21502
  Reflect.construct(b, []);
21121
21503
  } catch (l) {
@@ -21197,7 +21579,7 @@ function requireReactDom_production_min() {
21197
21579
  case Fa:
21198
21580
  return "SuspenseList";
21199
21581
  }
21200
- if ("object" === _typeof$1(a)) switch (a.$$typeof) {
21582
+ if ("object" === _typeof(a)) switch (a.$$typeof) {
21201
21583
  case Ca:
21202
21584
  return (a.displayName || "Context") + ".Consumer";
21203
21585
  case Ba:
@@ -21269,7 +21651,7 @@ function requireReactDom_production_min() {
21269
21651
  return null;
21270
21652
  }
21271
21653
  function Sa(a) {
21272
- switch (_typeof$1(a)) {
21654
+ switch (_typeof(a)) {
21273
21655
  case "boolean":
21274
21656
  case "number":
21275
21657
  case "string":
@@ -21580,9 +21962,9 @@ function requireReactDom_production_min() {
21580
21962
  if (tb[a] && (null != b.children || null != b.dangerouslySetInnerHTML)) throw Error(p(137, a));
21581
21963
  if (null != b.dangerouslySetInnerHTML) {
21582
21964
  if (null != b.children) throw Error(p(60));
21583
- if ("object" !== _typeof$1(b.dangerouslySetInnerHTML) || !("__html" in b.dangerouslySetInnerHTML)) throw Error(p(61));
21965
+ if ("object" !== _typeof(b.dangerouslySetInnerHTML) || !("__html" in b.dangerouslySetInnerHTML)) throw Error(p(61));
21584
21966
  }
21585
- if (null != b.style && "object" !== _typeof$1(b.style)) throw Error(p(62));
21967
+ if (null != b.style && "object" !== _typeof(b.style)) throw Error(p(62));
21586
21968
  }
21587
21969
  }
21588
21970
  function vb(a, b) {
@@ -21668,7 +22050,7 @@ function requireReactDom_production_min() {
21668
22050
  a = !1;
21669
22051
  }
21670
22052
  if (a) return null;
21671
- if (c && "function" !== typeof c) throw Error(p(231, b, _typeof$1(c)));
22053
+ if (c && "function" !== typeof c) throw Error(p(231, b, _typeof(c)));
21672
22054
  return c;
21673
22055
  }
21674
22056
  var Lb = !1;
@@ -22582,7 +22964,7 @@ function requireReactDom_production_min() {
22582
22964
  }
22583
22965
  function he(a) {
22584
22966
  a = a.detail;
22585
- return "object" === _typeof$1(a) && "data" in a ? a.data : null;
22967
+ return "object" === _typeof(a) && "data" in a ? a.data : null;
22586
22968
  }
22587
22969
  var ie = !1;
22588
22970
  function je(a, b) {
@@ -22699,7 +23081,7 @@ function requireReactDom_production_min() {
22699
23081
  var He = "function" === typeof Object.is ? Object.is : Ge;
22700
23082
  function Ie(a, b) {
22701
23083
  if (He(a, b)) return !0;
22702
- if ("object" !== _typeof$1(a) || null === a || "object" !== _typeof$1(b) || null === b) return !1;
23084
+ if ("object" !== _typeof(a) || null === a || "object" !== _typeof(b) || null === b) return !1;
22703
23085
  var c = Object.keys(a),
22704
23086
  d = Object.keys(b);
22705
23087
  if (c.length !== d.length) return !1;
@@ -23226,7 +23608,7 @@ function requireReactDom_production_min() {
23226
23608
  var Cf = null,
23227
23609
  Df = null;
23228
23610
  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;
23611
+ 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
23612
  }
23231
23613
  var Ff = "function" === typeof setTimeout ? setTimeout : void 0,
23232
23614
  Gf = "function" === typeof clearTimeout ? clearTimeout : void 0,
@@ -23874,7 +24256,7 @@ function requireReactDom_production_min() {
23874
24256
  var d = !1,
23875
24257
  e = Vf;
23876
24258
  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);
24259
+ "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
24260
  b = new b(c, f);
23879
24261
  a.memoizedState = null !== b.state && void 0 !== b.state ? b.state : null;
23880
24262
  b.updater = nh;
@@ -23896,7 +24278,7 @@ function requireReactDom_production_min() {
23896
24278
  e.refs = jh;
23897
24279
  ah(a);
23898
24280
  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));
24281
+ "object" === _typeof(f) && null !== f ? e.context = Vg(f) : (f = Zf(b) ? Xf : H.current, e.context = Yf(a, f));
23900
24282
  e.state = a.memoizedState;
23901
24283
  f = b.getDerivedStateFromProps;
23902
24284
  "function" === typeof f && (kh(a, b, f, c), e.state = a.memoizedState);
@@ -23905,7 +24287,7 @@ function requireReactDom_production_min() {
23905
24287
  }
23906
24288
  function sh(a, b, c) {
23907
24289
  a = c.ref;
23908
- if (null !== a && "function" !== typeof a && "object" !== _typeof$1(a)) {
24290
+ if (null !== a && "function" !== typeof a && "object" !== _typeof(a)) {
23909
24291
  if (c._owner) {
23910
24292
  c = c._owner;
23911
24293
  if (c) {
@@ -23980,7 +24362,7 @@ function requireReactDom_production_min() {
23980
24362
  function k(a, b, c, d) {
23981
24363
  var f = c.type;
23982
24364
  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;
24365
+ 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
24366
  d = yh(c.type, c.key, c.props, null, a.mode, d);
23985
24367
  d.ref = sh(a, b, c);
23986
24368
  d["return"] = a;
@@ -24000,7 +24382,7 @@ function requireReactDom_production_min() {
24000
24382
  }
24001
24383
  function q(a, b, c) {
24002
24384
  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) {
24385
+ if ("object" === _typeof(b) && null !== b) {
24004
24386
  switch (b.$$typeof) {
24005
24387
  case va:
24006
24388
  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 +24400,7 @@ function requireReactDom_production_min() {
24018
24400
  function r(a, b, c, d) {
24019
24401
  var e = null !== b ? b.key : null;
24020
24402
  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) {
24403
+ if ("object" === _typeof(c) && null !== c) {
24022
24404
  switch (c.$$typeof) {
24023
24405
  case va:
24024
24406
  return c.key === e ? k(a, b, c, d) : null;
@@ -24034,7 +24416,7 @@ function requireReactDom_production_min() {
24034
24416
  }
24035
24417
  function y(a, b, c, d, e) {
24036
24418
  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) {
24419
+ if ("object" === _typeof(d) && null !== d) {
24038
24420
  switch (d.$$typeof) {
24039
24421
  case va:
24040
24422
  return a = a.get(null === d.key ? c : d.key) || null, k(b, a, d, e);
@@ -24108,8 +24490,8 @@ function requireReactDom_production_min() {
24108
24490
  return l;
24109
24491
  }
24110
24492
  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) {
24493
+ "object" === _typeof(f) && null !== f && f.type === ya && null === f.key && (f = f.props.children);
24494
+ if ("object" === _typeof(f) && null !== f) {
24113
24495
  switch (f.$$typeof) {
24114
24496
  case va:
24115
24497
  a: {
@@ -24124,7 +24506,7 @@ function requireReactDom_production_min() {
24124
24506
  a = d;
24125
24507
  break a;
24126
24508
  }
24127
- } else if (l.elementType === k || "object" === _typeof$1(k) && null !== k && k.$$typeof === Ha && uh(k) === l.type) {
24509
+ } else if (l.elementType === k || "object" === _typeof(k) && null !== k && k.$$typeof === Ha && uh(k) === l.type) {
24128
24510
  c(a, l.sibling);
24129
24511
  d = e(l, f.props);
24130
24512
  d.ref = sh(a, l, f);
@@ -25009,7 +25391,7 @@ function requireReactDom_production_min() {
25009
25391
  g.props = h;
25010
25392
  var k = g.context,
25011
25393
  l = c.contextType;
25012
- "object" === _typeof$1(l) && null !== l ? l = Vg(l) : (l = Zf(c) ? Xf : H.current, l = Yf(b, l));
25394
+ "object" === _typeof(l) && null !== l ? l = Vg(l) : (l = Zf(c) ? Xf : H.current, l = Yf(b, l));
25013
25395
  var m = c.getDerivedStateFromProps,
25014
25396
  q = "function" === typeof m || "function" === typeof g.getSnapshotBeforeUpdate;
25015
25397
  q || "function" !== typeof g.UNSAFE_componentWillReceiveProps && "function" !== typeof g.componentWillReceiveProps || (h !== d || k !== l) && qh(b, g, d, l);
@@ -25028,7 +25410,7 @@ function requireReactDom_production_min() {
25028
25410
  q = b.pendingProps;
25029
25411
  r = g.context;
25030
25412
  k = c.contextType;
25031
- "object" === _typeof$1(k) && null !== k ? k = Vg(k) : (k = Zf(c) ? Xf : H.current, k = Yf(b, k));
25413
+ "object" === _typeof(k) && null !== k ? k = Vg(k) : (k = Zf(c) ? Xf : H.current, k = Yf(b, k));
25032
25414
  var y = c.getDerivedStateFromProps;
25033
25415
  (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
25416
  $g = !1;
@@ -26941,7 +27323,7 @@ function requireReactDom_production_min() {
26941
27323
  k = b;
26942
27324
  b = Z;
26943
27325
  h.flags |= 32768;
26944
- if (null !== k && "object" === _typeof$1(k) && "function" === typeof k.then) {
27326
+ if (null !== k && "object" === _typeof(k) && "function" === typeof k.then) {
26945
27327
  var l = k,
26946
27328
  m = h,
26947
27329
  q = m.tag;
@@ -27362,7 +27744,7 @@ function requireReactDom_production_min() {
27362
27744
  e = Xh(null, b, d, a, e, c);
27363
27745
  var f = bi();
27364
27746
  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);
27747
+ "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
27748
  return b;
27367
27749
  case 16:
27368
27750
  d = b.elementType;
@@ -27603,7 +27985,7 @@ function requireReactDom_production_min() {
27603
27985
  case Ia:
27604
27986
  return qj(c, e, f, b);
27605
27987
  default:
27606
- if ("object" === _typeof$1(a) && null !== a) switch (a.$$typeof) {
27988
+ if ("object" === _typeof(a) && null !== a) switch (a.$$typeof) {
27607
27989
  case Ba:
27608
27990
  g = 10;
27609
27991
  break a;
@@ -27621,7 +28003,7 @@ function requireReactDom_production_min() {
27621
28003
  d = null;
27622
28004
  break a;
27623
28005
  }
27624
- throw Error(p(130, null == a ? a : _typeof$1(a), ""));
28006
+ throw Error(p(130, null == a ? a : _typeof(a), ""));
27625
28007
  }
27626
28008
  b = Bg(g, c, b, e);
27627
28009
  b.elementType = a;
@@ -28269,7 +28651,7 @@ function requireLib() {
28269
28651
  };
28270
28652
  },
28271
28653
  380: function _(e, t, r) {
28272
- var n = "object" == _typeof$1(r.g) && r.g && r.g.Object === Object && r.g;
28654
+ var n = "object" == _typeof(r.g) && r.g && r.g.Object === Object && r.g;
28273
28655
  e.exports = n;
28274
28656
  },
28275
28657
  903: function _(e, t, r) {
@@ -28297,7 +28679,7 @@ function requireLib() {
28297
28679
  },
28298
28680
  433: function _(e, t, r) {
28299
28681
  var n = r(380),
28300
- u = "object" == (typeof self === "undefined" ? "undefined" : _typeof$1(self)) && self && self.Object === Object && self,
28682
+ u = "object" == (typeof self === "undefined" ? "undefined" : _typeof(self)) && self && self.Object === Object && self,
28301
28683
  o = n || u || Function("return this")();
28302
28684
  e.exports = o;
28303
28685
  },
@@ -28366,20 +28748,20 @@ function requireLib() {
28366
28748
  },
28367
28749
  953: function _(e) {
28368
28750
  e.exports = function (e) {
28369
- var t = _typeof$1(e);
28751
+ var t = _typeof(e);
28370
28752
  return null != e && ("object" == t || "function" == t);
28371
28753
  };
28372
28754
  },
28373
28755
  934: function _(e) {
28374
28756
  e.exports = function (e) {
28375
- return null != e && "object" == _typeof$1(e);
28757
+ return null != e && "object" == _typeof(e);
28376
28758
  };
28377
28759
  },
28378
28760
  414: function _(e, t, r) {
28379
28761
  var n = r(148),
28380
28762
  u = r(934);
28381
28763
  e.exports = function (e) {
28382
- return "symbol" == _typeof$1(e) || u(e) && "[object Symbol]" == n(e);
28764
+ return "symbol" == _typeof(e) || u(e) && "[object Symbol]" == n(e);
28383
28765
  };
28384
28766
  },
28385
28767
  664: function _(e, t, r) {
@@ -28456,11 +28838,11 @@ function requireLib() {
28456
28838
  get: t[r]
28457
28839
  });
28458
28840
  }, u.g = function () {
28459
- if ("object" == (typeof globalThis === "undefined" ? "undefined" : _typeof$1(globalThis))) return globalThis;
28841
+ if ("object" == (typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis))) return globalThis;
28460
28842
  try {
28461
28843
  return this || new Function("return this")();
28462
28844
  } catch (e) {
28463
- if ("object" == (typeof window === "undefined" ? "undefined" : _typeof$1(window))) return window;
28845
+ if ("object" == (typeof window === "undefined" ? "undefined" : _typeof(window))) return window;
28464
28846
  }
28465
28847
  }(), u.o = function (e, t) {
28466
28848
  return Object.prototype.hasOwnProperty.call(e, t);
@@ -28582,7 +28964,7 @@ function requireLib() {
28582
28964
  }
28583
28965
  var h = Object.prototype.constructor.toString();
28584
28966
  function p(e) {
28585
- if (!e || "object" != _typeof$1(e)) return !1;
28967
+ if (!e || "object" != _typeof(e)) return !1;
28586
28968
  var t = c(e);
28587
28969
  if (null === t) return !0;
28588
28970
  var r = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
@@ -28879,7 +29261,7 @@ function requireLib() {
28879
29261
  }
28880
29262
  return k(_u4, r), R(n, _u4);
28881
29263
  }
28882
- if (!e || "object" != _typeof$1(e)) {
29264
+ if (!e || "object" != _typeof(e)) {
28883
29265
  if (n = t(e), void 0 === n && (n = e), n === a && (n = void 0), _this.autoFreeze_ && E(n, !0), r) {
28884
29266
  var _t6 = [],
28885
29267
  _u5 = [];
@@ -29157,10 +29539,10 @@ function requireLib() {
29157
29539
  }
29158
29540
  };
29159
29541
  function se(e) {
29160
- return se = "function" == typeof Symbol && "symbol" == _typeof$1(Symbol.iterator) ? function (e) {
29161
- return _typeof$1(e);
29542
+ return se = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
29543
+ return _typeof(e);
29162
29544
  } : function (e) {
29163
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof$1(e);
29545
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
29164
29546
  }, se(e);
29165
29547
  }
29166
29548
  function le(e, t, r) {
@@ -33844,7 +34226,7 @@ function requireLib() {
33844
34226
  Jt = u(858),
33845
34227
  Yt = u.n(Jt);
33846
34228
  var Zt = function Zt(e) {
33847
- return "object" == _typeof$1(e) && null != e && 1 === e.nodeType;
34229
+ return "object" == _typeof(e) && null != e && 1 === e.nodeType;
33848
34230
  },
33849
34231
  Gt = function Gt(e, t) {
33850
34232
  return (!t || "hidden" !== e) && "visible" !== e && "clip" !== e;
@@ -34064,10 +34446,10 @@ function requireLib() {
34064
34446
  "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
34447
  var Tr = (!Or || !xr) && !Ar && "undefined" != typeof globalThis && globalThis.InputEvent && "function" == typeof globalThis.InputEvent.prototype.getTargetRanges;
34066
34448
  function Mr(e) {
34067
- return Mr = "function" == typeof Symbol && "symbol" == _typeof$1(Symbol.iterator) ? function (e) {
34068
- return _typeof$1(e);
34449
+ return Mr = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
34450
+ return _typeof(e);
34069
34451
  } : function (e) {
34070
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof$1(e);
34452
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
34071
34453
  }, Mr(e);
34072
34454
  }
34073
34455
  function Rr(e, t, r) {
@@ -35140,10 +35522,10 @@ function requireLib() {
35140
35522
  return u;
35141
35523
  }
35142
35524
  function mu(e) {
35143
- return mu = "function" == typeof Symbol && "symbol" == _typeof$1(Symbol.iterator) ? function (e) {
35144
- return _typeof$1(e);
35525
+ return mu = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
35526
+ return _typeof(e);
35145
35527
  } : function (e) {
35146
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof$1(e);
35528
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
35147
35529
  }, mu(e);
35148
35530
  }
35149
35531
  function yu(e, t, r) {
@@ -36895,7 +37277,7 @@ function requireLib() {
36895
37277
  };
36896
37278
  }(e);
36897
37279
  if (function (e) {
36898
- return "object" == _typeof$1(e) && "function" == typeof e.behavior;
37280
+ return "object" == _typeof(e) && "function" == typeof e.behavior;
36899
37281
  }(t)) return t.behavior(rr(e, t));
36900
37282
  var n = "boolean" == typeof t || null == t ? void 0 : t.behavior;
36901
37283
  var _iterator47 = _createForOfIteratorHelper(rr(e, function (e) {
@@ -39240,10 +39622,6 @@ var RichTextEditor = function RichTextEditor(_ref) {
39240
39622
  _React$useState2 = _slicedToArray(_React$useState, 2),
39241
39623
  inputSize = _React$useState2[0],
39242
39624
  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
39625
  var focusAnimation = useRef(new Animated.Value(0)).current;
39248
39626
  useEffect(function () {
39249
39627
  Animated.timing(focusAnimation, {
@@ -39264,10 +39642,6 @@ var RichTextEditor = function RichTextEditor(_ref) {
39264
39642
  });
39265
39643
  });
39266
39644
  }, []);
39267
- var onLabelLayout = useCallback(function (event) {
39268
- var width = event.nativeEvent.layout.width;
39269
- setLabelWidth(width);
39270
- }, []);
39271
39645
  useEffect(function () {
39272
39646
  var removeFocusListener = on(emitter, normalizeEventName('editor-focus'), function () {
39273
39647
  return setIsFocused(true);
@@ -39394,12 +39768,12 @@ var RichTextEditor = function RichTextEditor(_ref) {
39394
39768
  transform: [{
39395
39769
  translateY: focusAnimation.interpolate({
39396
39770
  inputRange: [0, 1],
39397
- outputRange: [inputSize.height / 2, 0]
39771
+ outputRange: [inputSize.height / 2, theme.space.xsmall]
39398
39772
  })
39399
39773
  }, {
39400
39774
  translateX: focusAnimation.interpolate({
39401
39775
  inputRange: [0, 1],
39402
- outputRange: [-inputSize.width / 2 + labelWidth / 2 + theme.space.large, -inputSize.width / 2 + labelWidth / 2 + theme.space.small]
39776
+ outputRange: [theme.space.medium, -theme.space.xlarge + theme.space.xsmall]
39403
39777
  })
39404
39778
  }, {
39405
39779
  scale: focusAnimation.interpolate({
@@ -39408,19 +39782,18 @@ var RichTextEditor = function RichTextEditor(_ref) {
39408
39782
  })
39409
39783
  }]
39410
39784
  }]
39411
- }, required && /*#__PURE__*/React__default.createElement(StyledAsteriskLabelInsideTextInput, {
39785
+ }, !!label && /*#__PURE__*/React__default.createElement(StyledLabelInsideTextInput, {
39412
39786
  style: {
39413
39787
  backgroundColor: theme.__hd__.textInput.colors.labelBackground
39414
39788
  },
39789
+ testID: "input-label",
39415
39790
  themeState: state
39416
- }, "*"), !!label && /*#__PURE__*/React__default.createElement(StyledLabelInsideTextInput, {
39791
+ }, required && /*#__PURE__*/React__default.createElement(StyledAsteriskLabelInsideTextInput, {
39417
39792
  style: {
39418
39793
  backgroundColor: theme.__hd__.textInput.colors.labelBackground
39419
39794
  },
39420
- testID: "input-label",
39421
- themeState: state,
39422
- onLayout: onLabelLayout
39423
- }, label)), /*#__PURE__*/React__default.createElement(StyledTextInputContainer, {
39795
+ themeState: state
39796
+ }, "*"), label)), /*#__PURE__*/React__default.createElement(StyledTextInputContainer, {
39424
39797
  onLayout: onLayout
39425
39798
  }, /*#__PURE__*/React__default.createElement(StyledBorderBackDrop, {
39426
39799
  themeState: state,
@@ -40029,4 +40402,4 @@ var FloatingIsland = function FloatingIsland(_ref2) {
40029
40402
  }));
40030
40403
  };
40031
40404
 
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 };
40405
+ 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, ehWorkDarkPalette, getTheme$1 as getTheme, jobsSystemPalette, scale, swagDarkSystemPalette, swagLightJobsSystemPalette, swagSystemPalette as swagLightSystemPalette, swagSystemPalette$1 as swagSystemPalette, defaultTheme as theme, useAvatarColors, useTheme, walletSystemPalette, withTheme, workSystemPalette };