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