@hero-design/rn 8.63.0 → 9.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/es/index.js +1313 -1370
  3. package/lib/index.js +1313 -1370
  4. package/package.json +18 -18
  5. package/src/components/Tabs/ScrollableTabs.tsx +5 -3
  6. package/src/components/Tabs/StyledScrollableTabs.tsx +0 -6
  7. package/src/components/Tabs/StyledTabs.tsx +0 -8
  8. package/src/components/Tabs/index.tsx +6 -3
  9. package/types/components/Accordion/StyledAccordion.d.ts +0 -1
  10. package/types/components/Alert/StyledAlert.d.ts +0 -1
  11. package/types/components/Attachment/StyledAttachment.d.ts +0 -1
  12. package/types/components/Avatar/AvatarStack/StyledAvatarStack.d.ts +0 -1
  13. package/types/components/Avatar/StyledAvatar.d.ts +0 -1
  14. package/types/components/Avatar/index.d.ts +0 -1
  15. package/types/components/Badge/StyledBadge.d.ts +0 -1
  16. package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +0 -1
  17. package/types/components/BottomSheet/BottomSheetContext.d.ts +0 -1
  18. package/types/components/BottomSheet/ScrollView.d.ts +0 -1
  19. package/types/components/BottomSheet/StyledBottomSheet.d.ts +0 -1
  20. package/types/components/Box/StyledBox.d.ts +0 -1
  21. package/types/components/Box/types.d.ts +0 -1
  22. package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +0 -1
  23. package/types/components/Button/StyledButton.d.ts +0 -1
  24. package/types/components/Button/UtilityButton/StyledUtilityButton.d.ts +0 -1
  25. package/types/components/Calendar/StyledCalendar.d.ts +1 -2
  26. package/types/components/Card/DataCard/StyledDataCard.d.ts +0 -1
  27. package/types/components/Card/StyledCard.d.ts +0 -1
  28. package/types/components/Carousel/StyledCardCarousel.d.ts +0 -1
  29. package/types/components/Carousel/StyledCarousel.d.ts +0 -1
  30. package/types/components/Checkbox/StyledCheckbox.d.ts +0 -1
  31. package/types/components/Chip/StyledChip.d.ts +0 -1
  32. package/types/components/Collapse/StyledCollapse.d.ts +0 -1
  33. package/types/components/ContentNavigator/StyledContentNavigator.d.ts +0 -1
  34. package/types/components/DatePicker/StyledDatePicker.d.ts +0 -1
  35. package/types/components/Divider/StyledDivider.d.ts +0 -1
  36. package/types/components/Drawer/StyledDrawer.d.ts +0 -1
  37. package/types/components/Empty/StyledEmpty.d.ts +0 -1
  38. package/types/components/Error/StyledError.d.ts +0 -1
  39. package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +0 -1
  40. package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +0 -1
  41. package/types/components/FAB/StyledFAB.d.ts +0 -1
  42. package/types/components/FAB/index.d.ts +0 -1
  43. package/types/components/Icon/HeroIcon/index.d.ts +0 -1
  44. package/types/components/Icon/utils.d.ts +1 -1
  45. package/types/components/Image/index.d.ts +0 -1
  46. package/types/components/List/StyledBasicListItem.d.ts +0 -1
  47. package/types/components/List/StyledListItem.d.ts +0 -1
  48. package/types/components/PageControl/StyledPageControl.d.ts +0 -1
  49. package/types/components/PinInput/StyledPinInput.d.ts +0 -1
  50. package/types/components/Progress/ProgressBar.d.ts +0 -1
  51. package/types/components/Progress/StyledProgressBar.d.ts +0 -1
  52. package/types/components/Progress/StyledProgressCircle.d.ts +0 -1
  53. package/types/components/Progress/index.d.ts +0 -1
  54. package/types/components/Radio/StyledRadio.d.ts +0 -1
  55. package/types/components/Radio/index.d.ts +0 -1
  56. package/types/components/Rate/StyledRate.d.ts +0 -1
  57. package/types/components/RichTextEditor/StyledRichTextEditor.d.ts +0 -1
  58. package/types/components/RichTextEditor/StyledToolbar.d.ts +0 -1
  59. package/types/components/RichTextEditor/index.d.ts +0 -1
  60. package/types/components/SectionHeading/StyledHeading.d.ts +0 -1
  61. package/types/components/Select/SingleSelect/StyledSingleSelect.d.ts +0 -1
  62. package/types/components/Select/StyledSelect.d.ts +0 -1
  63. package/types/components/Select/index.d.ts +0 -1
  64. package/types/components/Skeleton/StyledSkeleton.d.ts +0 -1
  65. package/types/components/Spinner/StyledSpinner.d.ts +0 -1
  66. package/types/components/Success/StyledSuccess.d.ts +0 -1
  67. package/types/components/Swipeable/StyledSwipeable.d.ts +0 -1
  68. package/types/components/Switch/SelectorSwitch/StyledSelectorSwitch.d.ts +0 -1
  69. package/types/components/Switch/StyledSwitch.d.ts +0 -1
  70. package/types/components/Tabs/StyledScrollableTabs.d.ts +1 -9
  71. package/types/components/Tabs/StyledTabs.d.ts +1 -7
  72. package/types/components/Tag/StyledTag.d.ts +0 -1
  73. package/types/components/TextInput/StyledTextInput.d.ts +0 -1
  74. package/types/components/TextInput/index.d.ts +3 -3
  75. package/types/components/TimePicker/StyledTimePicker.d.ts +0 -1
  76. package/types/components/Toast/StyledToast.d.ts +0 -1
  77. package/types/components/Toast/Toast.d.ts +0 -1
  78. package/types/components/Toast/ToastContext.d.ts +0 -1
  79. package/types/components/Toast/index.d.ts +0 -1
  80. package/types/components/Toolbar/StyledToolbar.d.ts +0 -1
  81. package/types/components/Typography/Body/StyledBody.d.ts +0 -1
  82. package/types/components/Typography/Caption/StyledCaption.d.ts +0 -1
  83. package/types/components/Typography/Label/StyledLabel.d.ts +0 -1
  84. package/types/components/Typography/Text/StyledText.d.ts +0 -1
  85. package/types/components/Typography/Title/StyledTitle.d.ts +0 -1
  86. package/types/testHelpers/renderWithTheme.d.ts +0 -1
  87. package/types/theme/ThemeProvider.d.ts +0 -1
  88. package/.turbo/turbo-build.log +0 -5
package/lib/index.js CHANGED
@@ -392,14 +392,14 @@ function _regeneratorRuntime() {
392
392
  }
393
393
  }, e;
394
394
  }
395
- function _typeof(o) {
395
+ function _typeof$1(o) {
396
396
  "@babel/helpers - typeof";
397
397
 
398
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
398
+ return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
399
399
  return typeof o;
400
400
  } : function (o) {
401
401
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
402
- }, _typeof(o);
402
+ }, _typeof$1(o);
403
403
  }
404
404
  function _classCallCheck(instance, Constructor) {
405
405
  if (!(instance instanceof Constructor)) {
@@ -5366,8 +5366,8 @@ var camelize = function camelize(obj) {
5366
5366
  return walk(obj);
5367
5367
  };
5368
5368
  function walk(obj) {
5369
- if (!obj || _typeof(obj) !== 'object') return obj;
5370
- if (isDate(obj) || isRegex(obj)) return obj;
5369
+ if (!obj || _typeof$1(obj) !== 'object') return obj;
5370
+ if (isDate$1(obj) || isRegex(obj)) return obj;
5371
5371
  if (isArray(obj)) return map(obj, walk);
5372
5372
  return reduce(objectKeys(obj), function (acc, key) {
5373
5373
  var camel = camelCase(key);
@@ -5383,7 +5383,7 @@ function camelCase(str) {
5383
5383
  var isArray = Array.isArray || function (obj) {
5384
5384
  return Object.prototype.toString.call(obj) === '[object Array]';
5385
5385
  };
5386
- var isDate = function isDate(obj) {
5386
+ var isDate$1 = function isDate(obj) {
5387
5387
  return Object.prototype.toString.call(obj) === '[object Date]';
5388
5388
  };
5389
5389
  var isRegex = function isRegex(obj) {
@@ -5716,7 +5716,7 @@ var cssColorKeywords = require$$0;
5716
5716
  value: true
5717
5717
  });
5718
5718
  function _interopDefault(ex) {
5719
- return ex && _typeof(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
5719
+ return ex && _typeof$1(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
5720
5720
  }
5721
5721
  var parse = lib$1;
5722
5722
  var parse__default = _interopDefault(parse);
@@ -6436,7 +6436,7 @@ var generated = {};
6436
6436
  var buffer = '';
6437
6437
  var lastType;
6438
6438
  function handleInterpolation(interpolation, i, arr) {
6439
- var type = _typeof(interpolation);
6439
+ var type = _typeof$1(interpolation);
6440
6440
  if (type === 'string') {
6441
6441
  // strip comments
6442
6442
  interpolation = interpolation.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '');
@@ -8453,7 +8453,7 @@ var BottomNavigationContainer = index$9(reactNative.View)({
8453
8453
  flex: 1,
8454
8454
  overflow: 'hidden'
8455
8455
  });
8456
- var ContentWrapper$2 = index$9(reactNative.View)({
8456
+ var ContentWrapper = index$9(reactNative.View)({
8457
8457
  flex: 1
8458
8458
  });
8459
8459
  var BottomBarWrapper = index$9(reactNative.View)(function (_ref2) {
@@ -8516,7 +8516,7 @@ var BottomNavigation = function BottomNavigation(_ref) {
8516
8516
  return [].concat(_toConsumableArray(loadedState), [selectedTabKey]);
8517
8517
  });
8518
8518
  }
8519
- return /*#__PURE__*/React__default["default"].createElement(BottomNavigationContainer, nativeProps, /*#__PURE__*/React__default["default"].createElement(ContentWrapper$2, null, tabs.map(function (tab) {
8519
+ return /*#__PURE__*/React__default["default"].createElement(BottomNavigationContainer, nativeProps, /*#__PURE__*/React__default["default"].createElement(ContentWrapper, null, tabs.map(function (tab) {
8520
8520
  var key = tab.key,
8521
8521
  component = tab.component,
8522
8522
  testID = tab.testID;
@@ -9328,12 +9328,59 @@ var BottomSheet$1 = Object.assign(BottomSheet, {
9328
9328
  ScrollView: BottomSheetScrollView
9329
9329
  });
9330
9330
 
9331
+ function _typeof(o) {
9332
+ "@babel/helpers - typeof";
9333
+
9334
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
9335
+ return typeof o;
9336
+ } : function (o) {
9337
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
9338
+ }, _typeof(o);
9339
+ }
9340
+
9331
9341
  function requiredArgs(required, args) {
9332
9342
  if (args.length < required) {
9333
9343
  throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
9334
9344
  }
9335
9345
  }
9336
9346
 
9347
+ /**
9348
+ * @name isDate
9349
+ * @category Common Helpers
9350
+ * @summary Is the given value a date?
9351
+ *
9352
+ * @description
9353
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
9354
+ *
9355
+ * @param {*} value - the value to check
9356
+ * @returns {boolean} true if the given value is a date
9357
+ * @throws {TypeError} 1 arguments required
9358
+ *
9359
+ * @example
9360
+ * // For a valid date:
9361
+ * const result = isDate(new Date())
9362
+ * //=> true
9363
+ *
9364
+ * @example
9365
+ * // For an invalid date:
9366
+ * const result = isDate(new Date(NaN))
9367
+ * //=> true
9368
+ *
9369
+ * @example
9370
+ * // For some value:
9371
+ * const result = isDate('2014-02-31')
9372
+ * //=> false
9373
+ *
9374
+ * @example
9375
+ * // For an object:
9376
+ * const result = isDate({})
9377
+ * //=> false
9378
+ */
9379
+ function isDate(value) {
9380
+ requiredArgs(1, arguments);
9381
+ return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
9382
+ }
9383
+
9337
9384
  /**
9338
9385
  * @name toDate
9339
9386
  * @category Common Helpers
@@ -9364,11 +9411,11 @@ function requiredArgs(required, args) {
9364
9411
  * const result = toDate(1392098430000)
9365
9412
  * //=> Tue Feb 11 2014 11:30:30
9366
9413
  */
9367
-
9368
9414
  function toDate(argument) {
9369
9415
  requiredArgs(1, arguments);
9370
- var argStr = Object.prototype.toString.call(argument); // Clone the date
9416
+ var argStr = Object.prototype.toString.call(argument);
9371
9417
 
9418
+ // Clone the date
9372
9419
  if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
9373
9420
  // Prevent the date to lose the milliseconds when passed to new Date() in IE10
9374
9421
  return new Date(argument.getTime());
@@ -9377,8 +9424,8 @@ function toDate(argument) {
9377
9424
  } else {
9378
9425
  if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
9379
9426
  // eslint-disable-next-line no-console
9380
- 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
9381
-
9427
+ 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");
9428
+ // eslint-disable-next-line no-console
9382
9429
  console.warn(new Error().stack);
9383
9430
  }
9384
9431
  return new Date(NaN);
@@ -9397,616 +9444,235 @@ function toDate(argument) {
9397
9444
  *
9398
9445
  * Time value of Date: http://es5.github.io/#x15.9.1.1
9399
9446
  *
9400
- * ### v2.0.0 breaking changes:
9401
- *
9402
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
9403
- *
9404
- * - Now `isValid` doesn't throw an exception
9405
- * if the first argument is not an instance of Date.
9406
- * Instead, argument is converted beforehand using `toDate`.
9407
- *
9408
- * Examples:
9409
- *
9410
- * | `isValid` argument | Before v2.0.0 | v2.0.0 onward |
9411
- * |---------------------------|---------------|---------------|
9412
- * | `new Date()` | `true` | `true` |
9413
- * | `new Date('2016-01-01')` | `true` | `true` |
9414
- * | `new Date('')` | `false` | `false` |
9415
- * | `new Date(1488370835081)` | `true` | `true` |
9416
- * | `new Date(NaN)` | `false` | `false` |
9417
- * | `'2016-01-01'` | `TypeError` | `false` |
9418
- * | `''` | `TypeError` | `false` |
9419
- * | `1488370835081` | `TypeError` | `true` |
9420
- * | `NaN` | `TypeError` | `false` |
9421
- *
9422
- * We introduce this change to make *date-fns* consistent with ECMAScript behavior
9423
- * that try to coerce arguments to the expected type
9424
- * (which is also the case with other *date-fns* functions).
9425
- *
9426
9447
  * @param {*} date - the date to check
9427
9448
  * @returns {Boolean} the date is valid
9428
9449
  * @throws {TypeError} 1 argument required
9429
9450
  *
9430
9451
  * @example
9431
9452
  * // For the valid date:
9432
- * var result = isValid(new Date(2014, 1, 31))
9453
+ * const result = isValid(new Date(2014, 1, 31))
9433
9454
  * //=> true
9434
9455
  *
9435
9456
  * @example
9436
9457
  * // For the value, convertable into a date:
9437
- * var result = isValid(1393804800000)
9458
+ * const result = isValid(1393804800000)
9438
9459
  * //=> true
9439
9460
  *
9440
9461
  * @example
9441
9462
  * // For the invalid date:
9442
- * var result = isValid(new Date(''))
9463
+ * const result = isValid(new Date(''))
9443
9464
  * //=> false
9444
9465
  */
9445
-
9446
9466
  function isValid(dirtyDate) {
9447
9467
  requiredArgs(1, arguments);
9468
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
9469
+ return false;
9470
+ }
9448
9471
  var date = toDate(dirtyDate);
9449
- return !isNaN(date);
9472
+ return !isNaN(Number(date));
9450
9473
  }
9451
9474
 
9452
- var formatDistanceLocale = {
9453
- lessThanXSeconds: {
9454
- one: 'less than a second',
9455
- other: 'less than {{count}} seconds'
9456
- },
9457
- xSeconds: {
9458
- one: '1 second',
9459
- other: '{{count}} seconds'
9460
- },
9461
- halfAMinute: 'half a minute',
9462
- lessThanXMinutes: {
9463
- one: 'less than a minute',
9464
- other: 'less than {{count}} minutes'
9465
- },
9466
- xMinutes: {
9467
- one: '1 minute',
9468
- other: '{{count}} minutes'
9469
- },
9470
- aboutXHours: {
9471
- one: 'about 1 hour',
9472
- other: 'about {{count}} hours'
9473
- },
9474
- xHours: {
9475
- one: '1 hour',
9476
- other: '{{count}} hours'
9477
- },
9478
- xDays: {
9479
- one: '1 day',
9480
- other: '{{count}} days'
9481
- },
9482
- aboutXWeeks: {
9483
- one: 'about 1 week',
9484
- other: 'about {{count}} weeks'
9485
- },
9486
- xWeeks: {
9487
- one: '1 week',
9488
- other: '{{count}} weeks'
9489
- },
9490
- aboutXMonths: {
9491
- one: 'about 1 month',
9492
- other: 'about {{count}} months'
9493
- },
9494
- xMonths: {
9495
- one: '1 month',
9496
- other: '{{count}} months'
9497
- },
9498
- aboutXYears: {
9499
- one: 'about 1 year',
9500
- other: 'about {{count}} years'
9501
- },
9502
- xYears: {
9503
- one: '1 year',
9504
- other: '{{count}} years'
9505
- },
9506
- overXYears: {
9507
- one: 'over 1 year',
9508
- other: 'over {{count}} years'
9509
- },
9510
- almostXYears: {
9511
- one: 'almost 1 year',
9512
- other: 'almost {{count}} years'
9513
- }
9514
- };
9515
- function formatDistance(token, count, options) {
9516
- options = options || {};
9517
- var result;
9518
- if (typeof formatDistanceLocale[token] === 'string') {
9519
- result = formatDistanceLocale[token];
9520
- } else if (count === 1) {
9521
- result = formatDistanceLocale[token].one;
9522
- } else {
9523
- result = formatDistanceLocale[token].other.replace('{{count}}', count);
9475
+ function toInteger(dirtyNumber) {
9476
+ if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
9477
+ return NaN;
9524
9478
  }
9525
- if (options.addSuffix) {
9526
- if (options.comparison > 0) {
9527
- return 'in ' + result;
9528
- } else {
9529
- return result + ' ago';
9530
- }
9479
+ var number = Number(dirtyNumber);
9480
+ if (isNaN(number)) {
9481
+ return number;
9531
9482
  }
9532
- return result;
9483
+ return number < 0 ? Math.ceil(number) : Math.floor(number);
9533
9484
  }
9534
9485
 
9535
- function buildFormatLongFn(args) {
9536
- return function (dirtyOptions) {
9537
- var options = dirtyOptions || {};
9538
- var width = options.width ? String(options.width) : args.defaultWidth;
9539
- var format = args.formats[width] || args.formats[args.defaultWidth];
9540
- return format;
9541
- };
9486
+ /**
9487
+ * @name addMilliseconds
9488
+ * @category Millisecond Helpers
9489
+ * @summary Add the specified number of milliseconds to the given date.
9490
+ *
9491
+ * @description
9492
+ * Add the specified number of milliseconds to the given date.
9493
+ *
9494
+ * @param {Date|Number} date - the date to be changed
9495
+ * @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`.
9496
+ * @returns {Date} the new date with the milliseconds added
9497
+ * @throws {TypeError} 2 arguments required
9498
+ *
9499
+ * @example
9500
+ * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
9501
+ * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
9502
+ * //=> Thu Jul 10 2014 12:45:30.750
9503
+ */
9504
+ function addMilliseconds(dirtyDate, dirtyAmount) {
9505
+ requiredArgs(2, arguments);
9506
+ var timestamp = toDate(dirtyDate).getTime();
9507
+ var amount = toInteger(dirtyAmount);
9508
+ return new Date(timestamp + amount);
9542
9509
  }
9543
9510
 
9544
- var dateFormats = {
9545
- full: 'EEEE, MMMM do, y',
9546
- "long": 'MMMM do, y',
9547
- medium: 'MMM d, y',
9548
- "short": 'MM/dd/yyyy'
9549
- };
9550
- var timeFormats = {
9551
- full: 'h:mm:ss a zzzz',
9552
- "long": 'h:mm:ss a z',
9553
- medium: 'h:mm:ss a',
9554
- "short": 'h:mm a'
9555
- };
9556
- var dateTimeFormats = {
9557
- full: "{{date}} 'at' {{time}}",
9558
- "long": "{{date}} 'at' {{time}}",
9559
- medium: '{{date}}, {{time}}',
9560
- "short": '{{date}}, {{time}}'
9561
- };
9562
- var formatLong = {
9563
- date: buildFormatLongFn({
9564
- formats: dateFormats,
9565
- defaultWidth: 'full'
9566
- }),
9567
- time: buildFormatLongFn({
9568
- formats: timeFormats,
9569
- defaultWidth: 'full'
9570
- }),
9571
- dateTime: buildFormatLongFn({
9572
- formats: dateTimeFormats,
9573
- defaultWidth: 'full'
9574
- })
9575
- };
9576
- var formatLong$1 = formatLong;
9577
-
9578
- var formatRelativeLocale = {
9579
- lastWeek: "'last' eeee 'at' p",
9580
- yesterday: "'yesterday at' p",
9581
- today: "'today at' p",
9582
- tomorrow: "'tomorrow at' p",
9583
- nextWeek: "eeee 'at' p",
9584
- other: 'P'
9585
- };
9586
- function formatRelative(token, _date, _baseDate, _options) {
9587
- return formatRelativeLocale[token];
9511
+ /**
9512
+ * @name subMilliseconds
9513
+ * @category Millisecond Helpers
9514
+ * @summary Subtract the specified number of milliseconds from the given date.
9515
+ *
9516
+ * @description
9517
+ * Subtract the specified number of milliseconds from the given date.
9518
+ *
9519
+ * @param {Date|Number} date - the date to be changed
9520
+ * @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`.
9521
+ * @returns {Date} the new date with the milliseconds subtracted
9522
+ * @throws {TypeError} 2 arguments required
9523
+ *
9524
+ * @example
9525
+ * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
9526
+ * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
9527
+ * //=> Thu Jul 10 2014 12:45:29.250
9528
+ */
9529
+ function subMilliseconds(dirtyDate, dirtyAmount) {
9530
+ requiredArgs(2, arguments);
9531
+ var amount = toInteger(dirtyAmount);
9532
+ return addMilliseconds(dirtyDate, -amount);
9588
9533
  }
9589
9534
 
9590
- function buildLocalizeFn(args) {
9591
- return function (dirtyIndex, dirtyOptions) {
9592
- var options = dirtyOptions || {};
9593
- var context = options.context ? String(options.context) : 'standalone';
9594
- var valuesArray;
9595
- if (context === 'formatting' && args.formattingValues) {
9596
- var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
9597
- var width = options.width ? String(options.width) : defaultWidth;
9598
- valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
9599
- } else {
9600
- var _defaultWidth = args.defaultWidth;
9601
- var _width = options.width ? String(options.width) : args.defaultWidth;
9602
- valuesArray = args.values[_width] || args.values[_defaultWidth];
9603
- }
9604
- var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
9605
- return valuesArray[index];
9606
- };
9535
+ var MILLISECONDS_IN_DAY = 86400000;
9536
+ function getUTCDayOfYear(dirtyDate) {
9537
+ requiredArgs(1, arguments);
9538
+ var date = toDate(dirtyDate);
9539
+ var timestamp = date.getTime();
9540
+ date.setUTCMonth(0, 1);
9541
+ date.setUTCHours(0, 0, 0, 0);
9542
+ var startOfYearTimestamp = date.getTime();
9543
+ var difference = timestamp - startOfYearTimestamp;
9544
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
9607
9545
  }
9608
9546
 
9609
- var eraValues = {
9610
- narrow: ['B', 'A'],
9611
- abbreviated: ['BC', 'AD'],
9612
- wide: ['Before Christ', 'Anno Domini']
9613
- };
9614
- var quarterValues = {
9615
- narrow: ['1', '2', '3', '4'],
9616
- abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
9617
- wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter'] // Note: in English, the names of days of the week and months are capitalized.
9618
- // If you are making a new locale based on this one, check if the same is true for the language you're working on.
9619
- // Generally, formatted dates should look like they are in the middle of a sentence,
9620
- // e.g. in Spanish language the weekdays and months should be in the lowercase.
9621
- };
9547
+ function startOfUTCISOWeek(dirtyDate) {
9548
+ requiredArgs(1, arguments);
9549
+ var weekStartsOn = 1;
9550
+ var date = toDate(dirtyDate);
9551
+ var day = date.getUTCDay();
9552
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
9553
+ date.setUTCDate(date.getUTCDate() - diff);
9554
+ date.setUTCHours(0, 0, 0, 0);
9555
+ return date;
9556
+ }
9622
9557
 
9623
- var monthValues = {
9624
- narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
9625
- abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
9626
- wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
9627
- };
9628
- var dayValues = {
9629
- narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
9630
- "short": ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
9631
- abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
9632
- wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
9633
- };
9634
- var dayPeriodValues = {
9635
- narrow: {
9636
- am: 'a',
9637
- pm: 'p',
9638
- midnight: 'mi',
9639
- noon: 'n',
9640
- morning: 'morning',
9641
- afternoon: 'afternoon',
9642
- evening: 'evening',
9643
- night: 'night'
9644
- },
9645
- abbreviated: {
9646
- am: 'AM',
9647
- pm: 'PM',
9648
- midnight: 'midnight',
9649
- noon: 'noon',
9650
- morning: 'morning',
9651
- afternoon: 'afternoon',
9652
- evening: 'evening',
9653
- night: 'night'
9654
- },
9655
- wide: {
9656
- am: 'a.m.',
9657
- pm: 'p.m.',
9658
- midnight: 'midnight',
9659
- noon: 'noon',
9660
- morning: 'morning',
9661
- afternoon: 'afternoon',
9662
- evening: 'evening',
9663
- night: 'night'
9664
- }
9665
- };
9666
- var formattingDayPeriodValues = {
9667
- narrow: {
9668
- am: 'a',
9669
- pm: 'p',
9670
- midnight: 'mi',
9671
- noon: 'n',
9672
- morning: 'in the morning',
9673
- afternoon: 'in the afternoon',
9674
- evening: 'in the evening',
9675
- night: 'at night'
9676
- },
9677
- abbreviated: {
9678
- am: 'AM',
9679
- pm: 'PM',
9680
- midnight: 'midnight',
9681
- noon: 'noon',
9682
- morning: 'in the morning',
9683
- afternoon: 'in the afternoon',
9684
- evening: 'in the evening',
9685
- night: 'at night'
9686
- },
9687
- wide: {
9688
- am: 'a.m.',
9689
- pm: 'p.m.',
9690
- midnight: 'midnight',
9691
- noon: 'noon',
9692
- morning: 'in the morning',
9693
- afternoon: 'in the afternoon',
9694
- evening: 'in the evening',
9695
- night: 'at night'
9558
+ function getUTCISOWeekYear(dirtyDate) {
9559
+ requiredArgs(1, arguments);
9560
+ var date = toDate(dirtyDate);
9561
+ var year = date.getUTCFullYear();
9562
+ var fourthOfJanuaryOfNextYear = new Date(0);
9563
+ fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
9564
+ fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
9565
+ var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
9566
+ var fourthOfJanuaryOfThisYear = new Date(0);
9567
+ fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
9568
+ fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
9569
+ var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
9570
+ if (date.getTime() >= startOfNextYear.getTime()) {
9571
+ return year + 1;
9572
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
9573
+ return year;
9574
+ } else {
9575
+ return year - 1;
9696
9576
  }
9697
- };
9698
- function ordinalNumber(dirtyNumber, _dirtyOptions) {
9699
- var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
9700
- // if they are different for different grammatical genders,
9701
- // use `options.unit`:
9702
- //
9703
- // var options = dirtyOptions || {}
9704
- // var unit = String(options.unit)
9705
- //
9706
- // where `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
9707
- // 'day', 'hour', 'minute', 'second'
9577
+ }
9708
9578
 
9709
- var rem100 = number % 100;
9710
- if (rem100 > 20 || rem100 < 10) {
9711
- switch (rem100 % 10) {
9712
- case 1:
9713
- return number + 'st';
9714
- case 2:
9715
- return number + 'nd';
9716
- case 3:
9717
- return number + 'rd';
9718
- }
9719
- }
9720
- return number + 'th';
9579
+ function startOfUTCISOWeekYear(dirtyDate) {
9580
+ requiredArgs(1, arguments);
9581
+ var year = getUTCISOWeekYear(dirtyDate);
9582
+ var fourthOfJanuary = new Date(0);
9583
+ fourthOfJanuary.setUTCFullYear(year, 0, 4);
9584
+ fourthOfJanuary.setUTCHours(0, 0, 0, 0);
9585
+ var date = startOfUTCISOWeek(fourthOfJanuary);
9586
+ return date;
9721
9587
  }
9722
- var localize = {
9723
- ordinalNumber: ordinalNumber,
9724
- era: buildLocalizeFn({
9725
- values: eraValues,
9726
- defaultWidth: 'wide'
9727
- }),
9728
- quarter: buildLocalizeFn({
9729
- values: quarterValues,
9730
- defaultWidth: 'wide',
9731
- argumentCallback: function argumentCallback(quarter) {
9732
- return Number(quarter) - 1;
9733
- }
9734
- }),
9735
- month: buildLocalizeFn({
9736
- values: monthValues,
9737
- defaultWidth: 'wide'
9738
- }),
9739
- day: buildLocalizeFn({
9740
- values: dayValues,
9741
- defaultWidth: 'wide'
9742
- }),
9743
- dayPeriod: buildLocalizeFn({
9744
- values: dayPeriodValues,
9745
- defaultWidth: 'wide',
9746
- formattingValues: formattingDayPeriodValues,
9747
- defaultFormattingWidth: 'wide'
9748
- })
9749
- };
9750
- var localize$1 = localize;
9751
9588
 
9752
- function buildMatchPatternFn(args) {
9753
- return function (dirtyString, dirtyOptions) {
9754
- var string = String(dirtyString);
9755
- var options = dirtyOptions || {};
9756
- var matchResult = string.match(args.matchPattern);
9757
- if (!matchResult) {
9758
- return null;
9759
- }
9760
- var matchedString = matchResult[0];
9761
- var parseResult = string.match(args.parsePattern);
9762
- if (!parseResult) {
9763
- return null;
9764
- }
9765
- var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
9766
- value = options.valueCallback ? options.valueCallback(value) : value;
9767
- return {
9768
- value: value,
9769
- rest: string.slice(matchedString.length)
9770
- };
9771
- };
9589
+ var MILLISECONDS_IN_WEEK$1 = 604800000;
9590
+ function getUTCISOWeek(dirtyDate) {
9591
+ requiredArgs(1, arguments);
9592
+ var date = toDate(dirtyDate);
9593
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
9594
+
9595
+ // Round the number of days to the nearest integer
9596
+ // because the number of milliseconds in a week is not constant
9597
+ // (e.g. it's different in the week of the daylight saving time clock shift)
9598
+ return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
9772
9599
  }
9773
9600
 
9774
- function buildMatchFn(args) {
9775
- return function (dirtyString, dirtyOptions) {
9776
- var string = String(dirtyString);
9777
- var options = dirtyOptions || {};
9778
- var width = options.width;
9779
- var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
9780
- var matchResult = string.match(matchPattern);
9781
- if (!matchResult) {
9782
- return null;
9783
- }
9784
- var matchedString = matchResult[0];
9785
- var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
9786
- var value;
9787
- if (Object.prototype.toString.call(parsePatterns) === '[object Array]') {
9788
- value = findIndex(parsePatterns, function (pattern) {
9789
- return pattern.test(matchedString);
9790
- });
9791
- } else {
9792
- value = findKey(parsePatterns, function (pattern) {
9793
- return pattern.test(matchedString);
9794
- });
9795
- }
9796
- value = args.valueCallback ? args.valueCallback(value) : value;
9797
- value = options.valueCallback ? options.valueCallback(value) : value;
9798
- return {
9799
- value: value,
9800
- rest: string.slice(matchedString.length)
9801
- };
9802
- };
9601
+ var defaultOptions = {};
9602
+ function getDefaultOptions() {
9603
+ return defaultOptions;
9803
9604
  }
9804
- function findKey(object, predicate) {
9805
- for (var key in object) {
9806
- if (object.hasOwnProperty(key) && predicate(object[key])) {
9807
- return key;
9808
- }
9605
+
9606
+ function startOfUTCWeek(dirtyDate, options) {
9607
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
9608
+ requiredArgs(1, arguments);
9609
+ var defaultOptions = getDefaultOptions();
9610
+ 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);
9611
+
9612
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
9613
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
9614
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
9809
9615
  }
9616
+ var date = toDate(dirtyDate);
9617
+ var day = date.getUTCDay();
9618
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
9619
+ date.setUTCDate(date.getUTCDate() - diff);
9620
+ date.setUTCHours(0, 0, 0, 0);
9621
+ return date;
9810
9622
  }
9811
- function findIndex(array, predicate) {
9812
- for (var key = 0; key < array.length; key++) {
9813
- if (predicate(array[key])) {
9814
- return key;
9815
- }
9623
+
9624
+ function getUTCWeekYear(dirtyDate, options) {
9625
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
9626
+ requiredArgs(1, arguments);
9627
+ var date = toDate(dirtyDate);
9628
+ var year = date.getUTCFullYear();
9629
+ var defaultOptions = getDefaultOptions();
9630
+ 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);
9631
+
9632
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
9633
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
9634
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
9635
+ }
9636
+ var firstWeekOfNextYear = new Date(0);
9637
+ firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
9638
+ firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
9639
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
9640
+ var firstWeekOfThisYear = new Date(0);
9641
+ firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
9642
+ firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
9643
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
9644
+ if (date.getTime() >= startOfNextYear.getTime()) {
9645
+ return year + 1;
9646
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
9647
+ return year;
9648
+ } else {
9649
+ return year - 1;
9816
9650
  }
9817
9651
  }
9818
9652
 
9819
- var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
9820
- var parseOrdinalNumberPattern = /\d+/i;
9821
- var matchEraPatterns = {
9822
- narrow: /^(b|a)/i,
9823
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
9824
- wide: /^(before christ|before common era|anno domini|common era)/i
9825
- };
9826
- var parseEraPatterns = {
9827
- any: [/^b/i, /^(a|c)/i]
9828
- };
9829
- var matchQuarterPatterns = {
9830
- narrow: /^[1234]/i,
9831
- abbreviated: /^q[1234]/i,
9832
- wide: /^[1234](th|st|nd|rd)? quarter/i
9833
- };
9834
- var parseQuarterPatterns = {
9835
- any: [/1/i, /2/i, /3/i, /4/i]
9836
- };
9837
- var matchMonthPatterns = {
9838
- narrow: /^[jfmasond]/i,
9839
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
9840
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
9841
- };
9842
- var parseMonthPatterns = {
9843
- 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],
9844
- 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]
9845
- };
9846
- var matchDayPatterns = {
9847
- narrow: /^[smtwf]/i,
9848
- "short": /^(su|mo|tu|we|th|fr|sa)/i,
9849
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
9850
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
9851
- };
9852
- var parseDayPatterns = {
9853
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
9854
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
9855
- };
9856
- var matchDayPeriodPatterns = {
9857
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
9858
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
9859
- };
9860
- var parseDayPeriodPatterns = {
9861
- any: {
9862
- am: /^a/i,
9863
- pm: /^p/i,
9864
- midnight: /^mi/i,
9865
- noon: /^no/i,
9866
- morning: /morning/i,
9867
- afternoon: /afternoon/i,
9868
- evening: /evening/i,
9869
- night: /night/i
9870
- }
9871
- };
9872
- var match = {
9873
- ordinalNumber: buildMatchPatternFn({
9874
- matchPattern: matchOrdinalNumberPattern,
9875
- parsePattern: parseOrdinalNumberPattern,
9876
- valueCallback: function valueCallback(value) {
9877
- return parseInt(value, 10);
9878
- }
9879
- }),
9880
- era: buildMatchFn({
9881
- matchPatterns: matchEraPatterns,
9882
- defaultMatchWidth: 'wide',
9883
- parsePatterns: parseEraPatterns,
9884
- defaultParseWidth: 'any'
9885
- }),
9886
- quarter: buildMatchFn({
9887
- matchPatterns: matchQuarterPatterns,
9888
- defaultMatchWidth: 'wide',
9889
- parsePatterns: parseQuarterPatterns,
9890
- defaultParseWidth: 'any',
9891
- valueCallback: function valueCallback(index) {
9892
- return index + 1;
9893
- }
9894
- }),
9895
- month: buildMatchFn({
9896
- matchPatterns: matchMonthPatterns,
9897
- defaultMatchWidth: 'wide',
9898
- parsePatterns: parseMonthPatterns,
9899
- defaultParseWidth: 'any'
9900
- }),
9901
- day: buildMatchFn({
9902
- matchPatterns: matchDayPatterns,
9903
- defaultMatchWidth: 'wide',
9904
- parsePatterns: parseDayPatterns,
9905
- defaultParseWidth: 'any'
9906
- }),
9907
- dayPeriod: buildMatchFn({
9908
- matchPatterns: matchDayPeriodPatterns,
9909
- defaultMatchWidth: 'any',
9910
- parsePatterns: parseDayPeriodPatterns,
9911
- defaultParseWidth: 'any'
9912
- })
9913
- };
9914
- var match$1 = match;
9915
-
9916
- /**
9917
- * @type {Locale}
9918
- * @category Locales
9919
- * @summary English locale (United States).
9920
- * @language English
9921
- * @iso-639-2 eng
9922
- * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
9923
- * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
9924
- */
9925
-
9926
- var locale = {
9927
- code: 'en-US',
9928
- formatDistance: formatDistance,
9929
- formatLong: formatLong$1,
9930
- formatRelative: formatRelative,
9931
- localize: localize$1,
9932
- match: match$1,
9933
- options: {
9934
- weekStartsOn: 0
9935
- /* Sunday */,
9936
-
9937
- firstWeekContainsDate: 1
9938
- }
9939
- };
9940
- var defaultLocale = locale;
9941
-
9942
- function toInteger(dirtyNumber) {
9943
- if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
9944
- return NaN;
9945
- }
9946
- var number = Number(dirtyNumber);
9947
- if (isNaN(number)) {
9948
- return number;
9949
- }
9950
- return number < 0 ? Math.ceil(number) : Math.floor(number);
9951
- }
9952
-
9953
- /**
9954
- * @name addMilliseconds
9955
- * @category Millisecond Helpers
9956
- * @summary Add the specified number of milliseconds to the given date.
9957
- *
9958
- * @description
9959
- * Add the specified number of milliseconds to the given date.
9960
- *
9961
- * ### v2.0.0 breaking changes:
9962
- *
9963
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
9964
- *
9965
- * @param {Date|Number} date - the date to be changed
9966
- * @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`.
9967
- * @returns {Date} the new date with the milliseconds added
9968
- * @throws {TypeError} 2 arguments required
9969
- *
9970
- * @example
9971
- * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
9972
- * var result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
9973
- * //=> Thu Jul 10 2014 12:45:30.750
9974
- */
9975
-
9976
- function addMilliseconds(dirtyDate, dirtyAmount) {
9977
- requiredArgs(2, arguments);
9978
- var timestamp = toDate(dirtyDate).getTime();
9979
- var amount = toInteger(dirtyAmount);
9980
- return new Date(timestamp + amount);
9653
+ function startOfUTCWeekYear(dirtyDate, options) {
9654
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
9655
+ requiredArgs(1, arguments);
9656
+ var defaultOptions = getDefaultOptions();
9657
+ 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);
9658
+ var year = getUTCWeekYear(dirtyDate, options);
9659
+ var firstWeek = new Date(0);
9660
+ firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
9661
+ firstWeek.setUTCHours(0, 0, 0, 0);
9662
+ var date = startOfUTCWeek(firstWeek, options);
9663
+ return date;
9981
9664
  }
9982
9665
 
9983
- /**
9984
- * @name subMilliseconds
9985
- * @category Millisecond Helpers
9986
- * @summary Subtract the specified number of milliseconds from the given date.
9987
- *
9988
- * @description
9989
- * Subtract the specified number of milliseconds from the given date.
9990
- *
9991
- * ### v2.0.0 breaking changes:
9992
- *
9993
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
9994
- *
9995
- * @param {Date|Number} date - the date to be changed
9996
- * @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`.
9997
- * @returns {Date} the new date with the milliseconds subtracted
9998
- * @throws {TypeError} 2 arguments required
9999
- *
10000
- * @example
10001
- * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
10002
- * var result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
10003
- * //=> Thu Jul 10 2014 12:45:29.250
10004
- */
9666
+ var MILLISECONDS_IN_WEEK = 604800000;
9667
+ function getUTCWeek(dirtyDate, options) {
9668
+ requiredArgs(1, arguments);
9669
+ var date = toDate(dirtyDate);
9670
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
10005
9671
 
10006
- function subMilliseconds(dirtyDate, dirtyAmount) {
10007
- requiredArgs(2, arguments);
10008
- var amount = toInteger(dirtyAmount);
10009
- return addMilliseconds(dirtyDate, -amount);
9672
+ // Round the number of days to the nearest integer
9673
+ // because the number of milliseconds in a week is not constant
9674
+ // (e.g. it's different in the week of the daylight saving time clock shift)
9675
+ return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
10010
9676
  }
10011
9677
 
10012
9678
  function addLeadingZeros(number, targetLength) {
@@ -10030,7 +9696,6 @@ function addLeadingZeros(number, targetLength) {
10030
9696
  *
10031
9697
  * Letters marked by * are not implemented but reserved by Unicode standard.
10032
9698
  */
10033
-
10034
9699
  var formatters$2 = {
10035
9700
  // Year
10036
9701
  y: function y(date, token) {
@@ -10042,8 +9707,9 @@ var formatters$2 = {
10042
9707
  // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
10043
9708
  // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
10044
9709
  // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
10045
- var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
10046
9710
 
9711
+ var signedYear = date.getUTCFullYear();
9712
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
10047
9713
  var year = signedYear > 0 ? signedYear : 1 - signedYear;
10048
9714
  return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
10049
9715
  },
@@ -10062,8 +9728,9 @@ var formatters$2 = {
10062
9728
  switch (token) {
10063
9729
  case 'a':
10064
9730
  case 'aa':
10065
- case 'aaa':
10066
9731
  return dayPeriodEnumValue.toUpperCase();
9732
+ case 'aaa':
9733
+ return dayPeriodEnumValue;
10067
9734
  case 'aaaaa':
10068
9735
  return dayPeriodEnumValue[0];
10069
9736
  case 'aaaa':
@@ -10097,283 +9764,127 @@ var formatters$2 = {
10097
9764
  };
10098
9765
  var lightFormatters = formatters$2;
10099
9766
 
10100
- var MILLISECONDS_IN_DAY = 86400000; // This function will be a part of public API when UTC function will be implemented.
10101
- // See issue: https://github.com/date-fns/date-fns/issues/376
9767
+ var dayPeriodEnum = {
9768
+ am: 'am',
9769
+ pm: 'pm',
9770
+ midnight: 'midnight',
9771
+ noon: 'noon',
9772
+ morning: 'morning',
9773
+ afternoon: 'afternoon',
9774
+ evening: 'evening',
9775
+ night: 'night'
9776
+ };
9777
+ /*
9778
+ * | | Unit | | Unit |
9779
+ * |-----|--------------------------------|-----|--------------------------------|
9780
+ * | a | AM, PM | A* | Milliseconds in day |
9781
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
9782
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
9783
+ * | d | Day of month | D | Day of year |
9784
+ * | e | Local day of week | E | Day of week |
9785
+ * | f | | F* | Day of week in month |
9786
+ * | g* | Modified Julian day | G | Era |
9787
+ * | h | Hour [1-12] | H | Hour [0-23] |
9788
+ * | i! | ISO day of week | I! | ISO week of year |
9789
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
9790
+ * | k | Hour [1-24] | K | Hour [0-11] |
9791
+ * | l* | (deprecated) | L | Stand-alone month |
9792
+ * | m | Minute | M | Month |
9793
+ * | n | | N | |
9794
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
9795
+ * | p! | Long localized time | P! | Long localized date |
9796
+ * | q | Stand-alone quarter | Q | Quarter |
9797
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
9798
+ * | s | Second | S | Fraction of second |
9799
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
9800
+ * | u | Extended year | U* | Cyclic year |
9801
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
9802
+ * | w | Local week of year | W* | Week of month |
9803
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
9804
+ * | y | Year (abs) | Y | Local week-numbering year |
9805
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
9806
+ *
9807
+ * Letters marked by * are not implemented but reserved by Unicode standard.
9808
+ *
9809
+ * Letters marked by ! are non-standard, but implemented by date-fns:
9810
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
9811
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
9812
+ * i.e. 7 for Sunday, 1 for Monday, etc.
9813
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
9814
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
9815
+ * `R` is supposed to be used in conjunction with `I` and `i`
9816
+ * for universal ISO week-numbering date, whereas
9817
+ * `Y` is supposed to be used in conjunction with `w` and `e`
9818
+ * for week-numbering date specific to the locale.
9819
+ * - `P` is long localized date format
9820
+ * - `p` is long localized time format
9821
+ */
10102
9822
 
10103
- function getUTCDayOfYear(dirtyDate) {
10104
- requiredArgs(1, arguments);
10105
- var date = toDate(dirtyDate);
10106
- var timestamp = date.getTime();
10107
- date.setUTCMonth(0, 1);
10108
- date.setUTCHours(0, 0, 0, 0);
10109
- var startOfYearTimestamp = date.getTime();
10110
- var difference = timestamp - startOfYearTimestamp;
10111
- return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
10112
- }
9823
+ var formatters = {
9824
+ // Era
9825
+ G: function G(date, token, localize) {
9826
+ var era = date.getUTCFullYear() > 0 ? 1 : 0;
9827
+ switch (token) {
9828
+ // AD, BC
9829
+ case 'G':
9830
+ case 'GG':
9831
+ case 'GGG':
9832
+ return localize.era(era, {
9833
+ width: 'abbreviated'
9834
+ });
9835
+ // A, B
9836
+ case 'GGGGG':
9837
+ return localize.era(era, {
9838
+ width: 'narrow'
9839
+ });
9840
+ // Anno Domini, Before Christ
9841
+ case 'GGGG':
9842
+ default:
9843
+ return localize.era(era, {
9844
+ width: 'wide'
9845
+ });
9846
+ }
9847
+ },
9848
+ // Year
9849
+ y: function y(date, token, localize) {
9850
+ // Ordinal number
9851
+ if (token === 'yo') {
9852
+ var signedYear = date.getUTCFullYear();
9853
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
9854
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
9855
+ return localize.ordinalNumber(year, {
9856
+ unit: 'year'
9857
+ });
9858
+ }
9859
+ return lightFormatters.y(date, token);
9860
+ },
9861
+ // Local week-numbering year
9862
+ Y: function Y(date, token, localize, options) {
9863
+ var signedWeekYear = getUTCWeekYear(date, options);
9864
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
9865
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
10113
9866
 
10114
- // See issue: https://github.com/date-fns/date-fns/issues/376
9867
+ // Two digit year
9868
+ if (token === 'YY') {
9869
+ var twoDigitYear = weekYear % 100;
9870
+ return addLeadingZeros(twoDigitYear, 2);
9871
+ }
10115
9872
 
10116
- function startOfUTCISOWeek(dirtyDate) {
10117
- requiredArgs(1, arguments);
10118
- var weekStartsOn = 1;
10119
- var date = toDate(dirtyDate);
10120
- var day = date.getUTCDay();
10121
- var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
10122
- date.setUTCDate(date.getUTCDate() - diff);
10123
- date.setUTCHours(0, 0, 0, 0);
10124
- return date;
10125
- }
9873
+ // Ordinal number
9874
+ if (token === 'Yo') {
9875
+ return localize.ordinalNumber(weekYear, {
9876
+ unit: 'year'
9877
+ });
9878
+ }
10126
9879
 
10127
- // See issue: https://github.com/date-fns/date-fns/issues/376
10128
-
10129
- function getUTCISOWeekYear(dirtyDate) {
10130
- requiredArgs(1, arguments);
10131
- var date = toDate(dirtyDate);
10132
- var year = date.getUTCFullYear();
10133
- var fourthOfJanuaryOfNextYear = new Date(0);
10134
- fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
10135
- fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
10136
- var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
10137
- var fourthOfJanuaryOfThisYear = new Date(0);
10138
- fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
10139
- fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
10140
- var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
10141
- if (date.getTime() >= startOfNextYear.getTime()) {
10142
- return year + 1;
10143
- } else if (date.getTime() >= startOfThisYear.getTime()) {
10144
- return year;
10145
- } else {
10146
- return year - 1;
10147
- }
10148
- }
10149
-
10150
- // See issue: https://github.com/date-fns/date-fns/issues/376
10151
-
10152
- function startOfUTCISOWeekYear(dirtyDate) {
10153
- requiredArgs(1, arguments);
10154
- var year = getUTCISOWeekYear(dirtyDate);
10155
- var fourthOfJanuary = new Date(0);
10156
- fourthOfJanuary.setUTCFullYear(year, 0, 4);
10157
- fourthOfJanuary.setUTCHours(0, 0, 0, 0);
10158
- var date = startOfUTCISOWeek(fourthOfJanuary);
10159
- return date;
10160
- }
10161
-
10162
- var MILLISECONDS_IN_WEEK$1 = 604800000; // This function will be a part of public API when UTC function will be implemented.
10163
- // See issue: https://github.com/date-fns/date-fns/issues/376
10164
-
10165
- function getUTCISOWeek(dirtyDate) {
10166
- requiredArgs(1, arguments);
10167
- var date = toDate(dirtyDate);
10168
- var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer
10169
- // because the number of milliseconds in a week is not constant
10170
- // (e.g. it's different in the week of the daylight saving time clock shift)
10171
-
10172
- return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
10173
- }
10174
-
10175
- // See issue: https://github.com/date-fns/date-fns/issues/376
10176
-
10177
- function startOfUTCWeek(dirtyDate, dirtyOptions) {
10178
- requiredArgs(1, arguments);
10179
- var options = dirtyOptions || {};
10180
- var locale = options.locale;
10181
- var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;
10182
- var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
10183
- var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
10184
-
10185
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
10186
- throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
10187
- }
10188
- var date = toDate(dirtyDate);
10189
- var day = date.getUTCDay();
10190
- var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
10191
- date.setUTCDate(date.getUTCDate() - diff);
10192
- date.setUTCHours(0, 0, 0, 0);
10193
- return date;
10194
- }
10195
-
10196
- // See issue: https://github.com/date-fns/date-fns/issues/376
10197
-
10198
- function getUTCWeekYear(dirtyDate, dirtyOptions) {
10199
- requiredArgs(1, arguments);
10200
- var date = toDate(dirtyDate, dirtyOptions);
10201
- var year = date.getUTCFullYear();
10202
- var options = dirtyOptions || {};
10203
- var locale = options.locale;
10204
- var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
10205
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
10206
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
10207
-
10208
- if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
10209
- throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
10210
- }
10211
- var firstWeekOfNextYear = new Date(0);
10212
- firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
10213
- firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
10214
- var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, dirtyOptions);
10215
- var firstWeekOfThisYear = new Date(0);
10216
- firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
10217
- firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
10218
- var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, dirtyOptions);
10219
- if (date.getTime() >= startOfNextYear.getTime()) {
10220
- return year + 1;
10221
- } else if (date.getTime() >= startOfThisYear.getTime()) {
10222
- return year;
10223
- } else {
10224
- return year - 1;
10225
- }
10226
- }
10227
-
10228
- // See issue: https://github.com/date-fns/date-fns/issues/376
10229
-
10230
- function startOfUTCWeekYear(dirtyDate, dirtyOptions) {
10231
- requiredArgs(1, arguments);
10232
- var options = dirtyOptions || {};
10233
- var locale = options.locale;
10234
- var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
10235
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
10236
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
10237
- var year = getUTCWeekYear(dirtyDate, dirtyOptions);
10238
- var firstWeek = new Date(0);
10239
- firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
10240
- firstWeek.setUTCHours(0, 0, 0, 0);
10241
- var date = startOfUTCWeek(firstWeek, dirtyOptions);
10242
- return date;
10243
- }
10244
-
10245
- var MILLISECONDS_IN_WEEK = 604800000; // This function will be a part of public API when UTC function will be implemented.
10246
- // See issue: https://github.com/date-fns/date-fns/issues/376
10247
-
10248
- function getUTCWeek(dirtyDate, options) {
10249
- requiredArgs(1, arguments);
10250
- var date = toDate(dirtyDate);
10251
- var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer
10252
- // because the number of milliseconds in a week is not constant
10253
- // (e.g. it's different in the week of the daylight saving time clock shift)
10254
-
10255
- return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
10256
- }
10257
-
10258
- var dayPeriodEnum = {
10259
- am: 'am',
10260
- pm: 'pm',
10261
- midnight: 'midnight',
10262
- noon: 'noon',
10263
- morning: 'morning',
10264
- afternoon: 'afternoon',
10265
- evening: 'evening',
10266
- night: 'night'
10267
- /*
10268
- * | | Unit | | Unit |
10269
- * |-----|--------------------------------|-----|--------------------------------|
10270
- * | a | AM, PM | A* | Milliseconds in day |
10271
- * | b | AM, PM, noon, midnight | B | Flexible day period |
10272
- * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
10273
- * | d | Day of month | D | Day of year |
10274
- * | e | Local day of week | E | Day of week |
10275
- * | f | | F* | Day of week in month |
10276
- * | g* | Modified Julian day | G | Era |
10277
- * | h | Hour [1-12] | H | Hour [0-23] |
10278
- * | i! | ISO day of week | I! | ISO week of year |
10279
- * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
10280
- * | k | Hour [1-24] | K | Hour [0-11] |
10281
- * | l* | (deprecated) | L | Stand-alone month |
10282
- * | m | Minute | M | Month |
10283
- * | n | | N | |
10284
- * | o! | Ordinal number modifier | O | Timezone (GMT) |
10285
- * | p! | Long localized time | P! | Long localized date |
10286
- * | q | Stand-alone quarter | Q | Quarter |
10287
- * | r* | Related Gregorian year | R! | ISO week-numbering year |
10288
- * | s | Second | S | Fraction of second |
10289
- * | t! | Seconds timestamp | T! | Milliseconds timestamp |
10290
- * | u | Extended year | U* | Cyclic year |
10291
- * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
10292
- * | w | Local week of year | W* | Week of month |
10293
- * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
10294
- * | y | Year (abs) | Y | Local week-numbering year |
10295
- * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
10296
- *
10297
- * Letters marked by * are not implemented but reserved by Unicode standard.
10298
- *
10299
- * Letters marked by ! are non-standard, but implemented by date-fns:
10300
- * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
10301
- * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
10302
- * i.e. 7 for Sunday, 1 for Monday, etc.
10303
- * - `I` is ISO week of year, as opposed to `w` which is local week of year.
10304
- * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
10305
- * `R` is supposed to be used in conjunction with `I` and `i`
10306
- * for universal ISO week-numbering date, whereas
10307
- * `Y` is supposed to be used in conjunction with `w` and `e`
10308
- * for week-numbering date specific to the locale.
10309
- * - `P` is long localized date format
10310
- * - `p` is long localized time format
10311
- */
10312
- };
10313
-
10314
- var formatters = {
10315
- // Era
10316
- G: function G(date, token, localize) {
10317
- var era = date.getUTCFullYear() > 0 ? 1 : 0;
10318
- switch (token) {
10319
- // AD, BC
10320
- case 'G':
10321
- case 'GG':
10322
- case 'GGG':
10323
- return localize.era(era, {
10324
- width: 'abbreviated'
10325
- });
10326
- // A, B
10327
-
10328
- case 'GGGGG':
10329
- return localize.era(era, {
10330
- width: 'narrow'
10331
- });
10332
- // Anno Domini, Before Christ
10333
-
10334
- case 'GGGG':
10335
- default:
10336
- return localize.era(era, {
10337
- width: 'wide'
10338
- });
10339
- }
10340
- },
10341
- // Year
10342
- y: function y(date, token, localize) {
10343
- // Ordinal number
10344
- if (token === 'yo') {
10345
- var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
10346
-
10347
- var year = signedYear > 0 ? signedYear : 1 - signedYear;
10348
- return localize.ordinalNumber(year, {
10349
- unit: 'year'
10350
- });
10351
- }
10352
- return lightFormatters.y(date, token);
10353
- },
10354
- // Local week-numbering year
10355
- Y: function Y(date, token, localize, options) {
10356
- var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)
10357
-
10358
- var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year
10359
-
10360
- if (token === 'YY') {
10361
- var twoDigitYear = weekYear % 100;
10362
- return addLeadingZeros(twoDigitYear, 2);
10363
- } // Ordinal number
10364
-
10365
- if (token === 'Yo') {
10366
- return localize.ordinalNumber(weekYear, {
10367
- unit: 'year'
10368
- });
10369
- } // Padding
10370
-
10371
- return addLeadingZeros(weekYear, token.length);
10372
- },
10373
- // ISO week-numbering year
10374
- R: function R(date, token) {
10375
- var isoWeekYear = getUTCISOWeekYear(date); // Padding
9880
+ // Padding
9881
+ return addLeadingZeros(weekYear, token.length);
9882
+ },
9883
+ // ISO week-numbering year
9884
+ R: function R(date, token) {
9885
+ var isoWeekYear = getUTCISOWeekYear(date);
10376
9886
 
9887
+ // Padding
10377
9888
  return addLeadingZeros(isoWeekYear, token.length);
10378
9889
  },
10379
9890
  // Extended year. This is a single number designating the year of this calendar system.
@@ -10397,31 +9908,26 @@ var formatters = {
10397
9908
  case 'Q':
10398
9909
  return String(quarter);
10399
9910
  // 01, 02, 03, 04
10400
-
10401
9911
  case 'QQ':
10402
9912
  return addLeadingZeros(quarter, 2);
10403
9913
  // 1st, 2nd, 3rd, 4th
10404
-
10405
9914
  case 'Qo':
10406
9915
  return localize.ordinalNumber(quarter, {
10407
9916
  unit: 'quarter'
10408
9917
  });
10409
9918
  // Q1, Q2, Q3, Q4
10410
-
10411
9919
  case 'QQQ':
10412
9920
  return localize.quarter(quarter, {
10413
9921
  width: 'abbreviated',
10414
9922
  context: 'formatting'
10415
9923
  });
10416
9924
  // 1, 2, 3, 4 (narrow quarter; could be not numerical)
10417
-
10418
9925
  case 'QQQQQ':
10419
9926
  return localize.quarter(quarter, {
10420
9927
  width: 'narrow',
10421
9928
  context: 'formatting'
10422
9929
  });
10423
9930
  // 1st quarter, 2nd quarter, ...
10424
-
10425
9931
  case 'QQQQ':
10426
9932
  default:
10427
9933
  return localize.quarter(quarter, {
@@ -10438,31 +9944,26 @@ var formatters = {
10438
9944
  case 'q':
10439
9945
  return String(quarter);
10440
9946
  // 01, 02, 03, 04
10441
-
10442
9947
  case 'qq':
10443
9948
  return addLeadingZeros(quarter, 2);
10444
9949
  // 1st, 2nd, 3rd, 4th
10445
-
10446
9950
  case 'qo':
10447
9951
  return localize.ordinalNumber(quarter, {
10448
9952
  unit: 'quarter'
10449
9953
  });
10450
9954
  // Q1, Q2, Q3, Q4
10451
-
10452
9955
  case 'qqq':
10453
9956
  return localize.quarter(quarter, {
10454
9957
  width: 'abbreviated',
10455
9958
  context: 'standalone'
10456
9959
  });
10457
9960
  // 1, 2, 3, 4 (narrow quarter; could be not numerical)
10458
-
10459
9961
  case 'qqqqq':
10460
9962
  return localize.quarter(quarter, {
10461
9963
  width: 'narrow',
10462
9964
  context: 'standalone'
10463
9965
  });
10464
9966
  // 1st quarter, 2nd quarter, ...
10465
-
10466
9967
  case 'qqqq':
10467
9968
  default:
10468
9969
  return localize.quarter(quarter, {
@@ -10479,27 +9980,23 @@ var formatters = {
10479
9980
  case 'MM':
10480
9981
  return lightFormatters.M(date, token);
10481
9982
  // 1st, 2nd, ..., 12th
10482
-
10483
9983
  case 'Mo':
10484
9984
  return localize.ordinalNumber(month + 1, {
10485
9985
  unit: 'month'
10486
9986
  });
10487
9987
  // Jan, Feb, ..., Dec
10488
-
10489
9988
  case 'MMM':
10490
9989
  return localize.month(month, {
10491
9990
  width: 'abbreviated',
10492
9991
  context: 'formatting'
10493
9992
  });
10494
9993
  // J, F, ..., D
10495
-
10496
9994
  case 'MMMMM':
10497
9995
  return localize.month(month, {
10498
9996
  width: 'narrow',
10499
9997
  context: 'formatting'
10500
9998
  });
10501
9999
  // January, February, ..., December
10502
-
10503
10000
  case 'MMMM':
10504
10001
  default:
10505
10002
  return localize.month(month, {
@@ -10516,31 +10013,26 @@ var formatters = {
10516
10013
  case 'L':
10517
10014
  return String(month + 1);
10518
10015
  // 01, 02, ..., 12
10519
-
10520
10016
  case 'LL':
10521
10017
  return addLeadingZeros(month + 1, 2);
10522
10018
  // 1st, 2nd, ..., 12th
10523
-
10524
10019
  case 'Lo':
10525
10020
  return localize.ordinalNumber(month + 1, {
10526
10021
  unit: 'month'
10527
10022
  });
10528
10023
  // Jan, Feb, ..., Dec
10529
-
10530
10024
  case 'LLL':
10531
10025
  return localize.month(month, {
10532
10026
  width: 'abbreviated',
10533
10027
  context: 'standalone'
10534
10028
  });
10535
10029
  // J, F, ..., D
10536
-
10537
10030
  case 'LLLLL':
10538
10031
  return localize.month(month, {
10539
10032
  width: 'narrow',
10540
10033
  context: 'standalone'
10541
10034
  });
10542
10035
  // January, February, ..., December
10543
-
10544
10036
  case 'LLLL':
10545
10037
  default:
10546
10038
  return localize.month(month, {
@@ -10601,21 +10093,18 @@ var formatters = {
10601
10093
  context: 'formatting'
10602
10094
  });
10603
10095
  // T
10604
-
10605
10096
  case 'EEEEE':
10606
10097
  return localize.day(dayOfWeek, {
10607
10098
  width: 'narrow',
10608
10099
  context: 'formatting'
10609
10100
  });
10610
10101
  // Tu
10611
-
10612
10102
  case 'EEEEEE':
10613
10103
  return localize.day(dayOfWeek, {
10614
10104
  width: 'short',
10615
10105
  context: 'formatting'
10616
10106
  });
10617
10107
  // Tuesday
10618
-
10619
10108
  case 'EEEE':
10620
10109
  default:
10621
10110
  return localize.day(dayOfWeek, {
@@ -10633,11 +10122,9 @@ var formatters = {
10633
10122
  case 'e':
10634
10123
  return String(localDayOfWeek);
10635
10124
  // Padded numerical value
10636
-
10637
10125
  case 'ee':
10638
10126
  return addLeadingZeros(localDayOfWeek, 2);
10639
10127
  // 1st, 2nd, ..., 7th
10640
-
10641
10128
  case 'eo':
10642
10129
  return localize.ordinalNumber(localDayOfWeek, {
10643
10130
  unit: 'day'
@@ -10648,21 +10135,18 @@ var formatters = {
10648
10135
  context: 'formatting'
10649
10136
  });
10650
10137
  // T
10651
-
10652
10138
  case 'eeeee':
10653
10139
  return localize.day(dayOfWeek, {
10654
10140
  width: 'narrow',
10655
10141
  context: 'formatting'
10656
10142
  });
10657
10143
  // Tu
10658
-
10659
10144
  case 'eeeeee':
10660
10145
  return localize.day(dayOfWeek, {
10661
10146
  width: 'short',
10662
10147
  context: 'formatting'
10663
10148
  });
10664
10149
  // Tuesday
10665
-
10666
10150
  case 'eeee':
10667
10151
  default:
10668
10152
  return localize.day(dayOfWeek, {
@@ -10680,11 +10164,9 @@ var formatters = {
10680
10164
  case 'c':
10681
10165
  return String(localDayOfWeek);
10682
10166
  // Padded numerical value
10683
-
10684
10167
  case 'cc':
10685
10168
  return addLeadingZeros(localDayOfWeek, token.length);
10686
10169
  // 1st, 2nd, ..., 7th
10687
-
10688
10170
  case 'co':
10689
10171
  return localize.ordinalNumber(localDayOfWeek, {
10690
10172
  unit: 'day'
@@ -10695,21 +10177,18 @@ var formatters = {
10695
10177
  context: 'standalone'
10696
10178
  });
10697
10179
  // T
10698
-
10699
10180
  case 'ccccc':
10700
10181
  return localize.day(dayOfWeek, {
10701
10182
  width: 'narrow',
10702
10183
  context: 'standalone'
10703
10184
  });
10704
10185
  // Tu
10705
-
10706
10186
  case 'cccccc':
10707
10187
  return localize.day(dayOfWeek, {
10708
10188
  width: 'short',
10709
10189
  context: 'standalone'
10710
10190
  });
10711
10191
  // Tuesday
10712
-
10713
10192
  case 'cccc':
10714
10193
  default:
10715
10194
  return localize.day(dayOfWeek, {
@@ -10727,38 +10206,32 @@ var formatters = {
10727
10206
  case 'i':
10728
10207
  return String(isoDayOfWeek);
10729
10208
  // 02
10730
-
10731
10209
  case 'ii':
10732
10210
  return addLeadingZeros(isoDayOfWeek, token.length);
10733
10211
  // 2nd
10734
-
10735
10212
  case 'io':
10736
10213
  return localize.ordinalNumber(isoDayOfWeek, {
10737
10214
  unit: 'day'
10738
10215
  });
10739
10216
  // Tue
10740
-
10741
10217
  case 'iii':
10742
10218
  return localize.day(dayOfWeek, {
10743
10219
  width: 'abbreviated',
10744
10220
  context: 'formatting'
10745
10221
  });
10746
10222
  // T
10747
-
10748
10223
  case 'iiiii':
10749
10224
  return localize.day(dayOfWeek, {
10750
10225
  width: 'narrow',
10751
10226
  context: 'formatting'
10752
10227
  });
10753
10228
  // Tu
10754
-
10755
10229
  case 'iiiiii':
10756
10230
  return localize.day(dayOfWeek, {
10757
10231
  width: 'short',
10758
10232
  context: 'formatting'
10759
10233
  });
10760
10234
  // Tuesday
10761
-
10762
10235
  case 'iiii':
10763
10236
  default:
10764
10237
  return localize.day(dayOfWeek, {
@@ -10774,11 +10247,15 @@ var formatters = {
10774
10247
  switch (token) {
10775
10248
  case 'a':
10776
10249
  case 'aa':
10777
- case 'aaa':
10778
10250
  return localize.dayPeriod(dayPeriodEnumValue, {
10779
10251
  width: 'abbreviated',
10780
10252
  context: 'formatting'
10781
10253
  });
10254
+ case 'aaa':
10255
+ return localize.dayPeriod(dayPeriodEnumValue, {
10256
+ width: 'abbreviated',
10257
+ context: 'formatting'
10258
+ }).toLowerCase();
10782
10259
  case 'aaaaa':
10783
10260
  return localize.dayPeriod(dayPeriodEnumValue, {
10784
10261
  width: 'narrow',
@@ -10792,392 +10269,868 @@ var formatters = {
10792
10269
  });
10793
10270
  }
10794
10271
  },
10795
- // AM, PM, midnight, noon
10796
- b: function b(date, token, localize) {
10797
- var hours = date.getUTCHours();
10798
- var dayPeriodEnumValue;
10799
- if (hours === 12) {
10800
- dayPeriodEnumValue = dayPeriodEnum.noon;
10801
- } else if (hours === 0) {
10802
- dayPeriodEnumValue = dayPeriodEnum.midnight;
10803
- } else {
10804
- dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
10805
- }
10806
- switch (token) {
10807
- case 'b':
10808
- case 'bb':
10809
- case 'bbb':
10810
- return localize.dayPeriod(dayPeriodEnumValue, {
10811
- width: 'abbreviated',
10812
- context: 'formatting'
10813
- });
10814
- case 'bbbbb':
10815
- return localize.dayPeriod(dayPeriodEnumValue, {
10816
- width: 'narrow',
10817
- context: 'formatting'
10818
- });
10819
- case 'bbbb':
10820
- default:
10821
- return localize.dayPeriod(dayPeriodEnumValue, {
10822
- width: 'wide',
10823
- context: 'formatting'
10824
- });
10825
- }
10272
+ // AM, PM, midnight, noon
10273
+ b: function b(date, token, localize) {
10274
+ var hours = date.getUTCHours();
10275
+ var dayPeriodEnumValue;
10276
+ if (hours === 12) {
10277
+ dayPeriodEnumValue = dayPeriodEnum.noon;
10278
+ } else if (hours === 0) {
10279
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
10280
+ } else {
10281
+ dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
10282
+ }
10283
+ switch (token) {
10284
+ case 'b':
10285
+ case 'bb':
10286
+ return localize.dayPeriod(dayPeriodEnumValue, {
10287
+ width: 'abbreviated',
10288
+ context: 'formatting'
10289
+ });
10290
+ case 'bbb':
10291
+ return localize.dayPeriod(dayPeriodEnumValue, {
10292
+ width: 'abbreviated',
10293
+ context: 'formatting'
10294
+ }).toLowerCase();
10295
+ case 'bbbbb':
10296
+ return localize.dayPeriod(dayPeriodEnumValue, {
10297
+ width: 'narrow',
10298
+ context: 'formatting'
10299
+ });
10300
+ case 'bbbb':
10301
+ default:
10302
+ return localize.dayPeriod(dayPeriodEnumValue, {
10303
+ width: 'wide',
10304
+ context: 'formatting'
10305
+ });
10306
+ }
10307
+ },
10308
+ // in the morning, in the afternoon, in the evening, at night
10309
+ B: function B(date, token, localize) {
10310
+ var hours = date.getUTCHours();
10311
+ var dayPeriodEnumValue;
10312
+ if (hours >= 17) {
10313
+ dayPeriodEnumValue = dayPeriodEnum.evening;
10314
+ } else if (hours >= 12) {
10315
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
10316
+ } else if (hours >= 4) {
10317
+ dayPeriodEnumValue = dayPeriodEnum.morning;
10318
+ } else {
10319
+ dayPeriodEnumValue = dayPeriodEnum.night;
10320
+ }
10321
+ switch (token) {
10322
+ case 'B':
10323
+ case 'BB':
10324
+ case 'BBB':
10325
+ return localize.dayPeriod(dayPeriodEnumValue, {
10326
+ width: 'abbreviated',
10327
+ context: 'formatting'
10328
+ });
10329
+ case 'BBBBB':
10330
+ return localize.dayPeriod(dayPeriodEnumValue, {
10331
+ width: 'narrow',
10332
+ context: 'formatting'
10333
+ });
10334
+ case 'BBBB':
10335
+ default:
10336
+ return localize.dayPeriod(dayPeriodEnumValue, {
10337
+ width: 'wide',
10338
+ context: 'formatting'
10339
+ });
10340
+ }
10341
+ },
10342
+ // Hour [1-12]
10343
+ h: function h(date, token, localize) {
10344
+ if (token === 'ho') {
10345
+ var hours = date.getUTCHours() % 12;
10346
+ if (hours === 0) hours = 12;
10347
+ return localize.ordinalNumber(hours, {
10348
+ unit: 'hour'
10349
+ });
10350
+ }
10351
+ return lightFormatters.h(date, token);
10352
+ },
10353
+ // Hour [0-23]
10354
+ H: function H(date, token, localize) {
10355
+ if (token === 'Ho') {
10356
+ return localize.ordinalNumber(date.getUTCHours(), {
10357
+ unit: 'hour'
10358
+ });
10359
+ }
10360
+ return lightFormatters.H(date, token);
10361
+ },
10362
+ // Hour [0-11]
10363
+ K: function K(date, token, localize) {
10364
+ var hours = date.getUTCHours() % 12;
10365
+ if (token === 'Ko') {
10366
+ return localize.ordinalNumber(hours, {
10367
+ unit: 'hour'
10368
+ });
10369
+ }
10370
+ return addLeadingZeros(hours, token.length);
10371
+ },
10372
+ // Hour [1-24]
10373
+ k: function k(date, token, localize) {
10374
+ var hours = date.getUTCHours();
10375
+ if (hours === 0) hours = 24;
10376
+ if (token === 'ko') {
10377
+ return localize.ordinalNumber(hours, {
10378
+ unit: 'hour'
10379
+ });
10380
+ }
10381
+ return addLeadingZeros(hours, token.length);
10382
+ },
10383
+ // Minute
10384
+ m: function m(date, token, localize) {
10385
+ if (token === 'mo') {
10386
+ return localize.ordinalNumber(date.getUTCMinutes(), {
10387
+ unit: 'minute'
10388
+ });
10389
+ }
10390
+ return lightFormatters.m(date, token);
10391
+ },
10392
+ // Second
10393
+ s: function s(date, token, localize) {
10394
+ if (token === 'so') {
10395
+ return localize.ordinalNumber(date.getUTCSeconds(), {
10396
+ unit: 'second'
10397
+ });
10398
+ }
10399
+ return lightFormatters.s(date, token);
10400
+ },
10401
+ // Fraction of second
10402
+ S: function S(date, token) {
10403
+ return lightFormatters.S(date, token);
10404
+ },
10405
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
10406
+ X: function X(date, token, _localize, options) {
10407
+ var originalDate = options._originalDate || date;
10408
+ var timezoneOffset = originalDate.getTimezoneOffset();
10409
+ if (timezoneOffset === 0) {
10410
+ return 'Z';
10411
+ }
10412
+ switch (token) {
10413
+ // Hours and optional minutes
10414
+ case 'X':
10415
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
10416
+
10417
+ // Hours, minutes and optional seconds without `:` delimiter
10418
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
10419
+ // so this token always has the same output as `XX`
10420
+ case 'XXXX':
10421
+ case 'XX':
10422
+ // Hours and minutes without `:` delimiter
10423
+ return formatTimezone(timezoneOffset);
10424
+
10425
+ // Hours, minutes and optional seconds with `:` delimiter
10426
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
10427
+ // so this token always has the same output as `XXX`
10428
+ case 'XXXXX':
10429
+ case 'XXX': // Hours and minutes with `:` delimiter
10430
+ default:
10431
+ return formatTimezone(timezoneOffset, ':');
10432
+ }
10433
+ },
10434
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
10435
+ x: function x(date, token, _localize, options) {
10436
+ var originalDate = options._originalDate || date;
10437
+ var timezoneOffset = originalDate.getTimezoneOffset();
10438
+ switch (token) {
10439
+ // Hours and optional minutes
10440
+ case 'x':
10441
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
10442
+
10443
+ // Hours, minutes and optional seconds without `:` delimiter
10444
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
10445
+ // so this token always has the same output as `xx`
10446
+ case 'xxxx':
10447
+ case 'xx':
10448
+ // Hours and minutes without `:` delimiter
10449
+ return formatTimezone(timezoneOffset);
10450
+
10451
+ // Hours, minutes and optional seconds with `:` delimiter
10452
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
10453
+ // so this token always has the same output as `xxx`
10454
+ case 'xxxxx':
10455
+ case 'xxx': // Hours and minutes with `:` delimiter
10456
+ default:
10457
+ return formatTimezone(timezoneOffset, ':');
10458
+ }
10459
+ },
10460
+ // Timezone (GMT)
10461
+ O: function O(date, token, _localize, options) {
10462
+ var originalDate = options._originalDate || date;
10463
+ var timezoneOffset = originalDate.getTimezoneOffset();
10464
+ switch (token) {
10465
+ // Short
10466
+ case 'O':
10467
+ case 'OO':
10468
+ case 'OOO':
10469
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
10470
+ // Long
10471
+ case 'OOOO':
10472
+ default:
10473
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
10474
+ }
10475
+ },
10476
+ // Timezone (specific non-location)
10477
+ z: function z(date, token, _localize, options) {
10478
+ var originalDate = options._originalDate || date;
10479
+ var timezoneOffset = originalDate.getTimezoneOffset();
10480
+ switch (token) {
10481
+ // Short
10482
+ case 'z':
10483
+ case 'zz':
10484
+ case 'zzz':
10485
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
10486
+ // Long
10487
+ case 'zzzz':
10488
+ default:
10489
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
10490
+ }
10491
+ },
10492
+ // Seconds timestamp
10493
+ t: function t(date, token, _localize, options) {
10494
+ var originalDate = options._originalDate || date;
10495
+ var timestamp = Math.floor(originalDate.getTime() / 1000);
10496
+ return addLeadingZeros(timestamp, token.length);
10497
+ },
10498
+ // Milliseconds timestamp
10499
+ T: function T(date, token, _localize, options) {
10500
+ var originalDate = options._originalDate || date;
10501
+ var timestamp = originalDate.getTime();
10502
+ return addLeadingZeros(timestamp, token.length);
10503
+ }
10504
+ };
10505
+ function formatTimezoneShort(offset, dirtyDelimiter) {
10506
+ var sign = offset > 0 ? '-' : '+';
10507
+ var absOffset = Math.abs(offset);
10508
+ var hours = Math.floor(absOffset / 60);
10509
+ var minutes = absOffset % 60;
10510
+ if (minutes === 0) {
10511
+ return sign + String(hours);
10512
+ }
10513
+ var delimiter = dirtyDelimiter || '';
10514
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
10515
+ }
10516
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
10517
+ if (offset % 60 === 0) {
10518
+ var sign = offset > 0 ? '-' : '+';
10519
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
10520
+ }
10521
+ return formatTimezone(offset, dirtyDelimiter);
10522
+ }
10523
+ function formatTimezone(offset, dirtyDelimiter) {
10524
+ var delimiter = dirtyDelimiter || '';
10525
+ var sign = offset > 0 ? '-' : '+';
10526
+ var absOffset = Math.abs(offset);
10527
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
10528
+ var minutes = addLeadingZeros(absOffset % 60, 2);
10529
+ return sign + hours + delimiter + minutes;
10530
+ }
10531
+ var formatters$1 = formatters;
10532
+
10533
+ var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
10534
+ switch (pattern) {
10535
+ case 'P':
10536
+ return formatLong.date({
10537
+ width: 'short'
10538
+ });
10539
+ case 'PP':
10540
+ return formatLong.date({
10541
+ width: 'medium'
10542
+ });
10543
+ case 'PPP':
10544
+ return formatLong.date({
10545
+ width: 'long'
10546
+ });
10547
+ case 'PPPP':
10548
+ default:
10549
+ return formatLong.date({
10550
+ width: 'full'
10551
+ });
10552
+ }
10553
+ };
10554
+ var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
10555
+ switch (pattern) {
10556
+ case 'p':
10557
+ return formatLong.time({
10558
+ width: 'short'
10559
+ });
10560
+ case 'pp':
10561
+ return formatLong.time({
10562
+ width: 'medium'
10563
+ });
10564
+ case 'ppp':
10565
+ return formatLong.time({
10566
+ width: 'long'
10567
+ });
10568
+ case 'pppp':
10569
+ default:
10570
+ return formatLong.time({
10571
+ width: 'full'
10572
+ });
10573
+ }
10574
+ };
10575
+ var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
10576
+ var matchResult = pattern.match(/(P+)(p+)?/) || [];
10577
+ var datePattern = matchResult[1];
10578
+ var timePattern = matchResult[2];
10579
+ if (!timePattern) {
10580
+ return dateLongFormatter(pattern, formatLong);
10581
+ }
10582
+ var dateTimeFormat;
10583
+ switch (datePattern) {
10584
+ case 'P':
10585
+ dateTimeFormat = formatLong.dateTime({
10586
+ width: 'short'
10587
+ });
10588
+ break;
10589
+ case 'PP':
10590
+ dateTimeFormat = formatLong.dateTime({
10591
+ width: 'medium'
10592
+ });
10593
+ break;
10594
+ case 'PPP':
10595
+ dateTimeFormat = formatLong.dateTime({
10596
+ width: 'long'
10597
+ });
10598
+ break;
10599
+ case 'PPPP':
10600
+ default:
10601
+ dateTimeFormat = formatLong.dateTime({
10602
+ width: 'full'
10603
+ });
10604
+ break;
10605
+ }
10606
+ return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
10607
+ };
10608
+ var longFormatters = {
10609
+ p: timeLongFormatter,
10610
+ P: dateTimeLongFormatter
10611
+ };
10612
+ var longFormatters$1 = longFormatters;
10613
+
10614
+ /**
10615
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
10616
+ * They usually appear for dates that denote time before the timezones were introduced
10617
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
10618
+ * and GMT+01:00:00 after that date)
10619
+ *
10620
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
10621
+ * which would lead to incorrect calculations.
10622
+ *
10623
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
10624
+ */
10625
+ function getTimezoneOffsetInMilliseconds(date) {
10626
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
10627
+ utcDate.setUTCFullYear(date.getFullYear());
10628
+ return date.getTime() - utcDate.getTime();
10629
+ }
10630
+
10631
+ var protectedDayOfYearTokens = ['D', 'DD'];
10632
+ var protectedWeekYearTokens = ['YY', 'YYYY'];
10633
+ function isProtectedDayOfYearToken(token) {
10634
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
10635
+ }
10636
+ function isProtectedWeekYearToken(token) {
10637
+ return protectedWeekYearTokens.indexOf(token) !== -1;
10638
+ }
10639
+ function throwProtectedError(token, format, input) {
10640
+ if (token === 'YYYY') {
10641
+ 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"));
10642
+ } else if (token === 'YY') {
10643
+ 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"));
10644
+ } else if (token === 'D') {
10645
+ 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"));
10646
+ } else if (token === 'DD') {
10647
+ 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"));
10648
+ }
10649
+ }
10650
+
10651
+ var formatDistanceLocale = {
10652
+ lessThanXSeconds: {
10653
+ one: 'less than a second',
10654
+ other: 'less than {{count}} seconds'
10655
+ },
10656
+ xSeconds: {
10657
+ one: '1 second',
10658
+ other: '{{count}} seconds'
10826
10659
  },
10827
- // in the morning, in the afternoon, in the evening, at night
10828
- B: function B(date, token, localize) {
10829
- var hours = date.getUTCHours();
10830
- var dayPeriodEnumValue;
10831
- if (hours >= 17) {
10832
- dayPeriodEnumValue = dayPeriodEnum.evening;
10833
- } else if (hours >= 12) {
10834
- dayPeriodEnumValue = dayPeriodEnum.afternoon;
10835
- } else if (hours >= 4) {
10836
- dayPeriodEnumValue = dayPeriodEnum.morning;
10837
- } else {
10838
- dayPeriodEnumValue = dayPeriodEnum.night;
10839
- }
10840
- switch (token) {
10841
- case 'B':
10842
- case 'BB':
10843
- case 'BBB':
10844
- return localize.dayPeriod(dayPeriodEnumValue, {
10845
- width: 'abbreviated',
10846
- context: 'formatting'
10847
- });
10848
- case 'BBBBB':
10849
- return localize.dayPeriod(dayPeriodEnumValue, {
10850
- width: 'narrow',
10851
- context: 'formatting'
10852
- });
10853
- case 'BBBB':
10854
- default:
10855
- return localize.dayPeriod(dayPeriodEnumValue, {
10856
- width: 'wide',
10857
- context: 'formatting'
10858
- });
10859
- }
10660
+ halfAMinute: 'half a minute',
10661
+ lessThanXMinutes: {
10662
+ one: 'less than a minute',
10663
+ other: 'less than {{count}} minutes'
10860
10664
  },
10861
- // Hour [1-12]
10862
- h: function h(date, token, localize) {
10863
- if (token === 'ho') {
10864
- var hours = date.getUTCHours() % 12;
10865
- if (hours === 0) hours = 12;
10866
- return localize.ordinalNumber(hours, {
10867
- unit: 'hour'
10868
- });
10869
- }
10870
- return lightFormatters.h(date, token);
10665
+ xMinutes: {
10666
+ one: '1 minute',
10667
+ other: '{{count}} minutes'
10871
10668
  },
10872
- // Hour [0-23]
10873
- H: function H(date, token, localize) {
10874
- if (token === 'Ho') {
10875
- return localize.ordinalNumber(date.getUTCHours(), {
10876
- unit: 'hour'
10877
- });
10878
- }
10879
- return lightFormatters.H(date, token);
10669
+ aboutXHours: {
10670
+ one: 'about 1 hour',
10671
+ other: 'about {{count}} hours'
10880
10672
  },
10881
- // Hour [0-11]
10882
- K: function K(date, token, localize) {
10883
- var hours = date.getUTCHours() % 12;
10884
- if (token === 'Ko') {
10885
- return localize.ordinalNumber(hours, {
10886
- unit: 'hour'
10887
- });
10888
- }
10889
- return addLeadingZeros(hours, token.length);
10673
+ xHours: {
10674
+ one: '1 hour',
10675
+ other: '{{count}} hours'
10890
10676
  },
10891
- // Hour [1-24]
10892
- k: function k(date, token, localize) {
10893
- var hours = date.getUTCHours();
10894
- if (hours === 0) hours = 24;
10895
- if (token === 'ko') {
10896
- return localize.ordinalNumber(hours, {
10897
- unit: 'hour'
10898
- });
10899
- }
10900
- return addLeadingZeros(hours, token.length);
10677
+ xDays: {
10678
+ one: '1 day',
10679
+ other: '{{count}} days'
10901
10680
  },
10902
- // Minute
10903
- m: function m(date, token, localize) {
10904
- if (token === 'mo') {
10905
- return localize.ordinalNumber(date.getUTCMinutes(), {
10906
- unit: 'minute'
10907
- });
10908
- }
10909
- return lightFormatters.m(date, token);
10681
+ aboutXWeeks: {
10682
+ one: 'about 1 week',
10683
+ other: 'about {{count}} weeks'
10910
10684
  },
10911
- // Second
10912
- s: function s(date, token, localize) {
10913
- if (token === 'so') {
10914
- return localize.ordinalNumber(date.getUTCSeconds(), {
10915
- unit: 'second'
10916
- });
10917
- }
10918
- return lightFormatters.s(date, token);
10685
+ xWeeks: {
10686
+ one: '1 week',
10687
+ other: '{{count}} weeks'
10919
10688
  },
10920
- // Fraction of second
10921
- S: function S(date, token) {
10922
- return lightFormatters.S(date, token);
10689
+ aboutXMonths: {
10690
+ one: 'about 1 month',
10691
+ other: 'about {{count}} months'
10923
10692
  },
10924
- // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
10925
- X: function X(date, token, _localize, options) {
10926
- var originalDate = options._originalDate || date;
10927
- var timezoneOffset = originalDate.getTimezoneOffset();
10928
- if (timezoneOffset === 0) {
10929
- return 'Z';
10693
+ xMonths: {
10694
+ one: '1 month',
10695
+ other: '{{count}} months'
10696
+ },
10697
+ aboutXYears: {
10698
+ one: 'about 1 year',
10699
+ other: 'about {{count}} years'
10700
+ },
10701
+ xYears: {
10702
+ one: '1 year',
10703
+ other: '{{count}} years'
10704
+ },
10705
+ overXYears: {
10706
+ one: 'over 1 year',
10707
+ other: 'over {{count}} years'
10708
+ },
10709
+ almostXYears: {
10710
+ one: 'almost 1 year',
10711
+ other: 'almost {{count}} years'
10712
+ }
10713
+ };
10714
+ var formatDistance = function formatDistance(token, count, options) {
10715
+ var result;
10716
+ var tokenValue = formatDistanceLocale[token];
10717
+ if (typeof tokenValue === 'string') {
10718
+ result = tokenValue;
10719
+ } else if (count === 1) {
10720
+ result = tokenValue.one;
10721
+ } else {
10722
+ result = tokenValue.other.replace('{{count}}', count.toString());
10723
+ }
10724
+ if (options !== null && options !== void 0 && options.addSuffix) {
10725
+ if (options.comparison && options.comparison > 0) {
10726
+ return 'in ' + result;
10727
+ } else {
10728
+ return result + ' ago';
10930
10729
  }
10931
- switch (token) {
10932
- // Hours and optional minutes
10933
- case 'X':
10934
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
10935
- // Hours, minutes and optional seconds without `:` delimiter
10936
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
10937
- // so this token always has the same output as `XX`
10938
-
10939
- case 'XXXX':
10940
- case 'XX':
10941
- // Hours and minutes without `:` delimiter
10942
- return formatTimezone(timezoneOffset);
10943
- // Hours, minutes and optional seconds with `:` delimiter
10944
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
10945
- // so this token always has the same output as `XXX`
10946
-
10947
- case 'XXXXX':
10948
- case 'XXX': // Hours and minutes with `:` delimiter
10730
+ }
10731
+ return result;
10732
+ };
10733
+ var formatDistance$1 = formatDistance;
10949
10734
 
10950
- default:
10951
- return formatTimezone(timezoneOffset, ':');
10952
- }
10953
- },
10954
- // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
10955
- x: function x(date, token, _localize, options) {
10956
- var originalDate = options._originalDate || date;
10957
- var timezoneOffset = originalDate.getTimezoneOffset();
10958
- switch (token) {
10959
- // Hours and optional minutes
10960
- case 'x':
10961
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
10962
- // Hours, minutes and optional seconds without `:` delimiter
10963
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
10964
- // so this token always has the same output as `xx`
10735
+ function buildFormatLongFn(args) {
10736
+ return function () {
10737
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
10738
+ // TODO: Remove String()
10739
+ var width = options.width ? String(options.width) : args.defaultWidth;
10740
+ var format = args.formats[width] || args.formats[args.defaultWidth];
10741
+ return format;
10742
+ };
10743
+ }
10965
10744
 
10966
- case 'xxxx':
10967
- case 'xx':
10968
- // Hours and minutes without `:` delimiter
10969
- return formatTimezone(timezoneOffset);
10970
- // Hours, minutes and optional seconds with `:` delimiter
10971
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
10972
- // so this token always has the same output as `xxx`
10745
+ var dateFormats = {
10746
+ full: 'EEEE, MMMM do, y',
10747
+ "long": 'MMMM do, y',
10748
+ medium: 'MMM d, y',
10749
+ "short": 'MM/dd/yyyy'
10750
+ };
10751
+ var timeFormats = {
10752
+ full: 'h:mm:ss a zzzz',
10753
+ "long": 'h:mm:ss a z',
10754
+ medium: 'h:mm:ss a',
10755
+ "short": 'h:mm a'
10756
+ };
10757
+ var dateTimeFormats = {
10758
+ full: "{{date}} 'at' {{time}}",
10759
+ "long": "{{date}} 'at' {{time}}",
10760
+ medium: '{{date}}, {{time}}',
10761
+ "short": '{{date}}, {{time}}'
10762
+ };
10763
+ var formatLong = {
10764
+ date: buildFormatLongFn({
10765
+ formats: dateFormats,
10766
+ defaultWidth: 'full'
10767
+ }),
10768
+ time: buildFormatLongFn({
10769
+ formats: timeFormats,
10770
+ defaultWidth: 'full'
10771
+ }),
10772
+ dateTime: buildFormatLongFn({
10773
+ formats: dateTimeFormats,
10774
+ defaultWidth: 'full'
10775
+ })
10776
+ };
10777
+ var formatLong$1 = formatLong;
10973
10778
 
10974
- case 'xxxxx':
10975
- case 'xxx': // Hours and minutes with `:` delimiter
10779
+ var formatRelativeLocale = {
10780
+ lastWeek: "'last' eeee 'at' p",
10781
+ yesterday: "'yesterday at' p",
10782
+ today: "'today at' p",
10783
+ tomorrow: "'tomorrow at' p",
10784
+ nextWeek: "eeee 'at' p",
10785
+ other: 'P'
10786
+ };
10787
+ var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
10788
+ return formatRelativeLocale[token];
10789
+ };
10790
+ var formatRelative$1 = formatRelative;
10976
10791
 
10977
- default:
10978
- return formatTimezone(timezoneOffset, ':');
10792
+ function buildLocalizeFn(args) {
10793
+ return function (dirtyIndex, options) {
10794
+ var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
10795
+ var valuesArray;
10796
+ if (context === 'formatting' && args.formattingValues) {
10797
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
10798
+ var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
10799
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
10800
+ } else {
10801
+ var _defaultWidth = args.defaultWidth;
10802
+ var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
10803
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
10979
10804
  }
10980
- },
10981
- // Timezone (GMT)
10982
- O: function O(date, token, _localize, options) {
10983
- var originalDate = options._originalDate || date;
10984
- var timezoneOffset = originalDate.getTimezoneOffset();
10985
- switch (token) {
10986
- // Short
10987
- case 'O':
10988
- case 'OO':
10989
- case 'OOO':
10990
- return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
10991
- // Long
10805
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
10806
+ // @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!
10807
+ return valuesArray[index];
10808
+ };
10809
+ }
10992
10810
 
10993
- case 'OOOO':
10994
- default:
10995
- return 'GMT' + formatTimezone(timezoneOffset, ':');
10996
- }
10997
- },
10998
- // Timezone (specific non-location)
10999
- z: function z(date, token, _localize, options) {
11000
- var originalDate = options._originalDate || date;
11001
- var timezoneOffset = originalDate.getTimezoneOffset();
11002
- switch (token) {
11003
- // Short
11004
- case 'z':
11005
- case 'zz':
11006
- case 'zzz':
11007
- return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
11008
- // Long
10811
+ var eraValues = {
10812
+ narrow: ['B', 'A'],
10813
+ abbreviated: ['BC', 'AD'],
10814
+ wide: ['Before Christ', 'Anno Domini']
10815
+ };
10816
+ var quarterValues = {
10817
+ narrow: ['1', '2', '3', '4'],
10818
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
10819
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
10820
+ };
11009
10821
 
11010
- case 'zzzz':
11011
- default:
11012
- return 'GMT' + formatTimezone(timezoneOffset, ':');
11013
- }
10822
+ // Note: in English, the names of days of the week and months are capitalized.
10823
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
10824
+ // Generally, formatted dates should look like they are in the middle of a sentence,
10825
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
10826
+ var monthValues = {
10827
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
10828
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
10829
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
10830
+ };
10831
+ var dayValues = {
10832
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
10833
+ "short": ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
10834
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
10835
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
10836
+ };
10837
+ var dayPeriodValues = {
10838
+ narrow: {
10839
+ am: 'a',
10840
+ pm: 'p',
10841
+ midnight: 'mi',
10842
+ noon: 'n',
10843
+ morning: 'morning',
10844
+ afternoon: 'afternoon',
10845
+ evening: 'evening',
10846
+ night: 'night'
11014
10847
  },
11015
- // Seconds timestamp
11016
- t: function t(date, token, _localize, options) {
11017
- var originalDate = options._originalDate || date;
11018
- var timestamp = Math.floor(originalDate.getTime() / 1000);
11019
- return addLeadingZeros(timestamp, token.length);
10848
+ abbreviated: {
10849
+ am: 'AM',
10850
+ pm: 'PM',
10851
+ midnight: 'midnight',
10852
+ noon: 'noon',
10853
+ morning: 'morning',
10854
+ afternoon: 'afternoon',
10855
+ evening: 'evening',
10856
+ night: 'night'
11020
10857
  },
11021
- // Milliseconds timestamp
11022
- T: function T(date, token, _localize, options) {
11023
- var originalDate = options._originalDate || date;
11024
- var timestamp = originalDate.getTime();
11025
- return addLeadingZeros(timestamp, token.length);
10858
+ wide: {
10859
+ am: 'a.m.',
10860
+ pm: 'p.m.',
10861
+ midnight: 'midnight',
10862
+ noon: 'noon',
10863
+ morning: 'morning',
10864
+ afternoon: 'afternoon',
10865
+ evening: 'evening',
10866
+ night: 'night'
11026
10867
  }
11027
10868
  };
11028
- function formatTimezoneShort(offset, dirtyDelimiter) {
11029
- var sign = offset > 0 ? '-' : '+';
11030
- var absOffset = Math.abs(offset);
11031
- var hours = Math.floor(absOffset / 60);
11032
- var minutes = absOffset % 60;
11033
- if (minutes === 0) {
11034
- return sign + String(hours);
11035
- }
11036
- var delimiter = dirtyDelimiter || '';
11037
- return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
11038
- }
11039
- function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
11040
- if (offset % 60 === 0) {
11041
- var sign = offset > 0 ? '-' : '+';
11042
- return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
10869
+ var formattingDayPeriodValues = {
10870
+ narrow: {
10871
+ am: 'a',
10872
+ pm: 'p',
10873
+ midnight: 'mi',
10874
+ noon: 'n',
10875
+ morning: 'in the morning',
10876
+ afternoon: 'in the afternoon',
10877
+ evening: 'in the evening',
10878
+ night: 'at night'
10879
+ },
10880
+ abbreviated: {
10881
+ am: 'AM',
10882
+ pm: 'PM',
10883
+ midnight: 'midnight',
10884
+ noon: 'noon',
10885
+ morning: 'in the morning',
10886
+ afternoon: 'in the afternoon',
10887
+ evening: 'in the evening',
10888
+ night: 'at night'
10889
+ },
10890
+ wide: {
10891
+ am: 'a.m.',
10892
+ pm: 'p.m.',
10893
+ midnight: 'midnight',
10894
+ noon: 'noon',
10895
+ morning: 'in the morning',
10896
+ afternoon: 'in the afternoon',
10897
+ evening: 'in the evening',
10898
+ night: 'at night'
11043
10899
  }
11044
- return formatTimezone(offset, dirtyDelimiter);
11045
- }
11046
- function formatTimezone(offset, dirtyDelimiter) {
11047
- var delimiter = dirtyDelimiter || '';
11048
- var sign = offset > 0 ? '-' : '+';
11049
- var absOffset = Math.abs(offset);
11050
- var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
11051
- var minutes = addLeadingZeros(absOffset % 60, 2);
11052
- return sign + hours + delimiter + minutes;
11053
- }
11054
- var formatters$1 = formatters;
10900
+ };
10901
+ var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
10902
+ var number = Number(dirtyNumber);
11055
10903
 
11056
- function dateLongFormatter(pattern, formatLong) {
11057
- switch (pattern) {
11058
- case 'P':
11059
- return formatLong.date({
11060
- width: 'short'
11061
- });
11062
- case 'PP':
11063
- return formatLong.date({
11064
- width: 'medium'
11065
- });
11066
- case 'PPP':
11067
- return formatLong.date({
11068
- width: 'long'
11069
- });
11070
- case 'PPPP':
11071
- default:
11072
- return formatLong.date({
11073
- width: 'full'
11074
- });
10904
+ // If ordinal numbers depend on context, for example,
10905
+ // if they are different for different grammatical genders,
10906
+ // use `options.unit`.
10907
+ //
10908
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
10909
+ // 'day', 'hour', 'minute', 'second'.
10910
+
10911
+ var rem100 = number % 100;
10912
+ if (rem100 > 20 || rem100 < 10) {
10913
+ switch (rem100 % 10) {
10914
+ case 1:
10915
+ return number + 'st';
10916
+ case 2:
10917
+ return number + 'nd';
10918
+ case 3:
10919
+ return number + 'rd';
10920
+ }
11075
10921
  }
10922
+ return number + 'th';
10923
+ };
10924
+ var localize = {
10925
+ ordinalNumber: ordinalNumber,
10926
+ era: buildLocalizeFn({
10927
+ values: eraValues,
10928
+ defaultWidth: 'wide'
10929
+ }),
10930
+ quarter: buildLocalizeFn({
10931
+ values: quarterValues,
10932
+ defaultWidth: 'wide',
10933
+ argumentCallback: function argumentCallback(quarter) {
10934
+ return quarter - 1;
10935
+ }
10936
+ }),
10937
+ month: buildLocalizeFn({
10938
+ values: monthValues,
10939
+ defaultWidth: 'wide'
10940
+ }),
10941
+ day: buildLocalizeFn({
10942
+ values: dayValues,
10943
+ defaultWidth: 'wide'
10944
+ }),
10945
+ dayPeriod: buildLocalizeFn({
10946
+ values: dayPeriodValues,
10947
+ defaultWidth: 'wide',
10948
+ formattingValues: formattingDayPeriodValues,
10949
+ defaultFormattingWidth: 'wide'
10950
+ })
10951
+ };
10952
+ var localize$1 = localize;
10953
+
10954
+ function buildMatchFn(args) {
10955
+ return function (string) {
10956
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
10957
+ var width = options.width;
10958
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
10959
+ var matchResult = string.match(matchPattern);
10960
+ if (!matchResult) {
10961
+ return null;
10962
+ }
10963
+ var matchedString = matchResult[0];
10964
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
10965
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
10966
+ return pattern.test(matchedString);
10967
+ }) : findKey(parsePatterns, function (pattern) {
10968
+ return pattern.test(matchedString);
10969
+ });
10970
+ var value;
10971
+ value = args.valueCallback ? args.valueCallback(key) : key;
10972
+ value = options.valueCallback ? options.valueCallback(value) : value;
10973
+ var rest = string.slice(matchedString.length);
10974
+ return {
10975
+ value: value,
10976
+ rest: rest
10977
+ };
10978
+ };
11076
10979
  }
11077
- function timeLongFormatter(pattern, formatLong) {
11078
- switch (pattern) {
11079
- case 'p':
11080
- return formatLong.time({
11081
- width: 'short'
11082
- });
11083
- case 'pp':
11084
- return formatLong.time({
11085
- width: 'medium'
11086
- });
11087
- case 'ppp':
11088
- return formatLong.time({
11089
- width: 'long'
11090
- });
11091
- case 'pppp':
11092
- default:
11093
- return formatLong.time({
11094
- width: 'full'
11095
- });
10980
+ function findKey(object, predicate) {
10981
+ for (var key in object) {
10982
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
10983
+ return key;
10984
+ }
11096
10985
  }
10986
+ return undefined;
11097
10987
  }
11098
- function dateTimeLongFormatter(pattern, formatLong) {
11099
- var matchResult = pattern.match(/(P+)(p+)?/);
11100
- var datePattern = matchResult[1];
11101
- var timePattern = matchResult[2];
11102
- if (!timePattern) {
11103
- return dateLongFormatter(pattern, formatLong);
11104
- }
11105
- var dateTimeFormat;
11106
- switch (datePattern) {
11107
- case 'P':
11108
- dateTimeFormat = formatLong.dateTime({
11109
- width: 'short'
11110
- });
11111
- break;
11112
- case 'PP':
11113
- dateTimeFormat = formatLong.dateTime({
11114
- width: 'medium'
11115
- });
11116
- break;
11117
- case 'PPP':
11118
- dateTimeFormat = formatLong.dateTime({
11119
- width: 'long'
11120
- });
11121
- break;
11122
- case 'PPPP':
11123
- default:
11124
- dateTimeFormat = formatLong.dateTime({
11125
- width: 'full'
11126
- });
11127
- break;
10988
+ function findIndex(array, predicate) {
10989
+ for (var key = 0; key < array.length; key++) {
10990
+ if (predicate(array[key])) {
10991
+ return key;
10992
+ }
11128
10993
  }
11129
- return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
10994
+ return undefined;
11130
10995
  }
11131
- var longFormatters = {
11132
- p: timeLongFormatter,
11133
- P: dateTimeLongFormatter
11134
- };
11135
- var longFormatters$1 = longFormatters;
11136
10996
 
11137
- var MILLISECONDS_IN_MINUTE = 60000;
11138
- function getDateMillisecondsPart(date) {
11139
- return date.getTime() % MILLISECONDS_IN_MINUTE;
10997
+ function buildMatchPatternFn(args) {
10998
+ return function (string) {
10999
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
11000
+ var matchResult = string.match(args.matchPattern);
11001
+ if (!matchResult) return null;
11002
+ var matchedString = matchResult[0];
11003
+ var parseResult = string.match(args.parsePattern);
11004
+ if (!parseResult) return null;
11005
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
11006
+ value = options.valueCallback ? options.valueCallback(value) : value;
11007
+ var rest = string.slice(matchedString.length);
11008
+ return {
11009
+ value: value,
11010
+ rest: rest
11011
+ };
11012
+ };
11140
11013
  }
11141
- /**
11142
- * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
11143
- * They usually appear for dates that denote time before the timezones were introduced
11144
- * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
11145
- * and GMT+01:00:00 after that date)
11146
- *
11147
- * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
11148
- * which would lead to incorrect calculations.
11149
- *
11150
- * This function returns the timezone offset in milliseconds that takes seconds in account.
11151
- */
11152
11014
 
11153
- function getTimezoneOffsetInMilliseconds(dirtyDate) {
11154
- var date = new Date(dirtyDate.getTime());
11155
- var baseTimezoneOffset = Math.ceil(date.getTimezoneOffset());
11156
- date.setSeconds(0, 0);
11157
- var hasNegativeUTCOffset = baseTimezoneOffset > 0;
11158
- var millisecondsPartOfTimezoneOffset = hasNegativeUTCOffset ? (MILLISECONDS_IN_MINUTE + getDateMillisecondsPart(date)) % MILLISECONDS_IN_MINUTE : getDateMillisecondsPart(date);
11159
- return baseTimezoneOffset * MILLISECONDS_IN_MINUTE + millisecondsPartOfTimezoneOffset;
11160
- }
11015
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
11016
+ var parseOrdinalNumberPattern = /\d+/i;
11017
+ var matchEraPatterns = {
11018
+ narrow: /^(b|a)/i,
11019
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
11020
+ wide: /^(before christ|before common era|anno domini|common era)/i
11021
+ };
11022
+ var parseEraPatterns = {
11023
+ any: [/^b/i, /^(a|c)/i]
11024
+ };
11025
+ var matchQuarterPatterns = {
11026
+ narrow: /^[1234]/i,
11027
+ abbreviated: /^q[1234]/i,
11028
+ wide: /^[1234](th|st|nd|rd)? quarter/i
11029
+ };
11030
+ var parseQuarterPatterns = {
11031
+ any: [/1/i, /2/i, /3/i, /4/i]
11032
+ };
11033
+ var matchMonthPatterns = {
11034
+ narrow: /^[jfmasond]/i,
11035
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
11036
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
11037
+ };
11038
+ var parseMonthPatterns = {
11039
+ 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],
11040
+ 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]
11041
+ };
11042
+ var matchDayPatterns = {
11043
+ narrow: /^[smtwf]/i,
11044
+ "short": /^(su|mo|tu|we|th|fr|sa)/i,
11045
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
11046
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
11047
+ };
11048
+ var parseDayPatterns = {
11049
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
11050
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
11051
+ };
11052
+ var matchDayPeriodPatterns = {
11053
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
11054
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
11055
+ };
11056
+ var parseDayPeriodPatterns = {
11057
+ any: {
11058
+ am: /^a/i,
11059
+ pm: /^p/i,
11060
+ midnight: /^mi/i,
11061
+ noon: /^no/i,
11062
+ morning: /morning/i,
11063
+ afternoon: /afternoon/i,
11064
+ evening: /evening/i,
11065
+ night: /night/i
11066
+ }
11067
+ };
11068
+ var match = {
11069
+ ordinalNumber: buildMatchPatternFn({
11070
+ matchPattern: matchOrdinalNumberPattern,
11071
+ parsePattern: parseOrdinalNumberPattern,
11072
+ valueCallback: function valueCallback(value) {
11073
+ return parseInt(value, 10);
11074
+ }
11075
+ }),
11076
+ era: buildMatchFn({
11077
+ matchPatterns: matchEraPatterns,
11078
+ defaultMatchWidth: 'wide',
11079
+ parsePatterns: parseEraPatterns,
11080
+ defaultParseWidth: 'any'
11081
+ }),
11082
+ quarter: buildMatchFn({
11083
+ matchPatterns: matchQuarterPatterns,
11084
+ defaultMatchWidth: 'wide',
11085
+ parsePatterns: parseQuarterPatterns,
11086
+ defaultParseWidth: 'any',
11087
+ valueCallback: function valueCallback(index) {
11088
+ return index + 1;
11089
+ }
11090
+ }),
11091
+ month: buildMatchFn({
11092
+ matchPatterns: matchMonthPatterns,
11093
+ defaultMatchWidth: 'wide',
11094
+ parsePatterns: parseMonthPatterns,
11095
+ defaultParseWidth: 'any'
11096
+ }),
11097
+ day: buildMatchFn({
11098
+ matchPatterns: matchDayPatterns,
11099
+ defaultMatchWidth: 'wide',
11100
+ parsePatterns: parseDayPatterns,
11101
+ defaultParseWidth: 'any'
11102
+ }),
11103
+ dayPeriod: buildMatchFn({
11104
+ matchPatterns: matchDayPeriodPatterns,
11105
+ defaultMatchWidth: 'any',
11106
+ parsePatterns: parseDayPeriodPatterns,
11107
+ defaultParseWidth: 'any'
11108
+ })
11109
+ };
11110
+ var match$1 = match;
11161
11111
 
11162
- var protectedDayOfYearTokens = ['D', 'DD'];
11163
- var protectedWeekYearTokens = ['YY', 'YYYY'];
11164
- function isProtectedDayOfYearToken(token) {
11165
- return protectedDayOfYearTokens.indexOf(token) !== -1;
11166
- }
11167
- function isProtectedWeekYearToken(token) {
11168
- return protectedWeekYearTokens.indexOf(token) !== -1;
11169
- }
11170
- function throwProtectedError(token, format, input) {
11171
- if (token === 'YYYY') {
11172
- throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
11173
- } else if (token === 'YY') {
11174
- throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
11175
- } else if (token === 'D') {
11176
- 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"));
11177
- } else if (token === 'DD') {
11178
- 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"));
11112
+ /**
11113
+ * @type {Locale}
11114
+ * @category Locales
11115
+ * @summary English locale (United States).
11116
+ * @language English
11117
+ * @iso-639-2 eng
11118
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
11119
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
11120
+ */
11121
+ var locale = {
11122
+ code: 'en-US',
11123
+ formatDistance: formatDistance$1,
11124
+ formatLong: formatLong$1,
11125
+ formatRelative: formatRelative$1,
11126
+ localize: localize$1,
11127
+ match: match$1,
11128
+ options: {
11129
+ weekStartsOn: 0 /* Sunday */,
11130
+ firstWeekContainsDate: 1
11179
11131
  }
11180
- }
11132
+ };
11133
+ var defaultLocale = locale;
11181
11134
 
11182
11135
  // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
11183
11136
  // (one of the certain letters followed by `o`)
@@ -11189,14 +11142,15 @@ function throwProtectedError(token, format, input) {
11189
11142
  // If there is no matching single quote
11190
11143
  // then the sequence will continue until the end of the string.
11191
11144
  // - . matches any single character unmatched by previous parts of the RegExps
11145
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
11192
11146
 
11193
- var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also
11147
+ // This RegExp catches symbols escaped by quotes, and also
11194
11148
  // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
11195
-
11196
11149
  var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
11197
11150
  var escapedStringRegExp = /^'([^]*?)'?$/;
11198
11151
  var doubleQuoteRegExp = /''/g;
11199
11152
  var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
11153
+
11200
11154
  /**
11201
11155
  * @name format
11202
11156
  * @category Common Helpers
@@ -11206,7 +11160,7 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
11206
11160
  * Return the formatted date string in the given format. The result may vary by locale.
11207
11161
  *
11208
11162
  * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
11209
- * > See: https://git.io/fxCyr
11163
+ * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
11210
11164
  *
11211
11165
  * The characters wrapped between two single quotes characters (') are escaped.
11212
11166
  * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
@@ -11285,32 +11239,34 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
11285
11239
  * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
11286
11240
  * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
11287
11241
  * | | EEEEE | M, T, W, T, F, S, S | |
11288
- * | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |
11242
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
11289
11243
  * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
11290
11244
  * | | io | 1st, 2nd, ..., 7th | 7 |
11291
11245
  * | | ii | 01, 02, ..., 07 | 7 |
11292
11246
  * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
11293
11247
  * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
11294
11248
  * | | iiiii | M, T, W, T, F, S, S | 7 |
11295
- * | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 |
11249
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
11296
11250
  * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
11297
11251
  * | | eo | 2nd, 3rd, ..., 1st | 7 |
11298
11252
  * | | ee | 02, 03, ..., 01 | |
11299
11253
  * | | eee | Mon, Tue, Wed, ..., Sun | |
11300
11254
  * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
11301
11255
  * | | eeeee | M, T, W, T, F, S, S | |
11302
- * | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |
11256
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
11303
11257
  * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
11304
11258
  * | | co | 2nd, 3rd, ..., 1st | 7 |
11305
11259
  * | | cc | 02, 03, ..., 01 | |
11306
11260
  * | | ccc | Mon, Tue, Wed, ..., Sun | |
11307
11261
  * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
11308
11262
  * | | ccccc | M, T, W, T, F, S, S | |
11309
- * | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |
11310
- * | AM, PM | a..aaa | AM, PM | |
11263
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
11264
+ * | AM, PM | a..aa | AM, PM | |
11265
+ * | | aaa | am, pm | |
11311
11266
  * | | aaaa | a.m., p.m. | 2 |
11312
11267
  * | | aaaaa | a, p | |
11313
- * | AM, PM, noon, midnight | b..bbb | AM, PM, noon, midnight | |
11268
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
11269
+ * | | bbb | am, pm, noon, midnight | |
11314
11270
  * | | bbbb | a.m., p.m., noon, midnight | 2 |
11315
11271
  * | | bbbbb | a, p, n, mi | |
11316
11272
  * | Flexible day period | B..BBB | at night, in the morning, ... | |
@@ -11336,7 +11292,7 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
11336
11292
  * | | ss | 00, 01, ..., 59 | |
11337
11293
  * | Fraction of second | S | 0, 1, ..., 9 | |
11338
11294
  * | | SS | 00, 01, ..., 99 | |
11339
- * | | SSS | 000, 0001, ..., 999 | |
11295
+ * | | SSS | 000, 001, ..., 999 | |
11340
11296
  * | | SSSS | ... | 3 |
11341
11297
  * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
11342
11298
  * | | XX | -0800, +0530, Z | |
@@ -11356,18 +11312,18 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
11356
11312
  * | | tt | ... | 3,7 |
11357
11313
  * | Milliseconds timestamp | T | 512969520900 | 7 |
11358
11314
  * | | TT | ... | 3,7 |
11359
- * | Long localized date | P | 05/29/1453 | 7 |
11360
- * | | PP | May 29, 1453 | 7 |
11361
- * | | PPP | May 29th, 1453 | 7 |
11362
- * | | PPPP | Sunday, May 29th, 1453 | 2,7 |
11315
+ * | Long localized date | P | 04/29/1453 | 7 |
11316
+ * | | PP | Apr 29, 1453 | 7 |
11317
+ * | | PPP | April 29th, 1453 | 7 |
11318
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
11363
11319
  * | Long localized time | p | 12:00 AM | 7 |
11364
11320
  * | | pp | 12:00:00 AM | 7 |
11365
11321
  * | | ppp | 12:00:00 AM GMT+2 | 7 |
11366
11322
  * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
11367
- * | Combination of date and time | Pp | 05/29/1453, 12:00 AM | 7 |
11368
- * | | PPpp | May 29, 1453, 12:00:00 AM | 7 |
11369
- * | | PPPppp | May 29th, 1453 at ... | 7 |
11370
- * | | PPPPpppp| Sunday, May 29th, 1453 at ... | 2,7 |
11323
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
11324
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
11325
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
11326
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
11371
11327
  * Notes:
11372
11328
  * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
11373
11329
  * are the same as "stand-alone" units, but are different in some languages.
@@ -11440,30 +11396,10 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
11440
11396
  * - `p`: long localized time
11441
11397
  *
11442
11398
  * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
11443
- * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://git.io/fxCyr
11444
- *
11445
- * 9. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.
11446
- * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://git.io/fxCyr
11447
- *
11448
- * ### v2.0.0 breaking changes:
11399
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
11449
11400
  *
11450
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
11451
- *
11452
- * - The second argument is now required for the sake of explicitness.
11453
- *
11454
- * ```javascript
11455
- * // Before v2.0.0
11456
- * format(new Date(2016, 0, 1))
11457
- *
11458
- * // v2.0.0 onward
11459
- * format(new Date(2016, 0, 1), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")
11460
- * ```
11461
- *
11462
- * - New format string API for `format` function
11463
- * which is based on [Unicode Technical Standard #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).
11464
- * See [this post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.
11465
- *
11466
- * - Characters are now escaped using single quote symbols (`'`) instead of square brackets.
11401
+ * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
11402
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
11467
11403
  *
11468
11404
  * @param {Date|Number} date - the original date
11469
11405
  * @param {String} format - the string of tokens
@@ -11472,9 +11408,9 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
11472
11408
  * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
11473
11409
  * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
11474
11410
  * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
11475
- * see: https://git.io/fxCyr
11411
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
11476
11412
  * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
11477
- * see: https://git.io/fxCyr
11413
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
11478
11414
  * @returns {String} the formatted date string
11479
11415
  * @throws {TypeError} 2 arguments required
11480
11416
  * @throws {RangeError} `date` must not be Invalid Date
@@ -11482,47 +11418,46 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
11482
11418
  * @throws {RangeError} `options.locale` must contain `formatLong` property
11483
11419
  * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
11484
11420
  * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
11485
- * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
11486
- * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
11487
- * @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
11488
- * @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
11421
+ * @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
11422
+ * @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
11423
+ * @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
11424
+ * @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
11489
11425
  * @throws {RangeError} format string contains an unescaped latin alphabet character
11490
11426
  *
11491
11427
  * @example
11492
11428
  * // Represent 11 February 2014 in middle-endian format:
11493
- * var result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
11429
+ * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
11494
11430
  * //=> '02/11/2014'
11495
11431
  *
11496
11432
  * @example
11497
11433
  * // Represent 2 July 2014 in Esperanto:
11498
11434
  * import { eoLocale } from 'date-fns/locale/eo'
11499
- * var result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
11435
+ * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
11500
11436
  * locale: eoLocale
11501
11437
  * })
11502
11438
  * //=> '2-a de julio 2014'
11503
11439
  *
11504
11440
  * @example
11505
11441
  * // Escape string by single quote characters:
11506
- * var result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
11442
+ * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
11507
11443
  * //=> "3 o'clock"
11508
11444
  */
11509
11445
 
11510
- function format$1(dirtyDate, dirtyFormatStr, dirtyOptions) {
11446
+ function format(dirtyDate, dirtyFormatStr, options) {
11447
+ 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;
11511
11448
  requiredArgs(2, arguments);
11512
11449
  var formatStr = String(dirtyFormatStr);
11513
- var options = dirtyOptions || {};
11514
- var locale = options.locale || defaultLocale;
11515
- var localeFirstWeekContainsDate = locale.options && locale.options.firstWeekContainsDate;
11516
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
11517
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
11450
+ var defaultOptions = getDefaultOptions();
11451
+ var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;
11452
+ 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);
11518
11453
 
11454
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
11519
11455
  if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
11520
11456
  throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
11521
11457
  }
11522
- var localeWeekStartsOn = locale.options && locale.options.weekStartsOn;
11523
- var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
11524
- var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
11458
+ 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);
11525
11459
 
11460
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
11526
11461
  if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
11527
11462
  throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
11528
11463
  }
@@ -11535,10 +11470,11 @@ function format$1(dirtyDate, dirtyFormatStr, dirtyOptions) {
11535
11470
  var originalDate = toDate(dirtyDate);
11536
11471
  if (!isValid(originalDate)) {
11537
11472
  throw new RangeError('Invalid time value');
11538
- } // Convert the date in system timezone to the same date in UTC+00:00 timezone.
11473
+ }
11474
+
11475
+ // Convert the date in system timezone to the same date in UTC+00:00 timezone.
11539
11476
  // This ensures that when UTC functions will be implemented, locales will be compatible with them.
11540
11477
  // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
11541
-
11542
11478
  var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
11543
11479
  var utcDate = subMilliseconds(originalDate, timezoneOffset);
11544
11480
  var formatterOptions = {
@@ -11551,7 +11487,7 @@ function format$1(dirtyDate, dirtyFormatStr, dirtyOptions) {
11551
11487
  var firstCharacter = substring[0];
11552
11488
  if (firstCharacter === 'p' || firstCharacter === 'P') {
11553
11489
  var longFormatter = longFormatters$1[firstCharacter];
11554
- return longFormatter(substring, locale.formatLong, formatterOptions);
11490
+ return longFormatter(substring, locale.formatLong);
11555
11491
  }
11556
11492
  return substring;
11557
11493
  }).join('').match(formattingTokensRegExp).map(function (substring) {
@@ -11565,11 +11501,11 @@ function format$1(dirtyDate, dirtyFormatStr, dirtyOptions) {
11565
11501
  }
11566
11502
  var formatter = formatters$1[firstCharacter];
11567
11503
  if (formatter) {
11568
- if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
11569
- throwProtectedError(substring, dirtyFormatStr, dirtyDate);
11504
+ if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
11505
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
11570
11506
  }
11571
- if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
11572
- throwProtectedError(substring, dirtyFormatStr, dirtyDate);
11507
+ if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
11508
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
11573
11509
  }
11574
11510
  return formatter(utcDate, substring, locale.localize, formatterOptions);
11575
11511
  }
@@ -11581,23 +11517,28 @@ function format$1(dirtyDate, dirtyFormatStr, dirtyOptions) {
11581
11517
  return result;
11582
11518
  }
11583
11519
  function cleanEscapedString(input) {
11584
- return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
11520
+ var matched = input.match(escapedStringRegExp);
11521
+ if (!matched) {
11522
+ return input;
11523
+ }
11524
+ return matched[1].replace(doubleQuoteRegExp, "'");
11585
11525
  }
11586
11526
 
11587
- function convertToFP(fn, arity, a) {
11588
- a = a || [];
11527
+ function convertToFP(fn, arity) {
11528
+ var a = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
11589
11529
  if (a.length >= arity) {
11590
11530
  return fn.apply(null, a.slice(0, arity).reverse());
11591
11531
  }
11592
11532
  return function () {
11593
- var args = Array.prototype.slice.call(arguments);
11533
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
11534
+ args[_key] = arguments[_key];
11535
+ }
11594
11536
  return convertToFP(fn, arity, a.concat(args));
11595
11537
  };
11596
11538
  }
11597
11539
 
11598
- // This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
11599
- var format = convertToFP(format$1, 2);
11600
- var formatTime = format;
11540
+ // This file is generated automatically by `scripts/build/fp.ts`. Please, don't change it.
11541
+ var formatTime = convertToFP(format, 2);
11601
11542
 
11602
11543
  var Wrapper = index$9(reactNative.View)(function () {
11603
11544
  return {
@@ -12363,7 +12304,7 @@ var StyledPageControlWrapper = index$9(reactNative.View)(function (_ref7) {
12363
12304
  });
12364
12305
 
12365
12306
  function isCarouselImageProps(image) {
12366
- return _typeof(image) === 'object';
12307
+ return _typeof$1(image) === 'object';
12367
12308
  }
12368
12309
  var CarouselItem = function CarouselItem(_ref) {
12369
12310
  var width = _ref.width,
@@ -17404,7 +17345,6 @@ var index$3 = Object.assign(Switch, {
17404
17345
  Selector: SelectorSwitch
17405
17346
  });
17406
17347
 
17407
- var AnimatedPagerView = reactNative.Animated.createAnimatedComponent(PagerView__default["default"]);
17408
17348
  var TabContainer$1 = index$9(reactNative.View)({
17409
17349
  flex: 1,
17410
17350
  overflow: 'hidden'
@@ -17429,9 +17369,6 @@ var HeaderTabItem$1 = index$9(reactNative.View)(function (_ref2) {
17429
17369
  paddingVertical: theme.__hd__.tabs.space.itemVerticalPadding
17430
17370
  };
17431
17371
  });
17432
- var ContentWrapper$1 = index$9(AnimatedPagerView)({
17433
- flex: 1
17434
- });
17435
17372
  index$9(reactNative.View)({
17436
17373
  flex: 1
17437
17374
  });
@@ -17479,9 +17416,6 @@ var TabContainer = index$9(reactNative.View)({
17479
17416
  flex: 1,
17480
17417
  overflow: 'hidden'
17481
17418
  });
17482
- var ContentWrapper = index$9(PagerView__default["default"])({
17483
- flex: 1
17484
- });
17485
17419
  var HeaderTabWrapper = index$9(reactNative.View)(function (_ref) {
17486
17420
  var themeInsets = _ref.themeInsets;
17487
17421
  return {
@@ -17932,7 +17866,8 @@ var ScrollableTab = function ScrollableTab(_ref) {
17932
17866
  insets: insets,
17933
17867
  testID: componentTestID ? "".concat(componentTestID, "-tab-bar") : undefined,
17934
17868
  variant: variant
17935
- }), /*#__PURE__*/React__default["default"].createElement(ContentWrapper, {
17869
+ }), /*#__PURE__*/React__default["default"].createElement(PagerView__default["default"], {
17870
+ useNext: true,
17936
17871
  initialPage: selectedTabIndex,
17937
17872
  ref: pagerViewRef,
17938
17873
  onPageScrollStateChanged: function onPageScrollStateChanged(e) {
@@ -17949,7 +17884,10 @@ var ScrollableTab = function ScrollableTab(_ref) {
17949
17884
  });
17950
17885
  }
17951
17886
  },
17952
- scrollEnabled: swipeEnabled
17887
+ scrollEnabled: swipeEnabled,
17888
+ style: {
17889
+ flex: 1
17890
+ }
17953
17891
  }, tabs.map(function (tab, index) {
17954
17892
  var key = tab.key,
17955
17893
  component = tab.component,
@@ -17967,6 +17905,7 @@ var ScrollableTab = function ScrollableTab(_ref) {
17967
17905
  }))));
17968
17906
  };
17969
17907
 
17908
+ var AnimatedPagerView = reactNative.Animated.createAnimatedComponent(PagerView__default["default"]);
17970
17909
  var getTabItem = function getTabItem(_ref) {
17971
17910
  var item = _ref.item,
17972
17911
  color = _ref.color,
@@ -18064,7 +18003,8 @@ var Tabs = function Tabs(_ref2) {
18064
18003
  scrollOffsetAnimatedValue: scrollOffsetAnimatedValue,
18065
18004
  tabsLength: tabs.length,
18066
18005
  tabsWidth: tabsWidth
18067
- }))), /*#__PURE__*/React__default["default"].createElement(ContentWrapper$1, {
18006
+ }))), /*#__PURE__*/React__default["default"].createElement(AnimatedPagerView, {
18007
+ useNext: true,
18068
18008
  initialPage: selectedTabIndex,
18069
18009
  ref: pagerViewRef,
18070
18010
  onPageSelected: function onPageSelected(e) {
@@ -18082,7 +18022,10 @@ var Tabs = function Tabs(_ref2) {
18082
18022
  }], {
18083
18023
  useNativeDriver: true
18084
18024
  }),
18085
- scrollEnabled: swipeEnabled
18025
+ scrollEnabled: swipeEnabled,
18026
+ style: {
18027
+ flex: 1
18028
+ }
18086
18029
  }, tabs.map(function (tab, index) {
18087
18030
  var key = tab.key,
18088
18031
  component = tab.component,
@@ -18824,7 +18767,7 @@ var scheduler_production_min = {};
18824
18767
  var c = a.sortIndex - b.sortIndex;
18825
18768
  return 0 !== c ? c : a.id - b.id;
18826
18769
  }
18827
- if ("object" === (typeof performance === "undefined" ? "undefined" : _typeof(performance)) && "function" === typeof performance.now) {
18770
+ if ("object" === (typeof performance === "undefined" ? "undefined" : _typeof$1(performance)) && "function" === typeof performance.now) {
18828
18771
  var l = performance;
18829
18772
  exports.unstable_now = function () {
18830
18773
  return l.now();
@@ -18995,7 +18938,7 @@ var scheduler_production_min = {};
18995
18938
  };
18996
18939
  exports.unstable_scheduleCallback = function (a, b, c) {
18997
18940
  var d = exports.unstable_now();
18998
- "object" === _typeof(c) && null !== c ? (c = c.delay, c = "number" === typeof c && 0 < c ? d + c : d) : c = d;
18941
+ "object" === _typeof$1(c) && null !== c ? (c = c.delay, c = "number" === typeof c && 0 < c ? d + c : d) : c = d;
18999
18942
  switch (a) {
19000
18943
  case 1:
19001
18944
  var e = -1;
@@ -19073,7 +19016,7 @@ function oa(a) {
19073
19016
  }
19074
19017
  function pa(a, b, c, d) {
19075
19018
  if (null !== c && 0 === c.type) return !1;
19076
- switch (_typeof(b)) {
19019
+ switch (_typeof$1(b)) {
19077
19020
  case "function":
19078
19021
  case "symbol":
19079
19022
  return !0;
@@ -19183,7 +19126,7 @@ var ua = aa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
19183
19126
  var Ia = Symbol["for"]("react.offscreen");
19184
19127
  var Ja = Symbol.iterator;
19185
19128
  function Ka(a) {
19186
- if (null === a || "object" !== _typeof(a)) return null;
19129
+ if (null === a || "object" !== _typeof$1(a)) return null;
19187
19130
  a = Ja && a[Ja] || a["@@iterator"];
19188
19131
  return "function" === typeof a ? a : null;
19189
19132
  }
@@ -19212,7 +19155,7 @@ function Oa(a, b) {
19212
19155
  set: function set() {
19213
19156
  throw Error();
19214
19157
  }
19215
- }), "object" === (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && Reflect.construct) {
19158
+ }), "object" === (typeof Reflect === "undefined" ? "undefined" : _typeof$1(Reflect)) && Reflect.construct) {
19216
19159
  try {
19217
19160
  Reflect.construct(b, []);
19218
19161
  } catch (l) {
@@ -19294,7 +19237,7 @@ function Qa(a) {
19294
19237
  case Fa:
19295
19238
  return "SuspenseList";
19296
19239
  }
19297
- if ("object" === _typeof(a)) switch (a.$$typeof) {
19240
+ if ("object" === _typeof$1(a)) switch (a.$$typeof) {
19298
19241
  case Ca:
19299
19242
  return (a.displayName || "Context") + ".Consumer";
19300
19243
  case Ba:
@@ -19366,7 +19309,7 @@ function Ra(a) {
19366
19309
  return null;
19367
19310
  }
19368
19311
  function Sa(a) {
19369
- switch (_typeof(a)) {
19312
+ switch (_typeof$1(a)) {
19370
19313
  case "boolean":
19371
19314
  case "number":
19372
19315
  case "string":
@@ -19677,9 +19620,9 @@ function ub(a, b) {
19677
19620
  if (tb[a] && (null != b.children || null != b.dangerouslySetInnerHTML)) throw Error(p(137, a));
19678
19621
  if (null != b.dangerouslySetInnerHTML) {
19679
19622
  if (null != b.children) throw Error(p(60));
19680
- if ("object" !== _typeof(b.dangerouslySetInnerHTML) || !("__html" in b.dangerouslySetInnerHTML)) throw Error(p(61));
19623
+ if ("object" !== _typeof$1(b.dangerouslySetInnerHTML) || !("__html" in b.dangerouslySetInnerHTML)) throw Error(p(61));
19681
19624
  }
19682
- if (null != b.style && "object" !== _typeof(b.style)) throw Error(p(62));
19625
+ if (null != b.style && "object" !== _typeof$1(b.style)) throw Error(p(62));
19683
19626
  }
19684
19627
  }
19685
19628
  function vb(a, b) {
@@ -19765,7 +19708,7 @@ function Kb(a, b) {
19765
19708
  a = !1;
19766
19709
  }
19767
19710
  if (a) return null;
19768
- if (c && "function" !== typeof c) throw Error(p(231, b, _typeof(c)));
19711
+ if (c && "function" !== typeof c) throw Error(p(231, b, _typeof$1(c)));
19769
19712
  return c;
19770
19713
  }
19771
19714
  var Lb = !1;
@@ -20679,7 +20622,7 @@ function ge(a, b) {
20679
20622
  }
20680
20623
  function he(a) {
20681
20624
  a = a.detail;
20682
- return "object" === _typeof(a) && "data" in a ? a.data : null;
20625
+ return "object" === _typeof$1(a) && "data" in a ? a.data : null;
20683
20626
  }
20684
20627
  var ie = !1;
20685
20628
  function je(a, b) {
@@ -20796,7 +20739,7 @@ function Ge(a, b) {
20796
20739
  var He = "function" === typeof Object.is ? Object.is : Ge;
20797
20740
  function Ie(a, b) {
20798
20741
  if (He(a, b)) return !0;
20799
- if ("object" !== _typeof(a) || null === a || "object" !== _typeof(b) || null === b) return !1;
20742
+ if ("object" !== _typeof$1(a) || null === a || "object" !== _typeof$1(b) || null === b) return !1;
20800
20743
  var c = Object.keys(a),
20801
20744
  d = Object.keys(b);
20802
20745
  if (c.length !== d.length) return !1;
@@ -21323,7 +21266,7 @@ function Bf() {}
21323
21266
  var Cf = null,
21324
21267
  Df = null;
21325
21268
  function Ef(a, b) {
21326
- return "textarea" === a || "noscript" === a || "string" === typeof b.children || "number" === typeof b.children || "object" === _typeof(b.dangerouslySetInnerHTML) && null !== b.dangerouslySetInnerHTML && null != b.dangerouslySetInnerHTML.__html;
21269
+ 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;
21327
21270
  }
21328
21271
  var Ff = "function" === typeof setTimeout ? setTimeout : void 0,
21329
21272
  Gf = "function" === typeof clearTimeout ? clearTimeout : void 0,
@@ -21971,7 +21914,7 @@ function ph(a, b, c) {
21971
21914
  var d = !1,
21972
21915
  e = Vf;
21973
21916
  var f = b.contextType;
21974
- "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);
21917
+ "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);
21975
21918
  b = new b(c, f);
21976
21919
  a.memoizedState = null !== b.state && void 0 !== b.state ? b.state : null;
21977
21920
  b.updater = nh;
@@ -21993,7 +21936,7 @@ function rh(a, b, c, d) {
21993
21936
  e.refs = jh;
21994
21937
  ah(a);
21995
21938
  var f = b.contextType;
21996
- "object" === _typeof(f) && null !== f ? e.context = Vg(f) : (f = Zf(b) ? Xf : H.current, e.context = Yf(a, f));
21939
+ "object" === _typeof$1(f) && null !== f ? e.context = Vg(f) : (f = Zf(b) ? Xf : H.current, e.context = Yf(a, f));
21997
21940
  e.state = a.memoizedState;
21998
21941
  f = b.getDerivedStateFromProps;
21999
21942
  "function" === typeof f && (kh(a, b, f, c), e.state = a.memoizedState);
@@ -22002,7 +21945,7 @@ function rh(a, b, c, d) {
22002
21945
  }
22003
21946
  function sh(a, b, c) {
22004
21947
  a = c.ref;
22005
- if (null !== a && "function" !== typeof a && "object" !== _typeof(a)) {
21948
+ if (null !== a && "function" !== typeof a && "object" !== _typeof$1(a)) {
22006
21949
  if (c._owner) {
22007
21950
  c = c._owner;
22008
21951
  if (c) {
@@ -22077,7 +22020,7 @@ function vh(a) {
22077
22020
  function k(a, b, c, d) {
22078
22021
  var f = c.type;
22079
22022
  if (f === ya) return m(a, b, c.props.children, d, c.key);
22080
- 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;
22023
+ 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;
22081
22024
  d = yh(c.type, c.key, c.props, null, a.mode, d);
22082
22025
  d.ref = sh(a, b, c);
22083
22026
  d["return"] = a;
@@ -22097,7 +22040,7 @@ function vh(a) {
22097
22040
  }
22098
22041
  function q(a, b, c) {
22099
22042
  if ("string" === typeof b && "" !== b || "number" === typeof b) return b = xh("" + b, a.mode, c), b["return"] = a, b;
22100
- if ("object" === _typeof(b) && null !== b) {
22043
+ if ("object" === _typeof$1(b) && null !== b) {
22101
22044
  switch (b.$$typeof) {
22102
22045
  case va:
22103
22046
  return c = yh(b.type, b.key, b.props, null, a.mode, c), c.ref = sh(a, null, b), c["return"] = a, c;
@@ -22115,7 +22058,7 @@ function vh(a) {
22115
22058
  function r(a, b, c, d) {
22116
22059
  var e = null !== b ? b.key : null;
22117
22060
  if ("string" === typeof c && "" !== c || "number" === typeof c) return null !== e ? null : h(a, b, "" + c, d);
22118
- if ("object" === _typeof(c) && null !== c) {
22061
+ if ("object" === _typeof$1(c) && null !== c) {
22119
22062
  switch (c.$$typeof) {
22120
22063
  case va:
22121
22064
  return c.key === e ? k(a, b, c, d) : null;
@@ -22131,7 +22074,7 @@ function vh(a) {
22131
22074
  }
22132
22075
  function y(a, b, c, d, e) {
22133
22076
  if ("string" === typeof d && "" !== d || "number" === typeof d) return a = a.get(c) || null, h(b, a, "" + d, e);
22134
- if ("object" === _typeof(d) && null !== d) {
22077
+ if ("object" === _typeof$1(d) && null !== d) {
22135
22078
  switch (d.$$typeof) {
22136
22079
  case va:
22137
22080
  return a = a.get(null === d.key ? c : d.key) || null, k(b, a, d, e);
@@ -22205,8 +22148,8 @@ function vh(a) {
22205
22148
  return l;
22206
22149
  }
22207
22150
  function J(a, d, f, h) {
22208
- "object" === _typeof(f) && null !== f && f.type === ya && null === f.key && (f = f.props.children);
22209
- if ("object" === _typeof(f) && null !== f) {
22151
+ "object" === _typeof$1(f) && null !== f && f.type === ya && null === f.key && (f = f.props.children);
22152
+ if ("object" === _typeof$1(f) && null !== f) {
22210
22153
  switch (f.$$typeof) {
22211
22154
  case va:
22212
22155
  a: {
@@ -22221,7 +22164,7 @@ function vh(a) {
22221
22164
  a = d;
22222
22165
  break a;
22223
22166
  }
22224
- } else if (l.elementType === k || "object" === _typeof(k) && null !== k && k.$$typeof === Ha && uh(k) === l.type) {
22167
+ } else if (l.elementType === k || "object" === _typeof$1(k) && null !== k && k.$$typeof === Ha && uh(k) === l.type) {
22225
22168
  c(a, l.sibling);
22226
22169
  d = e(l, f.props);
22227
22170
  d.ref = sh(a, l, f);
@@ -23106,7 +23049,7 @@ function ij(a, b, c, d, e) {
23106
23049
  g.props = h;
23107
23050
  var k = g.context,
23108
23051
  l = c.contextType;
23109
- "object" === _typeof(l) && null !== l ? l = Vg(l) : (l = Zf(c) ? Xf : H.current, l = Yf(b, l));
23052
+ "object" === _typeof$1(l) && null !== l ? l = Vg(l) : (l = Zf(c) ? Xf : H.current, l = Yf(b, l));
23110
23053
  var m = c.getDerivedStateFromProps,
23111
23054
  q = "function" === typeof m || "function" === typeof g.getSnapshotBeforeUpdate;
23112
23055
  q || "function" !== typeof g.UNSAFE_componentWillReceiveProps && "function" !== typeof g.componentWillReceiveProps || (h !== d || k !== l) && qh(b, g, d, l);
@@ -23125,7 +23068,7 @@ function ij(a, b, c, d, e) {
23125
23068
  q = b.pendingProps;
23126
23069
  r = g.context;
23127
23070
  k = c.contextType;
23128
- "object" === _typeof(k) && null !== k ? k = Vg(k) : (k = Zf(c) ? Xf : H.current, k = Yf(b, k));
23071
+ "object" === _typeof$1(k) && null !== k ? k = Vg(k) : (k = Zf(c) ? Xf : H.current, k = Yf(b, k));
23129
23072
  var y = c.getDerivedStateFromProps;
23130
23073
  (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);
23131
23074
  $g = !1;
@@ -25038,7 +24981,7 @@ function Nk(a, b) {
25038
24981
  k = b;
25039
24982
  b = Z;
25040
24983
  h.flags |= 32768;
25041
- if (null !== k && "object" === _typeof(k) && "function" === typeof k.then) {
24984
+ if (null !== k && "object" === _typeof$1(k) && "function" === typeof k.then) {
25042
24985
  var l = k,
25043
24986
  m = h,
25044
24987
  q = m.tag;
@@ -25459,7 +25402,7 @@ Wk = function Wk(a, b, c) {
25459
25402
  e = Xh(null, b, d, a, e, c);
25460
25403
  var f = bi();
25461
25404
  b.flags |= 1;
25462
- "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);
25405
+ "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);
25463
25406
  return b;
25464
25407
  case 16:
25465
25408
  d = b.elementType;
@@ -25700,7 +25643,7 @@ function yh(a, b, c, d, e, f) {
25700
25643
  case Ia:
25701
25644
  return qj(c, e, f, b);
25702
25645
  default:
25703
- if ("object" === _typeof(a) && null !== a) switch (a.$$typeof) {
25646
+ if ("object" === _typeof$1(a) && null !== a) switch (a.$$typeof) {
25704
25647
  case Ba:
25705
25648
  g = 10;
25706
25649
  break a;
@@ -25718,7 +25661,7 @@ function yh(a, b, c, d, e, f) {
25718
25661
  d = null;
25719
25662
  break a;
25720
25663
  }
25721
- throw Error(p(130, null == a ? a : _typeof(a), ""));
25664
+ throw Error(p(130, null == a ? a : _typeof$1(a), ""));
25722
25665
  }
25723
25666
  b = Bg(g, c, b, e);
25724
25667
  b.elementType = a;
@@ -26212,7 +26155,7 @@ function checkDCE() {
26212
26155
  });
26213
26156
  }, r.t = function (e, t) {
26214
26157
  if (1 & t && (e = r(e)), 8 & t) return e;
26215
- if (4 & t && "object" == _typeof(e) && e && e.__esModule) return e;
26158
+ if (4 & t && "object" == _typeof$1(e) && e && e.__esModule) return e;
26216
26159
  var n = Object.create(null);
26217
26160
  if (r.r(n), Object.defineProperty(n, "default", {
26218
26161
  enumerable: !0,
@@ -26434,7 +26377,7 @@ function checkDCE() {
26434
26377
  }, t.parseHotkey = c, t.compareHotkey = l, t.toKeyCode = d, t.toKeyName = f;
26435
26378
  }, function (e, t) {
26436
26379
  e.exports = function (e) {
26437
- var t = _typeof(e);
26380
+ var t = _typeof$1(e);
26438
26381
  return null != e && ("object" == t || "function" == t);
26439
26382
  };
26440
26383
  }, function (e, t, r) {
@@ -26462,7 +26405,7 @@ function checkDCE() {
26462
26405
  };
26463
26406
  }, function (e, t, r) {
26464
26407
  var n = r(11),
26465
- u = "object" == (typeof self === "undefined" ? "undefined" : _typeof(self)) && self && self.Object === Object && self,
26408
+ u = "object" == (typeof self === "undefined" ? "undefined" : _typeof$1(self)) && self && self.Object === Object && self,
26466
26409
  o = n || u || Function("return this")();
26467
26410
  e.exports = o;
26468
26411
  }, function (e, t, r) {
@@ -26477,7 +26420,7 @@ function checkDCE() {
26477
26420
  };
26478
26421
  }, function (e, t, r) {
26479
26422
  (function (t) {
26480
- var r = "object" == _typeof(t) && t && t.Object === Object && t;
26423
+ var r = "object" == _typeof$1(t) && t && t.Object === Object && t;
26481
26424
  e.exports = r;
26482
26425
  }).call(this, r(12));
26483
26426
  }, function (e, t) {
@@ -26488,7 +26431,7 @@ function checkDCE() {
26488
26431
  try {
26489
26432
  r = r || new Function("return this")();
26490
26433
  } catch (e) {
26491
- "object" == (typeof window === "undefined" ? "undefined" : _typeof(window)) && (r = window);
26434
+ "object" == (typeof window === "undefined" ? "undefined" : _typeof$1(window)) && (r = window);
26492
26435
  }
26493
26436
  e.exports = r;
26494
26437
  }, function (e, t, r) {
@@ -26515,7 +26458,7 @@ function checkDCE() {
26515
26458
  var n = r(15),
26516
26459
  u = r(18);
26517
26460
  e.exports = function (e) {
26518
- return "symbol" == _typeof(e) || u(e) && "[object Symbol]" == n(e);
26461
+ return "symbol" == _typeof$1(e) || u(e) && "[object Symbol]" == n(e);
26519
26462
  };
26520
26463
  }, function (e, t, r) {
26521
26464
  var n = r(8),
@@ -26548,7 +26491,7 @@ function checkDCE() {
26548
26491
  };
26549
26492
  }, function (e, t) {
26550
26493
  e.exports = function (e) {
26551
- return null != e && "object" == _typeof(e);
26494
+ return null != e && "object" == _typeof$1(e);
26552
26495
  };
26553
26496
  }, function (e, t, r) {
26554
26497
 
@@ -26629,7 +26572,7 @@ function checkDCE() {
26629
26572
  }
26630
26573
  function c(e) {
26631
26574
  return !!e && (function (e) {
26632
- if (!e || "object" != _typeof(e)) return !1;
26575
+ if (!e || "object" != _typeof$1(e)) return !1;
26633
26576
  var t = Object.getPrototypeOf(e);
26634
26577
  if (null === t) return !0;
26635
26578
  var r = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
@@ -26638,7 +26581,7 @@ function checkDCE() {
26638
26581
  }
26639
26582
  function l(e, t, r) {
26640
26583
  void 0 === r && (r = !1), 0 === d(e) ? (r ? Object.keys : Z)(e).forEach(function (n) {
26641
- r && "symbol" == _typeof(n) || t(n, e[n], e);
26584
+ r && "symbol" == _typeof$1(n) || t(n, e[n], e);
26642
26585
  }) : e.forEach(function (r, n) {
26643
26586
  return t(n, r, e);
26644
26587
  });
@@ -26694,7 +26637,7 @@ function checkDCE() {
26694
26637
  i(2);
26695
26638
  }
26696
26639
  function b(e) {
26697
- return null == e || "object" != _typeof(e) || Object.isFrozen(e);
26640
+ return null == e || "object" != _typeof$1(e) || Object.isFrozen(e);
26698
26641
  }
26699
26642
  function y(e) {
26700
26643
  var t = Q[e];
@@ -26831,7 +26774,7 @@ function checkDCE() {
26831
26774
  }
26832
26775
  var W,
26833
26776
  V,
26834
- q = "undefined" != typeof Symbol && "symbol" == _typeof(Symbol("x")),
26777
+ q = "undefined" != typeof Symbol && "symbol" == _typeof$1(Symbol("x")),
26835
26778
  H = "undefined" != typeof Map,
26836
26779
  U = "undefined" != typeof Set,
26837
26780
  K = "undefined" != typeof Proxy && void 0 !== Proxy.revocable && "undefined" != typeof Reflect,
@@ -26946,7 +26889,7 @@ function checkDCE() {
26946
26889
  throw w(s), e;
26947
26890
  }) : (F(s, n), k(a, s));
26948
26891
  }
26949
- if (!e || "object" != _typeof(e)) {
26892
+ if (!e || "object" != _typeof$1(e)) {
26950
26893
  if ((a = r(e)) === $) return;
26951
26894
  return void 0 === a && (a = e), t.F && m(a, !0), a;
26952
26895
  }
@@ -31181,7 +31124,7 @@ function checkDCE() {
31181
31124
  Ut = r(6),
31182
31125
  Kt = r.n(Ut);
31183
31126
  function $t(e) {
31184
- return null != e && "object" == _typeof(e) && 1 === e.nodeType;
31127
+ return null != e && "object" == _typeof$1(e) && 1 === e.nodeType;
31185
31128
  }
31186
31129
  function Jt(e, t) {
31187
31130
  return (!t || "hidden" !== e) && "visible" !== e && "clip" !== e;