@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/lib/index.js
CHANGED
|
@@ -391,14 +391,14 @@ function _regeneratorRuntime() {
|
|
|
391
391
|
}
|
|
392
392
|
}, e;
|
|
393
393
|
}
|
|
394
|
-
function _typeof
|
|
394
|
+
function _typeof(o) {
|
|
395
395
|
"@babel/helpers - typeof";
|
|
396
396
|
|
|
397
|
-
return _typeof
|
|
397
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
398
398
|
return typeof o;
|
|
399
399
|
} : function (o) {
|
|
400
400
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
401
|
-
}, _typeof
|
|
401
|
+
}, _typeof(o);
|
|
402
402
|
}
|
|
403
403
|
function _classCallCheck(instance, Constructor) {
|
|
404
404
|
if (!(instance instanceof Constructor)) {
|
|
@@ -2090,7 +2090,9 @@ var eBensBrandSystemPallete = {
|
|
|
2090
2090
|
};
|
|
2091
2091
|
var eBensSystemPalette = _objectSpread2(_objectSpread2({}, swagSystemPalette$1), eBensBrandSystemPallete);
|
|
2092
2092
|
|
|
2093
|
-
var
|
|
2093
|
+
var ehWorkDarkSystemPalette = {
|
|
2094
|
+
black: '#000000',
|
|
2095
|
+
white: '#ffffff',
|
|
2094
2096
|
// Surface
|
|
2095
2097
|
defaultGlobalSurface: '#27272A',
|
|
2096
2098
|
neutralGlobalSurface: '#121214',
|
|
@@ -2101,7 +2103,7 @@ var ehWorkDarkPalette = _objectSpread2(_objectSpread2({}, swagLightGlobalPalette
|
|
|
2101
2103
|
mutedOnDefaultGlobalSurface: '#a9a9b2',
|
|
2102
2104
|
inactiveOnDefaultGlobalSurface: '#71717a',
|
|
2103
2105
|
disabledOnDefaultGlobalSurface: '#52525b',
|
|
2104
|
-
|
|
2106
|
+
onDarkGlobalSurface: '#121214',
|
|
2105
2107
|
// Outline:
|
|
2106
2108
|
primaryOutline: '#a9a9b2',
|
|
2107
2109
|
secondaryOutline: '#3f3f46',
|
|
@@ -2117,7 +2119,7 @@ var ehWorkDarkPalette = _objectSpread2(_objectSpread2({}, swagLightGlobalPalette
|
|
|
2117
2119
|
mutedError: '#9b2508',
|
|
2118
2120
|
error: '#bd2d09',
|
|
2119
2121
|
onErrorSurface: '#fecfca',
|
|
2120
|
-
//
|
|
2122
|
+
// Warning:
|
|
2121
2123
|
warningSurface: '#963e03',
|
|
2122
2124
|
mutedWarning: '#c35004',
|
|
2123
2125
|
warning: '#dc6204',
|
|
@@ -2138,13 +2140,13 @@ var ehWorkDarkPalette = _objectSpread2(_objectSpread2({}, swagLightGlobalPalette
|
|
|
2138
2140
|
secondary: '#7622d7',
|
|
2139
2141
|
onSecondary: '#ffffff',
|
|
2140
2142
|
defaultSurface: '#fdfbff',
|
|
2141
|
-
highlightedSurface: '#
|
|
2143
|
+
highlightedSurface: '#460078',
|
|
2142
2144
|
pressedSurface: '#9a58fc',
|
|
2143
2145
|
decorativePrimary: '#fdfbff',
|
|
2144
2146
|
decorativePrimarySurface: '#74409a',
|
|
2145
2147
|
decorativeSecondary: '#fdfbff',
|
|
2146
2148
|
decorativeSecondarySurface: '#f0e6ff'
|
|
2147
|
-
}
|
|
2149
|
+
};
|
|
2148
2150
|
|
|
2149
2151
|
var BASE_WIDTH = 390; // Based on iPhone 13's viewport size
|
|
2150
2152
|
var horizontalScale = function horizontalScale(size) {
|
|
@@ -2712,9 +2714,13 @@ var getCalendarTheme = function getCalendarTheme(theme) {
|
|
|
2712
2714
|
background: theme.colors.defaultGlobalSurface,
|
|
2713
2715
|
border: theme.colors.primaryOutline,
|
|
2714
2716
|
primary: theme.colors.primary,
|
|
2715
|
-
inverted: theme.colors.onDarkGlobalSurface
|
|
2717
|
+
inverted: theme.colors.onDarkGlobalSurface,
|
|
2718
|
+
rowItem: {
|
|
2719
|
+
selected: theme.colors.primary,
|
|
2720
|
+
highlighted: theme.colors.highlightedSurface
|
|
2721
|
+
}
|
|
2716
2722
|
};
|
|
2717
|
-
var cellSize = theme.sizes.
|
|
2723
|
+
var cellSize = theme.sizes.xxxxlarge;
|
|
2718
2724
|
var markSize = theme.sizes.xsmall;
|
|
2719
2725
|
var sizes = {
|
|
2720
2726
|
cellWidth: cellSize,
|
|
@@ -2729,7 +2735,8 @@ var getCalendarTheme = function getCalendarTheme(theme) {
|
|
|
2729
2735
|
headerVerticalPadding: theme.space.medium,
|
|
2730
2736
|
headerHorizontalPadding: theme.space.smallMedium,
|
|
2731
2737
|
headerMarginRight: theme.space.small,
|
|
2732
|
-
iosPickerMarginVertical: theme.space['5xlarge']
|
|
2738
|
+
iosPickerMarginVertical: theme.space['5xlarge'],
|
|
2739
|
+
cellPadding: theme.space.xlarge
|
|
2733
2740
|
};
|
|
2734
2741
|
var radii = {
|
|
2735
2742
|
"default": theme.radii.rounded
|
|
@@ -5507,6 +5514,8 @@ var ThemeSwitcher = function ThemeSwitcher(_ref) {
|
|
|
5507
5514
|
return getTheme$1(scale$1, swagDarkSystemPalette);
|
|
5508
5515
|
case 'swagLight':
|
|
5509
5516
|
return getTheme$1(scale$1, swagSystemPalette);
|
|
5517
|
+
case 'ehWorkDark':
|
|
5518
|
+
return getTheme$1(scale$1, ehWorkDarkSystemPalette);
|
|
5510
5519
|
}
|
|
5511
5520
|
}, [name]);
|
|
5512
5521
|
return /*#__PURE__*/React__namespace.default.createElement(ThemeProvider, {
|
|
@@ -5979,7 +5988,7 @@ function requireCamelize() {
|
|
|
5979
5988
|
return walk(obj);
|
|
5980
5989
|
};
|
|
5981
5990
|
function walk(obj) {
|
|
5982
|
-
if (!obj || _typeof
|
|
5991
|
+
if (!obj || _typeof(obj) !== 'object') return obj;
|
|
5983
5992
|
if (isDate(obj) || isRegex(obj)) return obj;
|
|
5984
5993
|
if (isArray(obj)) return map(obj, walk);
|
|
5985
5994
|
return reduce(objectKeys(obj), function (acc, key) {
|
|
@@ -6342,7 +6351,7 @@ function requireCssToReactNative() {
|
|
|
6342
6351
|
value: true
|
|
6343
6352
|
});
|
|
6344
6353
|
function _interopDefault(ex) {
|
|
6345
|
-
return ex && _typeof
|
|
6354
|
+
return ex && _typeof(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
|
|
6346
6355
|
}
|
|
6347
6356
|
var parse = requireLib$1();
|
|
6348
6357
|
var parse__default = _interopDefault(parse);
|
|
@@ -7066,7 +7075,7 @@ var generated = {};
|
|
|
7066
7075
|
var buffer = '';
|
|
7067
7076
|
var lastType;
|
|
7068
7077
|
function handleInterpolation(interpolation, i, arr) {
|
|
7069
|
-
var type = _typeof
|
|
7078
|
+
var type = _typeof(interpolation);
|
|
7070
7079
|
if (type === 'string') {
|
|
7071
7080
|
// strip comments
|
|
7072
7081
|
interpolation = interpolation.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '');
|
|
@@ -10601,59 +10610,12 @@ var BottomSheet$1 = Object.assign(BottomSheet, {
|
|
|
10601
10610
|
ScrollView: BottomSheetScrollView
|
|
10602
10611
|
});
|
|
10603
10612
|
|
|
10604
|
-
function _typeof(o) {
|
|
10605
|
-
"@babel/helpers - typeof";
|
|
10606
|
-
|
|
10607
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
10608
|
-
return typeof o;
|
|
10609
|
-
} : function (o) {
|
|
10610
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
10611
|
-
}, _typeof(o);
|
|
10612
|
-
}
|
|
10613
|
-
|
|
10614
10613
|
function requiredArgs(required, args) {
|
|
10615
10614
|
if (args.length < required) {
|
|
10616
10615
|
throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
|
|
10617
10616
|
}
|
|
10618
10617
|
}
|
|
10619
10618
|
|
|
10620
|
-
/**
|
|
10621
|
-
* @name isDate
|
|
10622
|
-
* @category Common Helpers
|
|
10623
|
-
* @summary Is the given value a date?
|
|
10624
|
-
*
|
|
10625
|
-
* @description
|
|
10626
|
-
* Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
|
|
10627
|
-
*
|
|
10628
|
-
* @param {*} value - the value to check
|
|
10629
|
-
* @returns {boolean} true if the given value is a date
|
|
10630
|
-
* @throws {TypeError} 1 arguments required
|
|
10631
|
-
*
|
|
10632
|
-
* @example
|
|
10633
|
-
* // For a valid date:
|
|
10634
|
-
* const result = isDate(new Date())
|
|
10635
|
-
* //=> true
|
|
10636
|
-
*
|
|
10637
|
-
* @example
|
|
10638
|
-
* // For an invalid date:
|
|
10639
|
-
* const result = isDate(new Date(NaN))
|
|
10640
|
-
* //=> true
|
|
10641
|
-
*
|
|
10642
|
-
* @example
|
|
10643
|
-
* // For some value:
|
|
10644
|
-
* const result = isDate('2014-02-31')
|
|
10645
|
-
* //=> false
|
|
10646
|
-
*
|
|
10647
|
-
* @example
|
|
10648
|
-
* // For an object:
|
|
10649
|
-
* const result = isDate({})
|
|
10650
|
-
* //=> false
|
|
10651
|
-
*/
|
|
10652
|
-
function isDate(value) {
|
|
10653
|
-
requiredArgs(1, arguments);
|
|
10654
|
-
return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
|
|
10655
|
-
}
|
|
10656
|
-
|
|
10657
10619
|
/**
|
|
10658
10620
|
* @name toDate
|
|
10659
10621
|
* @category Common Helpers
|
|
@@ -10684,11 +10646,11 @@ function isDate(value) {
|
|
|
10684
10646
|
* const result = toDate(1392098430000)
|
|
10685
10647
|
* //=> Tue Feb 11 2014 11:30:30
|
|
10686
10648
|
*/
|
|
10649
|
+
|
|
10687
10650
|
function toDate(argument) {
|
|
10688
10651
|
requiredArgs(1, arguments);
|
|
10689
|
-
var argStr = Object.prototype.toString.call(argument);
|
|
10652
|
+
var argStr = Object.prototype.toString.call(argument); // Clone the date
|
|
10690
10653
|
|
|
10691
|
-
// Clone the date
|
|
10692
10654
|
if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
|
|
10693
10655
|
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
|
|
10694
10656
|
return new Date(argument.getTime());
|
|
@@ -10697,8 +10659,8 @@ function toDate(argument) {
|
|
|
10697
10659
|
} else {
|
|
10698
10660
|
if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
|
|
10699
10661
|
// eslint-disable-next-line no-console
|
|
10700
|
-
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://
|
|
10701
|
-
|
|
10662
|
+
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
|
|
10663
|
+
|
|
10702
10664
|
console.warn(new Error().stack);
|
|
10703
10665
|
}
|
|
10704
10666
|
return new Date(NaN);
|
|
@@ -10717,34 +10679,544 @@ function toDate(argument) {
|
|
|
10717
10679
|
*
|
|
10718
10680
|
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
|
10719
10681
|
*
|
|
10682
|
+
* ### v2.0.0 breaking changes:
|
|
10683
|
+
*
|
|
10684
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
10685
|
+
*
|
|
10686
|
+
* - Now `isValid` doesn't throw an exception
|
|
10687
|
+
* if the first argument is not an instance of Date.
|
|
10688
|
+
* Instead, argument is converted beforehand using `toDate`.
|
|
10689
|
+
*
|
|
10690
|
+
* Examples:
|
|
10691
|
+
*
|
|
10692
|
+
* | `isValid` argument | Before v2.0.0 | v2.0.0 onward |
|
|
10693
|
+
* |---------------------------|---------------|---------------|
|
|
10694
|
+
* | `new Date()` | `true` | `true` |
|
|
10695
|
+
* | `new Date('2016-01-01')` | `true` | `true` |
|
|
10696
|
+
* | `new Date('')` | `false` | `false` |
|
|
10697
|
+
* | `new Date(1488370835081)` | `true` | `true` |
|
|
10698
|
+
* | `new Date(NaN)` | `false` | `false` |
|
|
10699
|
+
* | `'2016-01-01'` | `TypeError` | `false` |
|
|
10700
|
+
* | `''` | `TypeError` | `false` |
|
|
10701
|
+
* | `1488370835081` | `TypeError` | `true` |
|
|
10702
|
+
* | `NaN` | `TypeError` | `false` |
|
|
10703
|
+
*
|
|
10704
|
+
* We introduce this change to make *date-fns* consistent with ECMAScript behavior
|
|
10705
|
+
* that try to coerce arguments to the expected type
|
|
10706
|
+
* (which is also the case with other *date-fns* functions).
|
|
10707
|
+
*
|
|
10720
10708
|
* @param {*} date - the date to check
|
|
10721
10709
|
* @returns {Boolean} the date is valid
|
|
10722
10710
|
* @throws {TypeError} 1 argument required
|
|
10723
10711
|
*
|
|
10724
10712
|
* @example
|
|
10725
10713
|
* // For the valid date:
|
|
10726
|
-
*
|
|
10714
|
+
* var result = isValid(new Date(2014, 1, 31))
|
|
10727
10715
|
* //=> true
|
|
10728
10716
|
*
|
|
10729
10717
|
* @example
|
|
10730
10718
|
* // For the value, convertable into a date:
|
|
10731
|
-
*
|
|
10719
|
+
* var result = isValid(1393804800000)
|
|
10732
10720
|
* //=> true
|
|
10733
10721
|
*
|
|
10734
10722
|
* @example
|
|
10735
10723
|
* // For the invalid date:
|
|
10736
|
-
*
|
|
10724
|
+
* var result = isValid(new Date(''))
|
|
10737
10725
|
* //=> false
|
|
10738
10726
|
*/
|
|
10727
|
+
|
|
10739
10728
|
function isValid(dirtyDate) {
|
|
10740
10729
|
requiredArgs(1, arguments);
|
|
10741
|
-
if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
|
|
10742
|
-
return false;
|
|
10743
|
-
}
|
|
10744
10730
|
var date = toDate(dirtyDate);
|
|
10745
|
-
return !isNaN(
|
|
10731
|
+
return !isNaN(date);
|
|
10732
|
+
}
|
|
10733
|
+
|
|
10734
|
+
var formatDistanceLocale = {
|
|
10735
|
+
lessThanXSeconds: {
|
|
10736
|
+
one: 'less than a second',
|
|
10737
|
+
other: 'less than {{count}} seconds'
|
|
10738
|
+
},
|
|
10739
|
+
xSeconds: {
|
|
10740
|
+
one: '1 second',
|
|
10741
|
+
other: '{{count}} seconds'
|
|
10742
|
+
},
|
|
10743
|
+
halfAMinute: 'half a minute',
|
|
10744
|
+
lessThanXMinutes: {
|
|
10745
|
+
one: 'less than a minute',
|
|
10746
|
+
other: 'less than {{count}} minutes'
|
|
10747
|
+
},
|
|
10748
|
+
xMinutes: {
|
|
10749
|
+
one: '1 minute',
|
|
10750
|
+
other: '{{count}} minutes'
|
|
10751
|
+
},
|
|
10752
|
+
aboutXHours: {
|
|
10753
|
+
one: 'about 1 hour',
|
|
10754
|
+
other: 'about {{count}} hours'
|
|
10755
|
+
},
|
|
10756
|
+
xHours: {
|
|
10757
|
+
one: '1 hour',
|
|
10758
|
+
other: '{{count}} hours'
|
|
10759
|
+
},
|
|
10760
|
+
xDays: {
|
|
10761
|
+
one: '1 day',
|
|
10762
|
+
other: '{{count}} days'
|
|
10763
|
+
},
|
|
10764
|
+
aboutXWeeks: {
|
|
10765
|
+
one: 'about 1 week',
|
|
10766
|
+
other: 'about {{count}} weeks'
|
|
10767
|
+
},
|
|
10768
|
+
xWeeks: {
|
|
10769
|
+
one: '1 week',
|
|
10770
|
+
other: '{{count}} weeks'
|
|
10771
|
+
},
|
|
10772
|
+
aboutXMonths: {
|
|
10773
|
+
one: 'about 1 month',
|
|
10774
|
+
other: 'about {{count}} months'
|
|
10775
|
+
},
|
|
10776
|
+
xMonths: {
|
|
10777
|
+
one: '1 month',
|
|
10778
|
+
other: '{{count}} months'
|
|
10779
|
+
},
|
|
10780
|
+
aboutXYears: {
|
|
10781
|
+
one: 'about 1 year',
|
|
10782
|
+
other: 'about {{count}} years'
|
|
10783
|
+
},
|
|
10784
|
+
xYears: {
|
|
10785
|
+
one: '1 year',
|
|
10786
|
+
other: '{{count}} years'
|
|
10787
|
+
},
|
|
10788
|
+
overXYears: {
|
|
10789
|
+
one: 'over 1 year',
|
|
10790
|
+
other: 'over {{count}} years'
|
|
10791
|
+
},
|
|
10792
|
+
almostXYears: {
|
|
10793
|
+
one: 'almost 1 year',
|
|
10794
|
+
other: 'almost {{count}} years'
|
|
10795
|
+
}
|
|
10796
|
+
};
|
|
10797
|
+
function formatDistance(token, count, options) {
|
|
10798
|
+
options = options || {};
|
|
10799
|
+
var result;
|
|
10800
|
+
if (typeof formatDistanceLocale[token] === 'string') {
|
|
10801
|
+
result = formatDistanceLocale[token];
|
|
10802
|
+
} else if (count === 1) {
|
|
10803
|
+
result = formatDistanceLocale[token].one;
|
|
10804
|
+
} else {
|
|
10805
|
+
result = formatDistanceLocale[token].other.replace('{{count}}', count);
|
|
10806
|
+
}
|
|
10807
|
+
if (options.addSuffix) {
|
|
10808
|
+
if (options.comparison > 0) {
|
|
10809
|
+
return 'in ' + result;
|
|
10810
|
+
} else {
|
|
10811
|
+
return result + ' ago';
|
|
10812
|
+
}
|
|
10813
|
+
}
|
|
10814
|
+
return result;
|
|
10815
|
+
}
|
|
10816
|
+
|
|
10817
|
+
function buildFormatLongFn(args) {
|
|
10818
|
+
return function (dirtyOptions) {
|
|
10819
|
+
var options = dirtyOptions || {};
|
|
10820
|
+
var width = options.width ? String(options.width) : args.defaultWidth;
|
|
10821
|
+
var format = args.formats[width] || args.formats[args.defaultWidth];
|
|
10822
|
+
return format;
|
|
10823
|
+
};
|
|
10824
|
+
}
|
|
10825
|
+
|
|
10826
|
+
var dateFormats = {
|
|
10827
|
+
full: 'EEEE, MMMM do, y',
|
|
10828
|
+
"long": 'MMMM do, y',
|
|
10829
|
+
medium: 'MMM d, y',
|
|
10830
|
+
"short": 'MM/dd/yyyy'
|
|
10831
|
+
};
|
|
10832
|
+
var timeFormats = {
|
|
10833
|
+
full: 'h:mm:ss a zzzz',
|
|
10834
|
+
"long": 'h:mm:ss a z',
|
|
10835
|
+
medium: 'h:mm:ss a',
|
|
10836
|
+
"short": 'h:mm a'
|
|
10837
|
+
};
|
|
10838
|
+
var dateTimeFormats = {
|
|
10839
|
+
full: "{{date}} 'at' {{time}}",
|
|
10840
|
+
"long": "{{date}} 'at' {{time}}",
|
|
10841
|
+
medium: '{{date}}, {{time}}',
|
|
10842
|
+
"short": '{{date}}, {{time}}'
|
|
10843
|
+
};
|
|
10844
|
+
var formatLong = {
|
|
10845
|
+
date: buildFormatLongFn({
|
|
10846
|
+
formats: dateFormats,
|
|
10847
|
+
defaultWidth: 'full'
|
|
10848
|
+
}),
|
|
10849
|
+
time: buildFormatLongFn({
|
|
10850
|
+
formats: timeFormats,
|
|
10851
|
+
defaultWidth: 'full'
|
|
10852
|
+
}),
|
|
10853
|
+
dateTime: buildFormatLongFn({
|
|
10854
|
+
formats: dateTimeFormats,
|
|
10855
|
+
defaultWidth: 'full'
|
|
10856
|
+
})
|
|
10857
|
+
};
|
|
10858
|
+
|
|
10859
|
+
var formatRelativeLocale = {
|
|
10860
|
+
lastWeek: "'last' eeee 'at' p",
|
|
10861
|
+
yesterday: "'yesterday at' p",
|
|
10862
|
+
today: "'today at' p",
|
|
10863
|
+
tomorrow: "'tomorrow at' p",
|
|
10864
|
+
nextWeek: "eeee 'at' p",
|
|
10865
|
+
other: 'P'
|
|
10866
|
+
};
|
|
10867
|
+
function formatRelative(token, _date, _baseDate, _options) {
|
|
10868
|
+
return formatRelativeLocale[token];
|
|
10869
|
+
}
|
|
10870
|
+
|
|
10871
|
+
function buildLocalizeFn(args) {
|
|
10872
|
+
return function (dirtyIndex, dirtyOptions) {
|
|
10873
|
+
var options = dirtyOptions || {};
|
|
10874
|
+
var context = options.context ? String(options.context) : 'standalone';
|
|
10875
|
+
var valuesArray;
|
|
10876
|
+
if (context === 'formatting' && args.formattingValues) {
|
|
10877
|
+
var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
|
10878
|
+
var width = options.width ? String(options.width) : defaultWidth;
|
|
10879
|
+
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
|
10880
|
+
} else {
|
|
10881
|
+
var _defaultWidth = args.defaultWidth;
|
|
10882
|
+
var _width = options.width ? String(options.width) : args.defaultWidth;
|
|
10883
|
+
valuesArray = args.values[_width] || args.values[_defaultWidth];
|
|
10884
|
+
}
|
|
10885
|
+
var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
|
|
10886
|
+
return valuesArray[index];
|
|
10887
|
+
};
|
|
10888
|
+
}
|
|
10889
|
+
|
|
10890
|
+
var eraValues = {
|
|
10891
|
+
narrow: ['B', 'A'],
|
|
10892
|
+
abbreviated: ['BC', 'AD'],
|
|
10893
|
+
wide: ['Before Christ', 'Anno Domini']
|
|
10894
|
+
};
|
|
10895
|
+
var quarterValues = {
|
|
10896
|
+
narrow: ['1', '2', '3', '4'],
|
|
10897
|
+
abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
|
|
10898
|
+
wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter'] // Note: in English, the names of days of the week and months are capitalized.
|
|
10899
|
+
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
|
|
10900
|
+
// Generally, formatted dates should look like they are in the middle of a sentence,
|
|
10901
|
+
// e.g. in Spanish language the weekdays and months should be in the lowercase.
|
|
10902
|
+
};
|
|
10903
|
+
|
|
10904
|
+
var monthValues = {
|
|
10905
|
+
narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
|
|
10906
|
+
abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
10907
|
+
wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
|
|
10908
|
+
};
|
|
10909
|
+
var dayValues = {
|
|
10910
|
+
narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
|
|
10911
|
+
"short": ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
10912
|
+
abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
10913
|
+
wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
|
|
10914
|
+
};
|
|
10915
|
+
var dayPeriodValues = {
|
|
10916
|
+
narrow: {
|
|
10917
|
+
am: 'a',
|
|
10918
|
+
pm: 'p',
|
|
10919
|
+
midnight: 'mi',
|
|
10920
|
+
noon: 'n',
|
|
10921
|
+
morning: 'morning',
|
|
10922
|
+
afternoon: 'afternoon',
|
|
10923
|
+
evening: 'evening',
|
|
10924
|
+
night: 'night'
|
|
10925
|
+
},
|
|
10926
|
+
abbreviated: {
|
|
10927
|
+
am: 'AM',
|
|
10928
|
+
pm: 'PM',
|
|
10929
|
+
midnight: 'midnight',
|
|
10930
|
+
noon: 'noon',
|
|
10931
|
+
morning: 'morning',
|
|
10932
|
+
afternoon: 'afternoon',
|
|
10933
|
+
evening: 'evening',
|
|
10934
|
+
night: 'night'
|
|
10935
|
+
},
|
|
10936
|
+
wide: {
|
|
10937
|
+
am: 'a.m.',
|
|
10938
|
+
pm: 'p.m.',
|
|
10939
|
+
midnight: 'midnight',
|
|
10940
|
+
noon: 'noon',
|
|
10941
|
+
morning: 'morning',
|
|
10942
|
+
afternoon: 'afternoon',
|
|
10943
|
+
evening: 'evening',
|
|
10944
|
+
night: 'night'
|
|
10945
|
+
}
|
|
10946
|
+
};
|
|
10947
|
+
var formattingDayPeriodValues = {
|
|
10948
|
+
narrow: {
|
|
10949
|
+
am: 'a',
|
|
10950
|
+
pm: 'p',
|
|
10951
|
+
midnight: 'mi',
|
|
10952
|
+
noon: 'n',
|
|
10953
|
+
morning: 'in the morning',
|
|
10954
|
+
afternoon: 'in the afternoon',
|
|
10955
|
+
evening: 'in the evening',
|
|
10956
|
+
night: 'at night'
|
|
10957
|
+
},
|
|
10958
|
+
abbreviated: {
|
|
10959
|
+
am: 'AM',
|
|
10960
|
+
pm: 'PM',
|
|
10961
|
+
midnight: 'midnight',
|
|
10962
|
+
noon: 'noon',
|
|
10963
|
+
morning: 'in the morning',
|
|
10964
|
+
afternoon: 'in the afternoon',
|
|
10965
|
+
evening: 'in the evening',
|
|
10966
|
+
night: 'at night'
|
|
10967
|
+
},
|
|
10968
|
+
wide: {
|
|
10969
|
+
am: 'a.m.',
|
|
10970
|
+
pm: 'p.m.',
|
|
10971
|
+
midnight: 'midnight',
|
|
10972
|
+
noon: 'noon',
|
|
10973
|
+
morning: 'in the morning',
|
|
10974
|
+
afternoon: 'in the afternoon',
|
|
10975
|
+
evening: 'in the evening',
|
|
10976
|
+
night: 'at night'
|
|
10977
|
+
}
|
|
10978
|
+
};
|
|
10979
|
+
function ordinalNumber(dirtyNumber, _dirtyOptions) {
|
|
10980
|
+
var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
|
|
10981
|
+
// if they are different for different grammatical genders,
|
|
10982
|
+
// use `options.unit`:
|
|
10983
|
+
//
|
|
10984
|
+
// var options = dirtyOptions || {}
|
|
10985
|
+
// var unit = String(options.unit)
|
|
10986
|
+
//
|
|
10987
|
+
// where `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
|
|
10988
|
+
// 'day', 'hour', 'minute', 'second'
|
|
10989
|
+
|
|
10990
|
+
var rem100 = number % 100;
|
|
10991
|
+
if (rem100 > 20 || rem100 < 10) {
|
|
10992
|
+
switch (rem100 % 10) {
|
|
10993
|
+
case 1:
|
|
10994
|
+
return number + 'st';
|
|
10995
|
+
case 2:
|
|
10996
|
+
return number + 'nd';
|
|
10997
|
+
case 3:
|
|
10998
|
+
return number + 'rd';
|
|
10999
|
+
}
|
|
11000
|
+
}
|
|
11001
|
+
return number + 'th';
|
|
11002
|
+
}
|
|
11003
|
+
var localize = {
|
|
11004
|
+
ordinalNumber: ordinalNumber,
|
|
11005
|
+
era: buildLocalizeFn({
|
|
11006
|
+
values: eraValues,
|
|
11007
|
+
defaultWidth: 'wide'
|
|
11008
|
+
}),
|
|
11009
|
+
quarter: buildLocalizeFn({
|
|
11010
|
+
values: quarterValues,
|
|
11011
|
+
defaultWidth: 'wide',
|
|
11012
|
+
argumentCallback: function argumentCallback(quarter) {
|
|
11013
|
+
return Number(quarter) - 1;
|
|
11014
|
+
}
|
|
11015
|
+
}),
|
|
11016
|
+
month: buildLocalizeFn({
|
|
11017
|
+
values: monthValues,
|
|
11018
|
+
defaultWidth: 'wide'
|
|
11019
|
+
}),
|
|
11020
|
+
day: buildLocalizeFn({
|
|
11021
|
+
values: dayValues,
|
|
11022
|
+
defaultWidth: 'wide'
|
|
11023
|
+
}),
|
|
11024
|
+
dayPeriod: buildLocalizeFn({
|
|
11025
|
+
values: dayPeriodValues,
|
|
11026
|
+
defaultWidth: 'wide',
|
|
11027
|
+
formattingValues: formattingDayPeriodValues,
|
|
11028
|
+
defaultFormattingWidth: 'wide'
|
|
11029
|
+
})
|
|
11030
|
+
};
|
|
11031
|
+
|
|
11032
|
+
function buildMatchPatternFn(args) {
|
|
11033
|
+
return function (dirtyString, dirtyOptions) {
|
|
11034
|
+
var string = String(dirtyString);
|
|
11035
|
+
var options = dirtyOptions || {};
|
|
11036
|
+
var matchResult = string.match(args.matchPattern);
|
|
11037
|
+
if (!matchResult) {
|
|
11038
|
+
return null;
|
|
11039
|
+
}
|
|
11040
|
+
var matchedString = matchResult[0];
|
|
11041
|
+
var parseResult = string.match(args.parsePattern);
|
|
11042
|
+
if (!parseResult) {
|
|
11043
|
+
return null;
|
|
11044
|
+
}
|
|
11045
|
+
var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
|
11046
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
11047
|
+
return {
|
|
11048
|
+
value: value,
|
|
11049
|
+
rest: string.slice(matchedString.length)
|
|
11050
|
+
};
|
|
11051
|
+
};
|
|
11052
|
+
}
|
|
11053
|
+
|
|
11054
|
+
function buildMatchFn(args) {
|
|
11055
|
+
return function (dirtyString, dirtyOptions) {
|
|
11056
|
+
var string = String(dirtyString);
|
|
11057
|
+
var options = dirtyOptions || {};
|
|
11058
|
+
var width = options.width;
|
|
11059
|
+
var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
|
11060
|
+
var matchResult = string.match(matchPattern);
|
|
11061
|
+
if (!matchResult) {
|
|
11062
|
+
return null;
|
|
11063
|
+
}
|
|
11064
|
+
var matchedString = matchResult[0];
|
|
11065
|
+
var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
|
11066
|
+
var value;
|
|
11067
|
+
if (Object.prototype.toString.call(parsePatterns) === '[object Array]') {
|
|
11068
|
+
value = findIndex(parsePatterns, function (pattern) {
|
|
11069
|
+
return pattern.test(matchedString);
|
|
11070
|
+
});
|
|
11071
|
+
} else {
|
|
11072
|
+
value = findKey(parsePatterns, function (pattern) {
|
|
11073
|
+
return pattern.test(matchedString);
|
|
11074
|
+
});
|
|
11075
|
+
}
|
|
11076
|
+
value = args.valueCallback ? args.valueCallback(value) : value;
|
|
11077
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
11078
|
+
return {
|
|
11079
|
+
value: value,
|
|
11080
|
+
rest: string.slice(matchedString.length)
|
|
11081
|
+
};
|
|
11082
|
+
};
|
|
11083
|
+
}
|
|
11084
|
+
function findKey(object, predicate) {
|
|
11085
|
+
for (var key in object) {
|
|
11086
|
+
if (object.hasOwnProperty(key) && predicate(object[key])) {
|
|
11087
|
+
return key;
|
|
11088
|
+
}
|
|
11089
|
+
}
|
|
11090
|
+
}
|
|
11091
|
+
function findIndex(array, predicate) {
|
|
11092
|
+
for (var key = 0; key < array.length; key++) {
|
|
11093
|
+
if (predicate(array[key])) {
|
|
11094
|
+
return key;
|
|
11095
|
+
}
|
|
11096
|
+
}
|
|
10746
11097
|
}
|
|
10747
11098
|
|
|
11099
|
+
var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
|
11100
|
+
var parseOrdinalNumberPattern = /\d+/i;
|
|
11101
|
+
var matchEraPatterns = {
|
|
11102
|
+
narrow: /^(b|a)/i,
|
|
11103
|
+
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
11104
|
+
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
11105
|
+
};
|
|
11106
|
+
var parseEraPatterns = {
|
|
11107
|
+
any: [/^b/i, /^(a|c)/i]
|
|
11108
|
+
};
|
|
11109
|
+
var matchQuarterPatterns = {
|
|
11110
|
+
narrow: /^[1234]/i,
|
|
11111
|
+
abbreviated: /^q[1234]/i,
|
|
11112
|
+
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
11113
|
+
};
|
|
11114
|
+
var parseQuarterPatterns = {
|
|
11115
|
+
any: [/1/i, /2/i, /3/i, /4/i]
|
|
11116
|
+
};
|
|
11117
|
+
var matchMonthPatterns = {
|
|
11118
|
+
narrow: /^[jfmasond]/i,
|
|
11119
|
+
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
11120
|
+
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
11121
|
+
};
|
|
11122
|
+
var parseMonthPatterns = {
|
|
11123
|
+
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],
|
|
11124
|
+
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]
|
|
11125
|
+
};
|
|
11126
|
+
var matchDayPatterns = {
|
|
11127
|
+
narrow: /^[smtwf]/i,
|
|
11128
|
+
"short": /^(su|mo|tu|we|th|fr|sa)/i,
|
|
11129
|
+
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
11130
|
+
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
11131
|
+
};
|
|
11132
|
+
var parseDayPatterns = {
|
|
11133
|
+
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
11134
|
+
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
11135
|
+
};
|
|
11136
|
+
var matchDayPeriodPatterns = {
|
|
11137
|
+
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
11138
|
+
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
11139
|
+
};
|
|
11140
|
+
var parseDayPeriodPatterns = {
|
|
11141
|
+
any: {
|
|
11142
|
+
am: /^a/i,
|
|
11143
|
+
pm: /^p/i,
|
|
11144
|
+
midnight: /^mi/i,
|
|
11145
|
+
noon: /^no/i,
|
|
11146
|
+
morning: /morning/i,
|
|
11147
|
+
afternoon: /afternoon/i,
|
|
11148
|
+
evening: /evening/i,
|
|
11149
|
+
night: /night/i
|
|
11150
|
+
}
|
|
11151
|
+
};
|
|
11152
|
+
var match = {
|
|
11153
|
+
ordinalNumber: buildMatchPatternFn({
|
|
11154
|
+
matchPattern: matchOrdinalNumberPattern,
|
|
11155
|
+
parsePattern: parseOrdinalNumberPattern,
|
|
11156
|
+
valueCallback: function valueCallback(value) {
|
|
11157
|
+
return parseInt(value, 10);
|
|
11158
|
+
}
|
|
11159
|
+
}),
|
|
11160
|
+
era: buildMatchFn({
|
|
11161
|
+
matchPatterns: matchEraPatterns,
|
|
11162
|
+
defaultMatchWidth: 'wide',
|
|
11163
|
+
parsePatterns: parseEraPatterns,
|
|
11164
|
+
defaultParseWidth: 'any'
|
|
11165
|
+
}),
|
|
11166
|
+
quarter: buildMatchFn({
|
|
11167
|
+
matchPatterns: matchQuarterPatterns,
|
|
11168
|
+
defaultMatchWidth: 'wide',
|
|
11169
|
+
parsePatterns: parseQuarterPatterns,
|
|
11170
|
+
defaultParseWidth: 'any',
|
|
11171
|
+
valueCallback: function valueCallback(index) {
|
|
11172
|
+
return index + 1;
|
|
11173
|
+
}
|
|
11174
|
+
}),
|
|
11175
|
+
month: buildMatchFn({
|
|
11176
|
+
matchPatterns: matchMonthPatterns,
|
|
11177
|
+
defaultMatchWidth: 'wide',
|
|
11178
|
+
parsePatterns: parseMonthPatterns,
|
|
11179
|
+
defaultParseWidth: 'any'
|
|
11180
|
+
}),
|
|
11181
|
+
day: buildMatchFn({
|
|
11182
|
+
matchPatterns: matchDayPatterns,
|
|
11183
|
+
defaultMatchWidth: 'wide',
|
|
11184
|
+
parsePatterns: parseDayPatterns,
|
|
11185
|
+
defaultParseWidth: 'any'
|
|
11186
|
+
}),
|
|
11187
|
+
dayPeriod: buildMatchFn({
|
|
11188
|
+
matchPatterns: matchDayPeriodPatterns,
|
|
11189
|
+
defaultMatchWidth: 'any',
|
|
11190
|
+
parsePatterns: parseDayPeriodPatterns,
|
|
11191
|
+
defaultParseWidth: 'any'
|
|
11192
|
+
})
|
|
11193
|
+
};
|
|
11194
|
+
|
|
11195
|
+
/**
|
|
11196
|
+
* @type {Locale}
|
|
11197
|
+
* @category Locales
|
|
11198
|
+
* @summary English locale (United States).
|
|
11199
|
+
* @language English
|
|
11200
|
+
* @iso-639-2 eng
|
|
11201
|
+
* @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
|
|
11202
|
+
* @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
|
|
11203
|
+
*/
|
|
11204
|
+
|
|
11205
|
+
var locale = {
|
|
11206
|
+
code: 'en-US',
|
|
11207
|
+
formatDistance: formatDistance,
|
|
11208
|
+
formatLong: formatLong,
|
|
11209
|
+
formatRelative: formatRelative,
|
|
11210
|
+
localize: localize,
|
|
11211
|
+
match: match,
|
|
11212
|
+
options: {
|
|
11213
|
+
weekStartsOn: 0
|
|
11214
|
+
/* Sunday */,
|
|
11215
|
+
|
|
11216
|
+
firstWeekContainsDate: 1
|
|
11217
|
+
}
|
|
11218
|
+
};
|
|
11219
|
+
|
|
10748
11220
|
function toInteger(dirtyNumber) {
|
|
10749
11221
|
if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
|
|
10750
11222
|
return NaN;
|
|
@@ -10764,6 +11236,10 @@ function toInteger(dirtyNumber) {
|
|
|
10764
11236
|
* @description
|
|
10765
11237
|
* Add the specified number of milliseconds to the given date.
|
|
10766
11238
|
*
|
|
11239
|
+
* ### v2.0.0 breaking changes:
|
|
11240
|
+
*
|
|
11241
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
11242
|
+
*
|
|
10767
11243
|
* @param {Date|Number} date - the date to be changed
|
|
10768
11244
|
* @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`.
|
|
10769
11245
|
* @returns {Date} the new date with the milliseconds added
|
|
@@ -10771,9 +11247,10 @@ function toInteger(dirtyNumber) {
|
|
|
10771
11247
|
*
|
|
10772
11248
|
* @example
|
|
10773
11249
|
* // Add 750 milliseconds to 10 July 2014 12:45:30.000:
|
|
10774
|
-
*
|
|
11250
|
+
* var result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
|
|
10775
11251
|
* //=> Thu Jul 10 2014 12:45:30.750
|
|
10776
11252
|
*/
|
|
11253
|
+
|
|
10777
11254
|
function addMilliseconds(dirtyDate, dirtyAmount) {
|
|
10778
11255
|
requiredArgs(2, arguments);
|
|
10779
11256
|
var timestamp = toDate(dirtyDate).getTime();
|
|
@@ -10789,6 +11266,10 @@ function addMilliseconds(dirtyDate, dirtyAmount) {
|
|
|
10789
11266
|
* @description
|
|
10790
11267
|
* Subtract the specified number of milliseconds from the given date.
|
|
10791
11268
|
*
|
|
11269
|
+
* ### v2.0.0 breaking changes:
|
|
11270
|
+
*
|
|
11271
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
11272
|
+
*
|
|
10792
11273
|
* @param {Date|Number} date - the date to be changed
|
|
10793
11274
|
* @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`.
|
|
10794
11275
|
* @returns {Date} the new date with the milliseconds subtracted
|
|
@@ -10796,29 +11277,121 @@ function addMilliseconds(dirtyDate, dirtyAmount) {
|
|
|
10796
11277
|
*
|
|
10797
11278
|
* @example
|
|
10798
11279
|
* // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
|
|
10799
|
-
*
|
|
11280
|
+
* var result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
|
|
10800
11281
|
* //=> Thu Jul 10 2014 12:45:29.250
|
|
10801
11282
|
*/
|
|
11283
|
+
|
|
10802
11284
|
function subMilliseconds(dirtyDate, dirtyAmount) {
|
|
10803
11285
|
requiredArgs(2, arguments);
|
|
10804
11286
|
var amount = toInteger(dirtyAmount);
|
|
10805
11287
|
return addMilliseconds(dirtyDate, -amount);
|
|
10806
11288
|
}
|
|
10807
11289
|
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
|
|
10817
|
-
|
|
10818
|
-
|
|
10819
|
-
|
|
10820
|
-
|
|
10821
|
-
|
|
11290
|
+
function addLeadingZeros(number, targetLength) {
|
|
11291
|
+
var sign = number < 0 ? '-' : '';
|
|
11292
|
+
var output = Math.abs(number).toString();
|
|
11293
|
+
while (output.length < targetLength) {
|
|
11294
|
+
output = '0' + output;
|
|
11295
|
+
}
|
|
11296
|
+
return sign + output;
|
|
11297
|
+
}
|
|
11298
|
+
|
|
11299
|
+
/*
|
|
11300
|
+
* | | Unit | | Unit |
|
|
11301
|
+
* |-----|--------------------------------|-----|--------------------------------|
|
|
11302
|
+
* | a | AM, PM | A* | |
|
|
11303
|
+
* | d | Day of month | D | |
|
|
11304
|
+
* | h | Hour [1-12] | H | Hour [0-23] |
|
|
11305
|
+
* | m | Minute | M | Month |
|
|
11306
|
+
* | s | Second | S | Fraction of second |
|
|
11307
|
+
* | y | Year (abs) | Y | |
|
|
11308
|
+
*
|
|
11309
|
+
* Letters marked by * are not implemented but reserved by Unicode standard.
|
|
11310
|
+
*/
|
|
11311
|
+
|
|
11312
|
+
var formatters$1 = {
|
|
11313
|
+
// Year
|
|
11314
|
+
y: function y(date, token) {
|
|
11315
|
+
// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
|
|
11316
|
+
// | Year | y | yy | yyy | yyyy | yyyyy |
|
|
11317
|
+
// |----------|-------|----|-------|-------|-------|
|
|
11318
|
+
// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
|
|
11319
|
+
// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
|
|
11320
|
+
// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
|
|
11321
|
+
// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
|
|
11322
|
+
// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
|
|
11323
|
+
var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
11324
|
+
|
|
11325
|
+
var year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
11326
|
+
return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
|
|
11327
|
+
},
|
|
11328
|
+
// Month
|
|
11329
|
+
M: function M(date, token) {
|
|
11330
|
+
var month = date.getUTCMonth();
|
|
11331
|
+
return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
|
|
11332
|
+
},
|
|
11333
|
+
// Day of the month
|
|
11334
|
+
d: function d(date, token) {
|
|
11335
|
+
return addLeadingZeros(date.getUTCDate(), token.length);
|
|
11336
|
+
},
|
|
11337
|
+
// AM or PM
|
|
11338
|
+
a: function a(date, token) {
|
|
11339
|
+
var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
|
|
11340
|
+
switch (token) {
|
|
11341
|
+
case 'a':
|
|
11342
|
+
case 'aa':
|
|
11343
|
+
case 'aaa':
|
|
11344
|
+
return dayPeriodEnumValue.toUpperCase();
|
|
11345
|
+
case 'aaaaa':
|
|
11346
|
+
return dayPeriodEnumValue[0];
|
|
11347
|
+
case 'aaaa':
|
|
11348
|
+
default:
|
|
11349
|
+
return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
|
|
11350
|
+
}
|
|
11351
|
+
},
|
|
11352
|
+
// Hour [1-12]
|
|
11353
|
+
h: function h(date, token) {
|
|
11354
|
+
return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
|
|
11355
|
+
},
|
|
11356
|
+
// Hour [0-23]
|
|
11357
|
+
H: function H(date, token) {
|
|
11358
|
+
return addLeadingZeros(date.getUTCHours(), token.length);
|
|
11359
|
+
},
|
|
11360
|
+
// Minute
|
|
11361
|
+
m: function m(date, token) {
|
|
11362
|
+
return addLeadingZeros(date.getUTCMinutes(), token.length);
|
|
11363
|
+
},
|
|
11364
|
+
// Second
|
|
11365
|
+
s: function s(date, token) {
|
|
11366
|
+
return addLeadingZeros(date.getUTCSeconds(), token.length);
|
|
11367
|
+
},
|
|
11368
|
+
// Fraction of second
|
|
11369
|
+
S: function S(date, token) {
|
|
11370
|
+
var numberOfDigits = token.length;
|
|
11371
|
+
var milliseconds = date.getUTCMilliseconds();
|
|
11372
|
+
var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
|
|
11373
|
+
return addLeadingZeros(fractionalSeconds, token.length);
|
|
11374
|
+
}
|
|
11375
|
+
};
|
|
11376
|
+
|
|
11377
|
+
var MILLISECONDS_IN_DAY = 86400000; // This function will be a part of public API when UTC function will be implemented.
|
|
11378
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
11379
|
+
|
|
11380
|
+
function getUTCDayOfYear(dirtyDate) {
|
|
11381
|
+
requiredArgs(1, arguments);
|
|
11382
|
+
var date = toDate(dirtyDate);
|
|
11383
|
+
var timestamp = date.getTime();
|
|
11384
|
+
date.setUTCMonth(0, 1);
|
|
11385
|
+
date.setUTCHours(0, 0, 0, 0);
|
|
11386
|
+
var startOfYearTimestamp = date.getTime();
|
|
11387
|
+
var difference = timestamp - startOfYearTimestamp;
|
|
11388
|
+
return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
|
|
11389
|
+
}
|
|
11390
|
+
|
|
11391
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
11392
|
+
|
|
11393
|
+
function startOfUTCISOWeek(dirtyDate) {
|
|
11394
|
+
requiredArgs(1, arguments);
|
|
10822
11395
|
var weekStartsOn = 1;
|
|
10823
11396
|
var date = toDate(dirtyDate);
|
|
10824
11397
|
var day = date.getUTCDay();
|
|
@@ -10828,6 +11401,8 @@ function startOfUTCISOWeek(dirtyDate) {
|
|
|
10828
11401
|
return date;
|
|
10829
11402
|
}
|
|
10830
11403
|
|
|
11404
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
11405
|
+
|
|
10831
11406
|
function getUTCISOWeekYear(dirtyDate) {
|
|
10832
11407
|
requiredArgs(1, arguments);
|
|
10833
11408
|
var date = toDate(dirtyDate);
|
|
@@ -10849,6 +11424,8 @@ function getUTCISOWeekYear(dirtyDate) {
|
|
|
10849
11424
|
}
|
|
10850
11425
|
}
|
|
10851
11426
|
|
|
11427
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
11428
|
+
|
|
10852
11429
|
function startOfUTCISOWeekYear(dirtyDate) {
|
|
10853
11430
|
requiredArgs(1, arguments);
|
|
10854
11431
|
var year = getUTCISOWeekYear(dirtyDate);
|
|
@@ -10859,30 +11436,29 @@ function startOfUTCISOWeekYear(dirtyDate) {
|
|
|
10859
11436
|
return date;
|
|
10860
11437
|
}
|
|
10861
11438
|
|
|
10862
|
-
var MILLISECONDS_IN_WEEK$1 = 604800000;
|
|
11439
|
+
var MILLISECONDS_IN_WEEK$1 = 604800000; // This function will be a part of public API when UTC function will be implemented.
|
|
11440
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
11441
|
+
|
|
10863
11442
|
function getUTCISOWeek(dirtyDate) {
|
|
10864
11443
|
requiredArgs(1, arguments);
|
|
10865
11444
|
var date = toDate(dirtyDate);
|
|
10866
|
-
var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
|
|
10867
|
-
|
|
10868
|
-
// Round the number of days to the nearest integer
|
|
11445
|
+
var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer
|
|
10869
11446
|
// because the number of milliseconds in a week is not constant
|
|
10870
11447
|
// (e.g. it's different in the week of the daylight saving time clock shift)
|
|
11448
|
+
|
|
10871
11449
|
return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
|
|
10872
11450
|
}
|
|
10873
11451
|
|
|
10874
|
-
|
|
10875
|
-
function getDefaultOptions() {
|
|
10876
|
-
return defaultOptions;
|
|
10877
|
-
}
|
|
11452
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
10878
11453
|
|
|
10879
|
-
function startOfUTCWeek(dirtyDate,
|
|
10880
|
-
var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
|
|
11454
|
+
function startOfUTCWeek(dirtyDate, dirtyOptions) {
|
|
10881
11455
|
requiredArgs(1, arguments);
|
|
10882
|
-
var
|
|
10883
|
-
var
|
|
11456
|
+
var options = dirtyOptions || {};
|
|
11457
|
+
var locale = options.locale;
|
|
11458
|
+
var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;
|
|
11459
|
+
var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
|
|
11460
|
+
var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
|
|
10884
11461
|
|
|
10885
|
-
// Test if weekStartsOn is between 0 and 6 _and_ is not NaN
|
|
10886
11462
|
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
|
|
10887
11463
|
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
|
|
10888
11464
|
}
|
|
@@ -10894,26 +11470,29 @@ function startOfUTCWeek(dirtyDate, options) {
|
|
|
10894
11470
|
return date;
|
|
10895
11471
|
}
|
|
10896
11472
|
|
|
10897
|
-
|
|
10898
|
-
|
|
11473
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
11474
|
+
|
|
11475
|
+
function getUTCWeekYear(dirtyDate, dirtyOptions) {
|
|
10899
11476
|
requiredArgs(1, arguments);
|
|
10900
|
-
var date = toDate(dirtyDate);
|
|
11477
|
+
var date = toDate(dirtyDate, dirtyOptions);
|
|
10901
11478
|
var year = date.getUTCFullYear();
|
|
10902
|
-
var
|
|
10903
|
-
var
|
|
11479
|
+
var options = dirtyOptions || {};
|
|
11480
|
+
var locale = options.locale;
|
|
11481
|
+
var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
|
|
11482
|
+
var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
|
|
11483
|
+
var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
|
|
10904
11484
|
|
|
10905
|
-
// Test if weekStartsOn is between 1 and 7 _and_ is not NaN
|
|
10906
11485
|
if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
|
|
10907
11486
|
throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
|
|
10908
11487
|
}
|
|
10909
11488
|
var firstWeekOfNextYear = new Date(0);
|
|
10910
11489
|
firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
|
|
10911
11490
|
firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
|
|
10912
|
-
var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear,
|
|
11491
|
+
var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, dirtyOptions);
|
|
10913
11492
|
var firstWeekOfThisYear = new Date(0);
|
|
10914
11493
|
firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
|
|
10915
11494
|
firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
|
|
10916
|
-
var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear,
|
|
11495
|
+
var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, dirtyOptions);
|
|
10917
11496
|
if (date.getTime() >= startOfNextYear.getTime()) {
|
|
10918
11497
|
return year + 1;
|
|
10919
11498
|
} else if (date.getTime() >= startOfThisYear.getTime()) {
|
|
@@ -10923,119 +11502,36 @@ function getUTCWeekYear(dirtyDate, options) {
|
|
|
10923
11502
|
}
|
|
10924
11503
|
}
|
|
10925
11504
|
|
|
10926
|
-
|
|
10927
|
-
|
|
11505
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
11506
|
+
|
|
11507
|
+
function startOfUTCWeekYear(dirtyDate, dirtyOptions) {
|
|
10928
11508
|
requiredArgs(1, arguments);
|
|
10929
|
-
var
|
|
10930
|
-
var
|
|
10931
|
-
var
|
|
11509
|
+
var options = dirtyOptions || {};
|
|
11510
|
+
var locale = options.locale;
|
|
11511
|
+
var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
|
|
11512
|
+
var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
|
|
11513
|
+
var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
|
|
11514
|
+
var year = getUTCWeekYear(dirtyDate, dirtyOptions);
|
|
10932
11515
|
var firstWeek = new Date(0);
|
|
10933
11516
|
firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
|
|
10934
11517
|
firstWeek.setUTCHours(0, 0, 0, 0);
|
|
10935
|
-
var date = startOfUTCWeek(firstWeek,
|
|
11518
|
+
var date = startOfUTCWeek(firstWeek, dirtyOptions);
|
|
10936
11519
|
return date;
|
|
10937
11520
|
}
|
|
10938
11521
|
|
|
10939
|
-
var MILLISECONDS_IN_WEEK = 604800000;
|
|
11522
|
+
var MILLISECONDS_IN_WEEK = 604800000; // This function will be a part of public API when UTC function will be implemented.
|
|
11523
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
11524
|
+
|
|
10940
11525
|
function getUTCWeek(dirtyDate, options) {
|
|
10941
11526
|
requiredArgs(1, arguments);
|
|
10942
11527
|
var date = toDate(dirtyDate);
|
|
10943
|
-
var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
|
|
10944
|
-
|
|
10945
|
-
// Round the number of days to the nearest integer
|
|
11528
|
+
var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer
|
|
10946
11529
|
// because the number of milliseconds in a week is not constant
|
|
10947
11530
|
// (e.g. it's different in the week of the daylight saving time clock shift)
|
|
10948
|
-
return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
|
|
10949
|
-
}
|
|
10950
11531
|
|
|
10951
|
-
|
|
10952
|
-
var sign = number < 0 ? '-' : '';
|
|
10953
|
-
var output = Math.abs(number).toString();
|
|
10954
|
-
while (output.length < targetLength) {
|
|
10955
|
-
output = '0' + output;
|
|
10956
|
-
}
|
|
10957
|
-
return sign + output;
|
|
11532
|
+
return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
|
|
10958
11533
|
}
|
|
10959
11534
|
|
|
10960
|
-
/*
|
|
10961
|
-
* | | Unit | | Unit |
|
|
10962
|
-
* |-----|--------------------------------|-----|--------------------------------|
|
|
10963
|
-
* | a | AM, PM | A* | |
|
|
10964
|
-
* | d | Day of month | D | |
|
|
10965
|
-
* | h | Hour [1-12] | H | Hour [0-23] |
|
|
10966
|
-
* | m | Minute | M | Month |
|
|
10967
|
-
* | s | Second | S | Fraction of second |
|
|
10968
|
-
* | y | Year (abs) | Y | |
|
|
10969
|
-
*
|
|
10970
|
-
* Letters marked by * are not implemented but reserved by Unicode standard.
|
|
10971
|
-
*/
|
|
10972
|
-
var formatters$1 = {
|
|
10973
|
-
// Year
|
|
10974
|
-
y: function y(date, token) {
|
|
10975
|
-
// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
|
|
10976
|
-
// | Year | y | yy | yyy | yyyy | yyyyy |
|
|
10977
|
-
// |----------|-------|----|-------|-------|-------|
|
|
10978
|
-
// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
|
|
10979
|
-
// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
|
|
10980
|
-
// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
|
|
10981
|
-
// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
|
|
10982
|
-
// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
|
|
10983
|
-
|
|
10984
|
-
var signedYear = date.getUTCFullYear();
|
|
10985
|
-
// Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
10986
|
-
var year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
10987
|
-
return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
|
|
10988
|
-
},
|
|
10989
|
-
// Month
|
|
10990
|
-
M: function M(date, token) {
|
|
10991
|
-
var month = date.getUTCMonth();
|
|
10992
|
-
return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
|
|
10993
|
-
},
|
|
10994
|
-
// Day of the month
|
|
10995
|
-
d: function d(date, token) {
|
|
10996
|
-
return addLeadingZeros(date.getUTCDate(), token.length);
|
|
10997
|
-
},
|
|
10998
|
-
// AM or PM
|
|
10999
|
-
a: function a(date, token) {
|
|
11000
|
-
var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
|
|
11001
|
-
switch (token) {
|
|
11002
|
-
case 'a':
|
|
11003
|
-
case 'aa':
|
|
11004
|
-
return dayPeriodEnumValue.toUpperCase();
|
|
11005
|
-
case 'aaa':
|
|
11006
|
-
return dayPeriodEnumValue;
|
|
11007
|
-
case 'aaaaa':
|
|
11008
|
-
return dayPeriodEnumValue[0];
|
|
11009
|
-
case 'aaaa':
|
|
11010
|
-
default:
|
|
11011
|
-
return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
|
|
11012
|
-
}
|
|
11013
|
-
},
|
|
11014
|
-
// Hour [1-12]
|
|
11015
|
-
h: function h(date, token) {
|
|
11016
|
-
return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
|
|
11017
|
-
},
|
|
11018
|
-
// Hour [0-23]
|
|
11019
|
-
H: function H(date, token) {
|
|
11020
|
-
return addLeadingZeros(date.getUTCHours(), token.length);
|
|
11021
|
-
},
|
|
11022
|
-
// Minute
|
|
11023
|
-
m: function m(date, token) {
|
|
11024
|
-
return addLeadingZeros(date.getUTCMinutes(), token.length);
|
|
11025
|
-
},
|
|
11026
|
-
// Second
|
|
11027
|
-
s: function s(date, token) {
|
|
11028
|
-
return addLeadingZeros(date.getUTCSeconds(), token.length);
|
|
11029
|
-
},
|
|
11030
|
-
// Fraction of second
|
|
11031
|
-
S: function S(date, token) {
|
|
11032
|
-
var numberOfDigits = token.length;
|
|
11033
|
-
var milliseconds = date.getUTCMilliseconds();
|
|
11034
|
-
var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
|
|
11035
|
-
return addLeadingZeros(fractionalSeconds, token.length);
|
|
11036
|
-
}
|
|
11037
|
-
};
|
|
11038
|
-
|
|
11039
11535
|
var dayPeriodEnum = {
|
|
11040
11536
|
am: 'am',
|
|
11041
11537
|
pm: 'pm',
|
|
@@ -11045,52 +11541,52 @@ var dayPeriodEnum = {
|
|
|
11045
11541
|
afternoon: 'afternoon',
|
|
11046
11542
|
evening: 'evening',
|
|
11047
11543
|
night: 'night'
|
|
11544
|
+
/*
|
|
11545
|
+
* | | Unit | | Unit |
|
|
11546
|
+
* |-----|--------------------------------|-----|--------------------------------|
|
|
11547
|
+
* | a | AM, PM | A* | Milliseconds in day |
|
|
11548
|
+
* | b | AM, PM, noon, midnight | B | Flexible day period |
|
|
11549
|
+
* | c | Stand-alone local day of week | C* | Localized hour w/ day period |
|
|
11550
|
+
* | d | Day of month | D | Day of year |
|
|
11551
|
+
* | e | Local day of week | E | Day of week |
|
|
11552
|
+
* | f | | F* | Day of week in month |
|
|
11553
|
+
* | g* | Modified Julian day | G | Era |
|
|
11554
|
+
* | h | Hour [1-12] | H | Hour [0-23] |
|
|
11555
|
+
* | i! | ISO day of week | I! | ISO week of year |
|
|
11556
|
+
* | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
|
|
11557
|
+
* | k | Hour [1-24] | K | Hour [0-11] |
|
|
11558
|
+
* | l* | (deprecated) | L | Stand-alone month |
|
|
11559
|
+
* | m | Minute | M | Month |
|
|
11560
|
+
* | n | | N | |
|
|
11561
|
+
* | o! | Ordinal number modifier | O | Timezone (GMT) |
|
|
11562
|
+
* | p! | Long localized time | P! | Long localized date |
|
|
11563
|
+
* | q | Stand-alone quarter | Q | Quarter |
|
|
11564
|
+
* | r* | Related Gregorian year | R! | ISO week-numbering year |
|
|
11565
|
+
* | s | Second | S | Fraction of second |
|
|
11566
|
+
* | t! | Seconds timestamp | T! | Milliseconds timestamp |
|
|
11567
|
+
* | u | Extended year | U* | Cyclic year |
|
|
11568
|
+
* | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
|
|
11569
|
+
* | w | Local week of year | W* | Week of month |
|
|
11570
|
+
* | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
|
|
11571
|
+
* | y | Year (abs) | Y | Local week-numbering year |
|
|
11572
|
+
* | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
|
|
11573
|
+
*
|
|
11574
|
+
* Letters marked by * are not implemented but reserved by Unicode standard.
|
|
11575
|
+
*
|
|
11576
|
+
* Letters marked by ! are non-standard, but implemented by date-fns:
|
|
11577
|
+
* - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
|
|
11578
|
+
* - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
|
|
11579
|
+
* i.e. 7 for Sunday, 1 for Monday, etc.
|
|
11580
|
+
* - `I` is ISO week of year, as opposed to `w` which is local week of year.
|
|
11581
|
+
* - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
|
|
11582
|
+
* `R` is supposed to be used in conjunction with `I` and `i`
|
|
11583
|
+
* for universal ISO week-numbering date, whereas
|
|
11584
|
+
* `Y` is supposed to be used in conjunction with `w` and `e`
|
|
11585
|
+
* for week-numbering date specific to the locale.
|
|
11586
|
+
* - `P` is long localized date format
|
|
11587
|
+
* - `p` is long localized time format
|
|
11588
|
+
*/
|
|
11048
11589
|
};
|
|
11049
|
-
/*
|
|
11050
|
-
* | | Unit | | Unit |
|
|
11051
|
-
* |-----|--------------------------------|-----|--------------------------------|
|
|
11052
|
-
* | a | AM, PM | A* | Milliseconds in day |
|
|
11053
|
-
* | b | AM, PM, noon, midnight | B | Flexible day period |
|
|
11054
|
-
* | c | Stand-alone local day of week | C* | Localized hour w/ day period |
|
|
11055
|
-
* | d | Day of month | D | Day of year |
|
|
11056
|
-
* | e | Local day of week | E | Day of week |
|
|
11057
|
-
* | f | | F* | Day of week in month |
|
|
11058
|
-
* | g* | Modified Julian day | G | Era |
|
|
11059
|
-
* | h | Hour [1-12] | H | Hour [0-23] |
|
|
11060
|
-
* | i! | ISO day of week | I! | ISO week of year |
|
|
11061
|
-
* | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
|
|
11062
|
-
* | k | Hour [1-24] | K | Hour [0-11] |
|
|
11063
|
-
* | l* | (deprecated) | L | Stand-alone month |
|
|
11064
|
-
* | m | Minute | M | Month |
|
|
11065
|
-
* | n | | N | |
|
|
11066
|
-
* | o! | Ordinal number modifier | O | Timezone (GMT) |
|
|
11067
|
-
* | p! | Long localized time | P! | Long localized date |
|
|
11068
|
-
* | q | Stand-alone quarter | Q | Quarter |
|
|
11069
|
-
* | r* | Related Gregorian year | R! | ISO week-numbering year |
|
|
11070
|
-
* | s | Second | S | Fraction of second |
|
|
11071
|
-
* | t! | Seconds timestamp | T! | Milliseconds timestamp |
|
|
11072
|
-
* | u | Extended year | U* | Cyclic year |
|
|
11073
|
-
* | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
|
|
11074
|
-
* | w | Local week of year | W* | Week of month |
|
|
11075
|
-
* | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
|
|
11076
|
-
* | y | Year (abs) | Y | Local week-numbering year |
|
|
11077
|
-
* | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
|
|
11078
|
-
*
|
|
11079
|
-
* Letters marked by * are not implemented but reserved by Unicode standard.
|
|
11080
|
-
*
|
|
11081
|
-
* Letters marked by ! are non-standard, but implemented by date-fns:
|
|
11082
|
-
* - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
|
|
11083
|
-
* - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
|
|
11084
|
-
* i.e. 7 for Sunday, 1 for Monday, etc.
|
|
11085
|
-
* - `I` is ISO week of year, as opposed to `w` which is local week of year.
|
|
11086
|
-
* - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
|
|
11087
|
-
* `R` is supposed to be used in conjunction with `I` and `i`
|
|
11088
|
-
* for universal ISO week-numbering date, whereas
|
|
11089
|
-
* `Y` is supposed to be used in conjunction with `w` and `e`
|
|
11090
|
-
* for week-numbering date specific to the locale.
|
|
11091
|
-
* - `P` is long localized date format
|
|
11092
|
-
* - `p` is long localized time format
|
|
11093
|
-
*/
|
|
11094
11590
|
|
|
11095
11591
|
var formatters = {
|
|
11096
11592
|
// Era
|
|
@@ -11105,11 +11601,13 @@ var formatters = {
|
|
|
11105
11601
|
width: 'abbreviated'
|
|
11106
11602
|
});
|
|
11107
11603
|
// A, B
|
|
11604
|
+
|
|
11108
11605
|
case 'GGGGG':
|
|
11109
11606
|
return localize.era(era, {
|
|
11110
11607
|
width: 'narrow'
|
|
11111
11608
|
});
|
|
11112
11609
|
// Anno Domini, Before Christ
|
|
11610
|
+
|
|
11113
11611
|
case 'GGGG':
|
|
11114
11612
|
default:
|
|
11115
11613
|
return localize.era(era, {
|
|
@@ -11121,8 +11619,8 @@ var formatters = {
|
|
|
11121
11619
|
y: function y(date, token, localize) {
|
|
11122
11620
|
// Ordinal number
|
|
11123
11621
|
if (token === 'yo') {
|
|
11124
|
-
var signedYear = date.getUTCFullYear();
|
|
11125
|
-
|
|
11622
|
+
var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
11623
|
+
|
|
11126
11624
|
var year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
11127
11625
|
return localize.ordinalNumber(year, {
|
|
11128
11626
|
unit: 'year'
|
|
@@ -11132,31 +11630,27 @@ var formatters = {
|
|
|
11132
11630
|
},
|
|
11133
11631
|
// Local week-numbering year
|
|
11134
11632
|
Y: function Y(date, token, localize, options) {
|
|
11135
|
-
var signedWeekYear = getUTCWeekYear(date, options);
|
|
11136
|
-
|
|
11137
|
-
var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
|
|
11633
|
+
var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
11634
|
+
|
|
11635
|
+
var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year
|
|
11138
11636
|
|
|
11139
|
-
// Two digit year
|
|
11140
11637
|
if (token === 'YY') {
|
|
11141
11638
|
var twoDigitYear = weekYear % 100;
|
|
11142
11639
|
return addLeadingZeros(twoDigitYear, 2);
|
|
11143
|
-
}
|
|
11640
|
+
} // Ordinal number
|
|
11144
11641
|
|
|
11145
|
-
// Ordinal number
|
|
11146
11642
|
if (token === 'Yo') {
|
|
11147
11643
|
return localize.ordinalNumber(weekYear, {
|
|
11148
11644
|
unit: 'year'
|
|
11149
11645
|
});
|
|
11150
|
-
}
|
|
11646
|
+
} // Padding
|
|
11151
11647
|
|
|
11152
|
-
// Padding
|
|
11153
11648
|
return addLeadingZeros(weekYear, token.length);
|
|
11154
11649
|
},
|
|
11155
11650
|
// ISO week-numbering year
|
|
11156
11651
|
R: function R(date, token) {
|
|
11157
|
-
var isoWeekYear = getUTCISOWeekYear(date);
|
|
11652
|
+
var isoWeekYear = getUTCISOWeekYear(date); // Padding
|
|
11158
11653
|
|
|
11159
|
-
// Padding
|
|
11160
11654
|
return addLeadingZeros(isoWeekYear, token.length);
|
|
11161
11655
|
},
|
|
11162
11656
|
// Extended year. This is a single number designating the year of this calendar system.
|
|
@@ -11180,26 +11674,31 @@ var formatters = {
|
|
|
11180
11674
|
case 'Q':
|
|
11181
11675
|
return String(quarter);
|
|
11182
11676
|
// 01, 02, 03, 04
|
|
11677
|
+
|
|
11183
11678
|
case 'QQ':
|
|
11184
11679
|
return addLeadingZeros(quarter, 2);
|
|
11185
11680
|
// 1st, 2nd, 3rd, 4th
|
|
11681
|
+
|
|
11186
11682
|
case 'Qo':
|
|
11187
11683
|
return localize.ordinalNumber(quarter, {
|
|
11188
11684
|
unit: 'quarter'
|
|
11189
11685
|
});
|
|
11190
11686
|
// Q1, Q2, Q3, Q4
|
|
11687
|
+
|
|
11191
11688
|
case 'QQQ':
|
|
11192
11689
|
return localize.quarter(quarter, {
|
|
11193
11690
|
width: 'abbreviated',
|
|
11194
11691
|
context: 'formatting'
|
|
11195
11692
|
});
|
|
11196
11693
|
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
11694
|
+
|
|
11197
11695
|
case 'QQQQQ':
|
|
11198
11696
|
return localize.quarter(quarter, {
|
|
11199
11697
|
width: 'narrow',
|
|
11200
11698
|
context: 'formatting'
|
|
11201
11699
|
});
|
|
11202
11700
|
// 1st quarter, 2nd quarter, ...
|
|
11701
|
+
|
|
11203
11702
|
case 'QQQQ':
|
|
11204
11703
|
default:
|
|
11205
11704
|
return localize.quarter(quarter, {
|
|
@@ -11216,26 +11715,31 @@ var formatters = {
|
|
|
11216
11715
|
case 'q':
|
|
11217
11716
|
return String(quarter);
|
|
11218
11717
|
// 01, 02, 03, 04
|
|
11718
|
+
|
|
11219
11719
|
case 'qq':
|
|
11220
11720
|
return addLeadingZeros(quarter, 2);
|
|
11221
11721
|
// 1st, 2nd, 3rd, 4th
|
|
11722
|
+
|
|
11222
11723
|
case 'qo':
|
|
11223
11724
|
return localize.ordinalNumber(quarter, {
|
|
11224
11725
|
unit: 'quarter'
|
|
11225
11726
|
});
|
|
11226
11727
|
// Q1, Q2, Q3, Q4
|
|
11728
|
+
|
|
11227
11729
|
case 'qqq':
|
|
11228
11730
|
return localize.quarter(quarter, {
|
|
11229
11731
|
width: 'abbreviated',
|
|
11230
11732
|
context: 'standalone'
|
|
11231
11733
|
});
|
|
11232
11734
|
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
11735
|
+
|
|
11233
11736
|
case 'qqqqq':
|
|
11234
11737
|
return localize.quarter(quarter, {
|
|
11235
11738
|
width: 'narrow',
|
|
11236
11739
|
context: 'standalone'
|
|
11237
11740
|
});
|
|
11238
11741
|
// 1st quarter, 2nd quarter, ...
|
|
11742
|
+
|
|
11239
11743
|
case 'qqqq':
|
|
11240
11744
|
default:
|
|
11241
11745
|
return localize.quarter(quarter, {
|
|
@@ -11252,23 +11756,27 @@ var formatters = {
|
|
|
11252
11756
|
case 'MM':
|
|
11253
11757
|
return formatters$1.M(date, token);
|
|
11254
11758
|
// 1st, 2nd, ..., 12th
|
|
11759
|
+
|
|
11255
11760
|
case 'Mo':
|
|
11256
11761
|
return localize.ordinalNumber(month + 1, {
|
|
11257
11762
|
unit: 'month'
|
|
11258
11763
|
});
|
|
11259
11764
|
// Jan, Feb, ..., Dec
|
|
11765
|
+
|
|
11260
11766
|
case 'MMM':
|
|
11261
11767
|
return localize.month(month, {
|
|
11262
11768
|
width: 'abbreviated',
|
|
11263
11769
|
context: 'formatting'
|
|
11264
11770
|
});
|
|
11265
11771
|
// J, F, ..., D
|
|
11772
|
+
|
|
11266
11773
|
case 'MMMMM':
|
|
11267
11774
|
return localize.month(month, {
|
|
11268
11775
|
width: 'narrow',
|
|
11269
11776
|
context: 'formatting'
|
|
11270
11777
|
});
|
|
11271
11778
|
// January, February, ..., December
|
|
11779
|
+
|
|
11272
11780
|
case 'MMMM':
|
|
11273
11781
|
default:
|
|
11274
11782
|
return localize.month(month, {
|
|
@@ -11285,26 +11793,31 @@ var formatters = {
|
|
|
11285
11793
|
case 'L':
|
|
11286
11794
|
return String(month + 1);
|
|
11287
11795
|
// 01, 02, ..., 12
|
|
11796
|
+
|
|
11288
11797
|
case 'LL':
|
|
11289
11798
|
return addLeadingZeros(month + 1, 2);
|
|
11290
11799
|
// 1st, 2nd, ..., 12th
|
|
11800
|
+
|
|
11291
11801
|
case 'Lo':
|
|
11292
11802
|
return localize.ordinalNumber(month + 1, {
|
|
11293
11803
|
unit: 'month'
|
|
11294
11804
|
});
|
|
11295
11805
|
// Jan, Feb, ..., Dec
|
|
11806
|
+
|
|
11296
11807
|
case 'LLL':
|
|
11297
11808
|
return localize.month(month, {
|
|
11298
11809
|
width: 'abbreviated',
|
|
11299
11810
|
context: 'standalone'
|
|
11300
11811
|
});
|
|
11301
11812
|
// J, F, ..., D
|
|
11813
|
+
|
|
11302
11814
|
case 'LLLLL':
|
|
11303
11815
|
return localize.month(month, {
|
|
11304
11816
|
width: 'narrow',
|
|
11305
11817
|
context: 'standalone'
|
|
11306
11818
|
});
|
|
11307
11819
|
// January, February, ..., December
|
|
11820
|
+
|
|
11308
11821
|
case 'LLLL':
|
|
11309
11822
|
default:
|
|
11310
11823
|
return localize.month(month, {
|
|
@@ -11365,18 +11878,21 @@ var formatters = {
|
|
|
11365
11878
|
context: 'formatting'
|
|
11366
11879
|
});
|
|
11367
11880
|
// T
|
|
11881
|
+
|
|
11368
11882
|
case 'EEEEE':
|
|
11369
11883
|
return localize.day(dayOfWeek, {
|
|
11370
11884
|
width: 'narrow',
|
|
11371
11885
|
context: 'formatting'
|
|
11372
11886
|
});
|
|
11373
11887
|
// Tu
|
|
11888
|
+
|
|
11374
11889
|
case 'EEEEEE':
|
|
11375
11890
|
return localize.day(dayOfWeek, {
|
|
11376
11891
|
width: 'short',
|
|
11377
11892
|
context: 'formatting'
|
|
11378
11893
|
});
|
|
11379
11894
|
// Tuesday
|
|
11895
|
+
|
|
11380
11896
|
case 'EEEE':
|
|
11381
11897
|
default:
|
|
11382
11898
|
return localize.day(dayOfWeek, {
|
|
@@ -11394,9 +11910,11 @@ var formatters = {
|
|
|
11394
11910
|
case 'e':
|
|
11395
11911
|
return String(localDayOfWeek);
|
|
11396
11912
|
// Padded numerical value
|
|
11913
|
+
|
|
11397
11914
|
case 'ee':
|
|
11398
11915
|
return addLeadingZeros(localDayOfWeek, 2);
|
|
11399
11916
|
// 1st, 2nd, ..., 7th
|
|
11917
|
+
|
|
11400
11918
|
case 'eo':
|
|
11401
11919
|
return localize.ordinalNumber(localDayOfWeek, {
|
|
11402
11920
|
unit: 'day'
|
|
@@ -11407,18 +11925,21 @@ var formatters = {
|
|
|
11407
11925
|
context: 'formatting'
|
|
11408
11926
|
});
|
|
11409
11927
|
// T
|
|
11928
|
+
|
|
11410
11929
|
case 'eeeee':
|
|
11411
11930
|
return localize.day(dayOfWeek, {
|
|
11412
11931
|
width: 'narrow',
|
|
11413
11932
|
context: 'formatting'
|
|
11414
11933
|
});
|
|
11415
11934
|
// Tu
|
|
11935
|
+
|
|
11416
11936
|
case 'eeeeee':
|
|
11417
11937
|
return localize.day(dayOfWeek, {
|
|
11418
11938
|
width: 'short',
|
|
11419
11939
|
context: 'formatting'
|
|
11420
11940
|
});
|
|
11421
11941
|
// Tuesday
|
|
11942
|
+
|
|
11422
11943
|
case 'eeee':
|
|
11423
11944
|
default:
|
|
11424
11945
|
return localize.day(dayOfWeek, {
|
|
@@ -11436,9 +11957,11 @@ var formatters = {
|
|
|
11436
11957
|
case 'c':
|
|
11437
11958
|
return String(localDayOfWeek);
|
|
11438
11959
|
// Padded numerical value
|
|
11960
|
+
|
|
11439
11961
|
case 'cc':
|
|
11440
11962
|
return addLeadingZeros(localDayOfWeek, token.length);
|
|
11441
11963
|
// 1st, 2nd, ..., 7th
|
|
11964
|
+
|
|
11442
11965
|
case 'co':
|
|
11443
11966
|
return localize.ordinalNumber(localDayOfWeek, {
|
|
11444
11967
|
unit: 'day'
|
|
@@ -11449,18 +11972,21 @@ var formatters = {
|
|
|
11449
11972
|
context: 'standalone'
|
|
11450
11973
|
});
|
|
11451
11974
|
// T
|
|
11975
|
+
|
|
11452
11976
|
case 'ccccc':
|
|
11453
11977
|
return localize.day(dayOfWeek, {
|
|
11454
11978
|
width: 'narrow',
|
|
11455
11979
|
context: 'standalone'
|
|
11456
11980
|
});
|
|
11457
11981
|
// Tu
|
|
11982
|
+
|
|
11458
11983
|
case 'cccccc':
|
|
11459
11984
|
return localize.day(dayOfWeek, {
|
|
11460
11985
|
width: 'short',
|
|
11461
11986
|
context: 'standalone'
|
|
11462
11987
|
});
|
|
11463
11988
|
// Tuesday
|
|
11989
|
+
|
|
11464
11990
|
case 'cccc':
|
|
11465
11991
|
default:
|
|
11466
11992
|
return localize.day(dayOfWeek, {
|
|
@@ -11478,32 +12004,38 @@ var formatters = {
|
|
|
11478
12004
|
case 'i':
|
|
11479
12005
|
return String(isoDayOfWeek);
|
|
11480
12006
|
// 02
|
|
12007
|
+
|
|
11481
12008
|
case 'ii':
|
|
11482
12009
|
return addLeadingZeros(isoDayOfWeek, token.length);
|
|
11483
12010
|
// 2nd
|
|
12011
|
+
|
|
11484
12012
|
case 'io':
|
|
11485
12013
|
return localize.ordinalNumber(isoDayOfWeek, {
|
|
11486
12014
|
unit: 'day'
|
|
11487
12015
|
});
|
|
11488
12016
|
// Tue
|
|
12017
|
+
|
|
11489
12018
|
case 'iii':
|
|
11490
12019
|
return localize.day(dayOfWeek, {
|
|
11491
12020
|
width: 'abbreviated',
|
|
11492
12021
|
context: 'formatting'
|
|
11493
12022
|
});
|
|
11494
12023
|
// T
|
|
12024
|
+
|
|
11495
12025
|
case 'iiiii':
|
|
11496
12026
|
return localize.day(dayOfWeek, {
|
|
11497
12027
|
width: 'narrow',
|
|
11498
12028
|
context: 'formatting'
|
|
11499
12029
|
});
|
|
11500
12030
|
// Tu
|
|
12031
|
+
|
|
11501
12032
|
case 'iiiiii':
|
|
11502
12033
|
return localize.day(dayOfWeek, {
|
|
11503
12034
|
width: 'short',
|
|
11504
12035
|
context: 'formatting'
|
|
11505
12036
|
});
|
|
11506
12037
|
// Tuesday
|
|
12038
|
+
|
|
11507
12039
|
case 'iiii':
|
|
11508
12040
|
default:
|
|
11509
12041
|
return localize.day(dayOfWeek, {
|
|
@@ -11519,15 +12051,11 @@ var formatters = {
|
|
|
11519
12051
|
switch (token) {
|
|
11520
12052
|
case 'a':
|
|
11521
12053
|
case 'aa':
|
|
11522
|
-
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
11523
|
-
width: 'abbreviated',
|
|
11524
|
-
context: 'formatting'
|
|
11525
|
-
});
|
|
11526
12054
|
case 'aaa':
|
|
11527
12055
|
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
11528
12056
|
width: 'abbreviated',
|
|
11529
12057
|
context: 'formatting'
|
|
11530
|
-
})
|
|
12058
|
+
});
|
|
11531
12059
|
case 'aaaaa':
|
|
11532
12060
|
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
11533
12061
|
width: 'narrow',
|
|
@@ -11555,15 +12083,11 @@ var formatters = {
|
|
|
11555
12083
|
switch (token) {
|
|
11556
12084
|
case 'b':
|
|
11557
12085
|
case 'bb':
|
|
11558
|
-
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
11559
|
-
width: 'abbreviated',
|
|
11560
|
-
context: 'formatting'
|
|
11561
|
-
});
|
|
11562
12086
|
case 'bbb':
|
|
11563
12087
|
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
11564
12088
|
width: 'abbreviated',
|
|
11565
12089
|
context: 'formatting'
|
|
11566
|
-
})
|
|
12090
|
+
});
|
|
11567
12091
|
case 'bbbbb':
|
|
11568
12092
|
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
11569
12093
|
width: 'narrow',
|
|
@@ -11685,20 +12209,21 @@ var formatters = {
|
|
|
11685
12209
|
// Hours and optional minutes
|
|
11686
12210
|
case 'X':
|
|
11687
12211
|
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
11688
|
-
|
|
11689
12212
|
// Hours, minutes and optional seconds without `:` delimiter
|
|
11690
12213
|
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
11691
12214
|
// so this token always has the same output as `XX`
|
|
12215
|
+
|
|
11692
12216
|
case 'XXXX':
|
|
11693
12217
|
case 'XX':
|
|
11694
12218
|
// Hours and minutes without `:` delimiter
|
|
11695
12219
|
return formatTimezone(timezoneOffset);
|
|
11696
|
-
|
|
11697
12220
|
// Hours, minutes and optional seconds with `:` delimiter
|
|
11698
12221
|
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
11699
12222
|
// so this token always has the same output as `XXX`
|
|
12223
|
+
|
|
11700
12224
|
case 'XXXXX':
|
|
11701
12225
|
case 'XXX': // Hours and minutes with `:` delimiter
|
|
12226
|
+
|
|
11702
12227
|
default:
|
|
11703
12228
|
return formatTimezone(timezoneOffset, ':');
|
|
11704
12229
|
}
|
|
@@ -11711,20 +12236,21 @@ var formatters = {
|
|
|
11711
12236
|
// Hours and optional minutes
|
|
11712
12237
|
case 'x':
|
|
11713
12238
|
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
11714
|
-
|
|
11715
12239
|
// Hours, minutes and optional seconds without `:` delimiter
|
|
11716
12240
|
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
11717
12241
|
// so this token always has the same output as `xx`
|
|
12242
|
+
|
|
11718
12243
|
case 'xxxx':
|
|
11719
12244
|
case 'xx':
|
|
11720
12245
|
// Hours and minutes without `:` delimiter
|
|
11721
12246
|
return formatTimezone(timezoneOffset);
|
|
11722
|
-
|
|
11723
12247
|
// Hours, minutes and optional seconds with `:` delimiter
|
|
11724
12248
|
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
11725
12249
|
// so this token always has the same output as `xxx`
|
|
12250
|
+
|
|
11726
12251
|
case 'xxxxx':
|
|
11727
12252
|
case 'xxx': // Hours and minutes with `:` delimiter
|
|
12253
|
+
|
|
11728
12254
|
default:
|
|
11729
12255
|
return formatTimezone(timezoneOffset, ':');
|
|
11730
12256
|
}
|
|
@@ -11740,661 +12266,193 @@ var formatters = {
|
|
|
11740
12266
|
case 'OOO':
|
|
11741
12267
|
return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
|
|
11742
12268
|
// Long
|
|
12269
|
+
|
|
11743
12270
|
case 'OOOO':
|
|
11744
12271
|
default:
|
|
11745
|
-
return 'GMT' + formatTimezone(timezoneOffset, ':');
|
|
11746
|
-
}
|
|
11747
|
-
},
|
|
11748
|
-
// Timezone (specific non-location)
|
|
11749
|
-
z: function z(date, token, _localize, options) {
|
|
11750
|
-
var originalDate = options._originalDate || date;
|
|
11751
|
-
var timezoneOffset = originalDate.getTimezoneOffset();
|
|
11752
|
-
switch (token) {
|
|
11753
|
-
// Short
|
|
11754
|
-
case 'z':
|
|
11755
|
-
case 'zz':
|
|
11756
|
-
case 'zzz':
|
|
11757
|
-
return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
|
|
11758
|
-
// Long
|
|
11759
|
-
|
|
11760
|
-
|
|
11761
|
-
|
|
11762
|
-
|
|
11763
|
-
},
|
|
11764
|
-
// Seconds timestamp
|
|
11765
|
-
t: function t(date, token, _localize, options) {
|
|
11766
|
-
var originalDate = options._originalDate || date;
|
|
11767
|
-
var timestamp = Math.floor(originalDate.getTime() / 1000);
|
|
11768
|
-
return addLeadingZeros(timestamp, token.length);
|
|
11769
|
-
},
|
|
11770
|
-
// Milliseconds timestamp
|
|
11771
|
-
T: function T(date, token, _localize, options) {
|
|
11772
|
-
var originalDate = options._originalDate || date;
|
|
11773
|
-
var timestamp = originalDate.getTime();
|
|
11774
|
-
return addLeadingZeros(timestamp, token.length);
|
|
11775
|
-
}
|
|
11776
|
-
};
|
|
11777
|
-
function formatTimezoneShort(offset, dirtyDelimiter) {
|
|
11778
|
-
var sign = offset > 0 ? '-' : '+';
|
|
11779
|
-
var absOffset = Math.abs(offset);
|
|
11780
|
-
var hours = Math.floor(absOffset / 60);
|
|
11781
|
-
var minutes = absOffset % 60;
|
|
11782
|
-
if (minutes === 0) {
|
|
11783
|
-
return sign + String(hours);
|
|
11784
|
-
}
|
|
11785
|
-
var delimiter = dirtyDelimiter;
|
|
11786
|
-
return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
|
|
11787
|
-
}
|
|
11788
|
-
function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
|
|
11789
|
-
if (offset % 60 === 0) {
|
|
11790
|
-
var sign = offset > 0 ? '-' : '+';
|
|
11791
|
-
return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
|
|
11792
|
-
}
|
|
11793
|
-
return formatTimezone(offset, dirtyDelimiter);
|
|
11794
|
-
}
|
|
11795
|
-
function formatTimezone(offset, dirtyDelimiter) {
|
|
11796
|
-
var delimiter = dirtyDelimiter || '';
|
|
11797
|
-
var sign = offset > 0 ? '-' : '+';
|
|
11798
|
-
var absOffset = Math.abs(offset);
|
|
11799
|
-
var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
|
|
11800
|
-
var minutes = addLeadingZeros(absOffset % 60, 2);
|
|
11801
|
-
return sign + hours + delimiter + minutes;
|
|
11802
|
-
}
|
|
11803
|
-
|
|
11804
|
-
var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
|
|
11805
|
-
switch (pattern) {
|
|
11806
|
-
case 'P':
|
|
11807
|
-
return formatLong.date({
|
|
11808
|
-
width: 'short'
|
|
11809
|
-
});
|
|
11810
|
-
case 'PP':
|
|
11811
|
-
return formatLong.date({
|
|
11812
|
-
width: 'medium'
|
|
11813
|
-
});
|
|
11814
|
-
case 'PPP':
|
|
11815
|
-
return formatLong.date({
|
|
11816
|
-
width: 'long'
|
|
11817
|
-
});
|
|
11818
|
-
case 'PPPP':
|
|
11819
|
-
default:
|
|
11820
|
-
return formatLong.date({
|
|
11821
|
-
width: 'full'
|
|
11822
|
-
});
|
|
11823
|
-
}
|
|
11824
|
-
};
|
|
11825
|
-
var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
|
|
11826
|
-
switch (pattern) {
|
|
11827
|
-
case 'p':
|
|
11828
|
-
return formatLong.time({
|
|
11829
|
-
width: 'short'
|
|
11830
|
-
});
|
|
11831
|
-
case 'pp':
|
|
11832
|
-
return formatLong.time({
|
|
11833
|
-
width: 'medium'
|
|
11834
|
-
});
|
|
11835
|
-
case 'ppp':
|
|
11836
|
-
return formatLong.time({
|
|
11837
|
-
width: 'long'
|
|
11838
|
-
});
|
|
11839
|
-
case 'pppp':
|
|
11840
|
-
default:
|
|
11841
|
-
return formatLong.time({
|
|
11842
|
-
width: 'full'
|
|
11843
|
-
});
|
|
11844
|
-
}
|
|
11845
|
-
};
|
|
11846
|
-
var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
|
|
11847
|
-
var matchResult = pattern.match(/(P+)(p+)?/) || [];
|
|
11848
|
-
var datePattern = matchResult[1];
|
|
11849
|
-
var timePattern = matchResult[2];
|
|
11850
|
-
if (!timePattern) {
|
|
11851
|
-
return dateLongFormatter(pattern, formatLong);
|
|
11852
|
-
}
|
|
11853
|
-
var dateTimeFormat;
|
|
11854
|
-
switch (datePattern) {
|
|
11855
|
-
case 'P':
|
|
11856
|
-
dateTimeFormat = formatLong.dateTime({
|
|
11857
|
-
width: 'short'
|
|
11858
|
-
});
|
|
11859
|
-
break;
|
|
11860
|
-
case 'PP':
|
|
11861
|
-
dateTimeFormat = formatLong.dateTime({
|
|
11862
|
-
width: 'medium'
|
|
11863
|
-
});
|
|
11864
|
-
break;
|
|
11865
|
-
case 'PPP':
|
|
11866
|
-
dateTimeFormat = formatLong.dateTime({
|
|
11867
|
-
width: 'long'
|
|
11868
|
-
});
|
|
11869
|
-
break;
|
|
11870
|
-
case 'PPPP':
|
|
11871
|
-
default:
|
|
11872
|
-
dateTimeFormat = formatLong.dateTime({
|
|
11873
|
-
width: 'full'
|
|
11874
|
-
});
|
|
11875
|
-
break;
|
|
11876
|
-
}
|
|
11877
|
-
return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
|
|
11878
|
-
};
|
|
11879
|
-
var longFormatters = {
|
|
11880
|
-
p: timeLongFormatter,
|
|
11881
|
-
P: dateTimeLongFormatter
|
|
11882
|
-
};
|
|
11883
|
-
|
|
11884
|
-
/**
|
|
11885
|
-
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
|
|
11886
|
-
* They usually appear for dates that denote time before the timezones were introduced
|
|
11887
|
-
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
|
|
11888
|
-
* and GMT+01:00:00 after that date)
|
|
11889
|
-
*
|
|
11890
|
-
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
|
|
11891
|
-
* which would lead to incorrect calculations.
|
|
11892
|
-
*
|
|
11893
|
-
* This function returns the timezone offset in milliseconds that takes seconds in account.
|
|
11894
|
-
*/
|
|
11895
|
-
function getTimezoneOffsetInMilliseconds(date) {
|
|
11896
|
-
var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
|
|
11897
|
-
utcDate.setUTCFullYear(date.getFullYear());
|
|
11898
|
-
return date.getTime() - utcDate.getTime();
|
|
11899
|
-
}
|
|
11900
|
-
|
|
11901
|
-
var protectedDayOfYearTokens = ['D', 'DD'];
|
|
11902
|
-
var protectedWeekYearTokens = ['YY', 'YYYY'];
|
|
11903
|
-
function isProtectedDayOfYearToken(token) {
|
|
11904
|
-
return protectedDayOfYearTokens.indexOf(token) !== -1;
|
|
11905
|
-
}
|
|
11906
|
-
function isProtectedWeekYearToken(token) {
|
|
11907
|
-
return protectedWeekYearTokens.indexOf(token) !== -1;
|
|
11908
|
-
}
|
|
11909
|
-
function throwProtectedError(token, format, input) {
|
|
11910
|
-
if (token === 'YYYY') {
|
|
11911
|
-
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"));
|
|
11912
|
-
} else if (token === 'YY') {
|
|
11913
|
-
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"));
|
|
11914
|
-
} else if (token === 'D') {
|
|
11915
|
-
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"));
|
|
11916
|
-
} else if (token === 'DD') {
|
|
11917
|
-
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"));
|
|
11918
|
-
}
|
|
11919
|
-
}
|
|
11920
|
-
|
|
11921
|
-
var formatDistanceLocale = {
|
|
11922
|
-
lessThanXSeconds: {
|
|
11923
|
-
one: 'less than a second',
|
|
11924
|
-
other: 'less than {{count}} seconds'
|
|
11925
|
-
},
|
|
11926
|
-
xSeconds: {
|
|
11927
|
-
one: '1 second',
|
|
11928
|
-
other: '{{count}} seconds'
|
|
11929
|
-
},
|
|
11930
|
-
halfAMinute: 'half a minute',
|
|
11931
|
-
lessThanXMinutes: {
|
|
11932
|
-
one: 'less than a minute',
|
|
11933
|
-
other: 'less than {{count}} minutes'
|
|
11934
|
-
},
|
|
11935
|
-
xMinutes: {
|
|
11936
|
-
one: '1 minute',
|
|
11937
|
-
other: '{{count}} minutes'
|
|
11938
|
-
},
|
|
11939
|
-
aboutXHours: {
|
|
11940
|
-
one: 'about 1 hour',
|
|
11941
|
-
other: 'about {{count}} hours'
|
|
11942
|
-
},
|
|
11943
|
-
xHours: {
|
|
11944
|
-
one: '1 hour',
|
|
11945
|
-
other: '{{count}} hours'
|
|
11946
|
-
},
|
|
11947
|
-
xDays: {
|
|
11948
|
-
one: '1 day',
|
|
11949
|
-
other: '{{count}} days'
|
|
11950
|
-
},
|
|
11951
|
-
aboutXWeeks: {
|
|
11952
|
-
one: 'about 1 week',
|
|
11953
|
-
other: 'about {{count}} weeks'
|
|
11954
|
-
},
|
|
11955
|
-
xWeeks: {
|
|
11956
|
-
one: '1 week',
|
|
11957
|
-
other: '{{count}} weeks'
|
|
11958
|
-
},
|
|
11959
|
-
aboutXMonths: {
|
|
11960
|
-
one: 'about 1 month',
|
|
11961
|
-
other: 'about {{count}} months'
|
|
11962
|
-
},
|
|
11963
|
-
xMonths: {
|
|
11964
|
-
one: '1 month',
|
|
11965
|
-
other: '{{count}} months'
|
|
11966
|
-
},
|
|
11967
|
-
aboutXYears: {
|
|
11968
|
-
one: 'about 1 year',
|
|
11969
|
-
other: 'about {{count}} years'
|
|
11970
|
-
},
|
|
11971
|
-
xYears: {
|
|
11972
|
-
one: '1 year',
|
|
11973
|
-
other: '{{count}} years'
|
|
11974
|
-
},
|
|
11975
|
-
overXYears: {
|
|
11976
|
-
one: 'over 1 year',
|
|
11977
|
-
other: 'over {{count}} years'
|
|
11978
|
-
},
|
|
11979
|
-
almostXYears: {
|
|
11980
|
-
one: 'almost 1 year',
|
|
11981
|
-
other: 'almost {{count}} years'
|
|
11982
|
-
}
|
|
11983
|
-
};
|
|
11984
|
-
var formatDistance = function formatDistance(token, count, options) {
|
|
11985
|
-
var result;
|
|
11986
|
-
var tokenValue = formatDistanceLocale[token];
|
|
11987
|
-
if (typeof tokenValue === 'string') {
|
|
11988
|
-
result = tokenValue;
|
|
11989
|
-
} else if (count === 1) {
|
|
11990
|
-
result = tokenValue.one;
|
|
11991
|
-
} else {
|
|
11992
|
-
result = tokenValue.other.replace('{{count}}', count.toString());
|
|
11993
|
-
}
|
|
11994
|
-
if (options !== null && options !== void 0 && options.addSuffix) {
|
|
11995
|
-
if (options.comparison && options.comparison > 0) {
|
|
11996
|
-
return 'in ' + result;
|
|
11997
|
-
} else {
|
|
11998
|
-
return result + ' ago';
|
|
11999
|
-
}
|
|
12000
|
-
}
|
|
12001
|
-
return result;
|
|
12002
|
-
};
|
|
12003
|
-
|
|
12004
|
-
function buildFormatLongFn(args) {
|
|
12005
|
-
return function () {
|
|
12006
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
12007
|
-
// TODO: Remove String()
|
|
12008
|
-
var width = options.width ? String(options.width) : args.defaultWidth;
|
|
12009
|
-
var format = args.formats[width] || args.formats[args.defaultWidth];
|
|
12010
|
-
return format;
|
|
12011
|
-
};
|
|
12012
|
-
}
|
|
12013
|
-
|
|
12014
|
-
var dateFormats = {
|
|
12015
|
-
full: 'EEEE, MMMM do, y',
|
|
12016
|
-
"long": 'MMMM do, y',
|
|
12017
|
-
medium: 'MMM d, y',
|
|
12018
|
-
"short": 'MM/dd/yyyy'
|
|
12019
|
-
};
|
|
12020
|
-
var timeFormats = {
|
|
12021
|
-
full: 'h:mm:ss a zzzz',
|
|
12022
|
-
"long": 'h:mm:ss a z',
|
|
12023
|
-
medium: 'h:mm:ss a',
|
|
12024
|
-
"short": 'h:mm a'
|
|
12025
|
-
};
|
|
12026
|
-
var dateTimeFormats = {
|
|
12027
|
-
full: "{{date}} 'at' {{time}}",
|
|
12028
|
-
"long": "{{date}} 'at' {{time}}",
|
|
12029
|
-
medium: '{{date}}, {{time}}',
|
|
12030
|
-
"short": '{{date}}, {{time}}'
|
|
12031
|
-
};
|
|
12032
|
-
var formatLong = {
|
|
12033
|
-
date: buildFormatLongFn({
|
|
12034
|
-
formats: dateFormats,
|
|
12035
|
-
defaultWidth: 'full'
|
|
12036
|
-
}),
|
|
12037
|
-
time: buildFormatLongFn({
|
|
12038
|
-
formats: timeFormats,
|
|
12039
|
-
defaultWidth: 'full'
|
|
12040
|
-
}),
|
|
12041
|
-
dateTime: buildFormatLongFn({
|
|
12042
|
-
formats: dateTimeFormats,
|
|
12043
|
-
defaultWidth: 'full'
|
|
12044
|
-
})
|
|
12045
|
-
};
|
|
12046
|
-
|
|
12047
|
-
var formatRelativeLocale = {
|
|
12048
|
-
lastWeek: "'last' eeee 'at' p",
|
|
12049
|
-
yesterday: "'yesterday at' p",
|
|
12050
|
-
today: "'today at' p",
|
|
12051
|
-
tomorrow: "'tomorrow at' p",
|
|
12052
|
-
nextWeek: "eeee 'at' p",
|
|
12053
|
-
other: 'P'
|
|
12054
|
-
};
|
|
12055
|
-
var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
|
|
12056
|
-
return formatRelativeLocale[token];
|
|
12057
|
-
};
|
|
12058
|
-
|
|
12059
|
-
function buildLocalizeFn(args) {
|
|
12060
|
-
return function (dirtyIndex, options) {
|
|
12061
|
-
var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
|
|
12062
|
-
var valuesArray;
|
|
12063
|
-
if (context === 'formatting' && args.formattingValues) {
|
|
12064
|
-
var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
|
12065
|
-
var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
|
|
12066
|
-
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
|
12067
|
-
} else {
|
|
12068
|
-
var _defaultWidth = args.defaultWidth;
|
|
12069
|
-
var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
|
|
12070
|
-
valuesArray = args.values[_width] || args.values[_defaultWidth];
|
|
12071
|
-
}
|
|
12072
|
-
var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
|
|
12073
|
-
// @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!
|
|
12074
|
-
return valuesArray[index];
|
|
12075
|
-
};
|
|
12076
|
-
}
|
|
12077
|
-
|
|
12078
|
-
var eraValues = {
|
|
12079
|
-
narrow: ['B', 'A'],
|
|
12080
|
-
abbreviated: ['BC', 'AD'],
|
|
12081
|
-
wide: ['Before Christ', 'Anno Domini']
|
|
12082
|
-
};
|
|
12083
|
-
var quarterValues = {
|
|
12084
|
-
narrow: ['1', '2', '3', '4'],
|
|
12085
|
-
abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
|
|
12086
|
-
wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
|
|
12087
|
-
};
|
|
12088
|
-
|
|
12089
|
-
// Note: in English, the names of days of the week and months are capitalized.
|
|
12090
|
-
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
|
|
12091
|
-
// Generally, formatted dates should look like they are in the middle of a sentence,
|
|
12092
|
-
// e.g. in Spanish language the weekdays and months should be in the lowercase.
|
|
12093
|
-
var monthValues = {
|
|
12094
|
-
narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
|
|
12095
|
-
abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
12096
|
-
wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
|
|
12097
|
-
};
|
|
12098
|
-
var dayValues = {
|
|
12099
|
-
narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
|
|
12100
|
-
"short": ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
12101
|
-
abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
12102
|
-
wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
|
|
12103
|
-
};
|
|
12104
|
-
var dayPeriodValues = {
|
|
12105
|
-
narrow: {
|
|
12106
|
-
am: 'a',
|
|
12107
|
-
pm: 'p',
|
|
12108
|
-
midnight: 'mi',
|
|
12109
|
-
noon: 'n',
|
|
12110
|
-
morning: 'morning',
|
|
12111
|
-
afternoon: 'afternoon',
|
|
12112
|
-
evening: 'evening',
|
|
12113
|
-
night: 'night'
|
|
12114
|
-
},
|
|
12115
|
-
abbreviated: {
|
|
12116
|
-
am: 'AM',
|
|
12117
|
-
pm: 'PM',
|
|
12118
|
-
midnight: 'midnight',
|
|
12119
|
-
noon: 'noon',
|
|
12120
|
-
morning: 'morning',
|
|
12121
|
-
afternoon: 'afternoon',
|
|
12122
|
-
evening: 'evening',
|
|
12123
|
-
night: 'night'
|
|
12124
|
-
},
|
|
12125
|
-
wide: {
|
|
12126
|
-
am: 'a.m.',
|
|
12127
|
-
pm: 'p.m.',
|
|
12128
|
-
midnight: 'midnight',
|
|
12129
|
-
noon: 'noon',
|
|
12130
|
-
morning: 'morning',
|
|
12131
|
-
afternoon: 'afternoon',
|
|
12132
|
-
evening: 'evening',
|
|
12133
|
-
night: 'night'
|
|
12134
|
-
}
|
|
12135
|
-
};
|
|
12136
|
-
var formattingDayPeriodValues = {
|
|
12137
|
-
narrow: {
|
|
12138
|
-
am: 'a',
|
|
12139
|
-
pm: 'p',
|
|
12140
|
-
midnight: 'mi',
|
|
12141
|
-
noon: 'n',
|
|
12142
|
-
morning: 'in the morning',
|
|
12143
|
-
afternoon: 'in the afternoon',
|
|
12144
|
-
evening: 'in the evening',
|
|
12145
|
-
night: 'at night'
|
|
12146
|
-
},
|
|
12147
|
-
abbreviated: {
|
|
12148
|
-
am: 'AM',
|
|
12149
|
-
pm: 'PM',
|
|
12150
|
-
midnight: 'midnight',
|
|
12151
|
-
noon: 'noon',
|
|
12152
|
-
morning: 'in the morning',
|
|
12153
|
-
afternoon: 'in the afternoon',
|
|
12154
|
-
evening: 'in the evening',
|
|
12155
|
-
night: 'at night'
|
|
12156
|
-
},
|
|
12157
|
-
wide: {
|
|
12158
|
-
am: 'a.m.',
|
|
12159
|
-
pm: 'p.m.',
|
|
12160
|
-
midnight: 'midnight',
|
|
12161
|
-
noon: 'noon',
|
|
12162
|
-
morning: 'in the morning',
|
|
12163
|
-
afternoon: 'in the afternoon',
|
|
12164
|
-
evening: 'in the evening',
|
|
12165
|
-
night: 'at night'
|
|
12166
|
-
}
|
|
12167
|
-
};
|
|
12168
|
-
var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
|
|
12169
|
-
var number = Number(dirtyNumber);
|
|
12170
|
-
|
|
12171
|
-
// If ordinal numbers depend on context, for example,
|
|
12172
|
-
// if they are different for different grammatical genders,
|
|
12173
|
-
// use `options.unit`.
|
|
12174
|
-
//
|
|
12175
|
-
// `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
|
|
12176
|
-
// 'day', 'hour', 'minute', 'second'.
|
|
12177
|
-
|
|
12178
|
-
var rem100 = number % 100;
|
|
12179
|
-
if (rem100 > 20 || rem100 < 10) {
|
|
12180
|
-
switch (rem100 % 10) {
|
|
12181
|
-
case 1:
|
|
12182
|
-
return number + 'st';
|
|
12183
|
-
case 2:
|
|
12184
|
-
return number + 'nd';
|
|
12185
|
-
case 3:
|
|
12186
|
-
return number + 'rd';
|
|
12187
|
-
}
|
|
12188
|
-
}
|
|
12189
|
-
return number + 'th';
|
|
12190
|
-
};
|
|
12191
|
-
var localize = {
|
|
12192
|
-
ordinalNumber: ordinalNumber,
|
|
12193
|
-
era: buildLocalizeFn({
|
|
12194
|
-
values: eraValues,
|
|
12195
|
-
defaultWidth: 'wide'
|
|
12196
|
-
}),
|
|
12197
|
-
quarter: buildLocalizeFn({
|
|
12198
|
-
values: quarterValues,
|
|
12199
|
-
defaultWidth: 'wide',
|
|
12200
|
-
argumentCallback: function argumentCallback(quarter) {
|
|
12201
|
-
return quarter - 1;
|
|
12202
|
-
}
|
|
12203
|
-
}),
|
|
12204
|
-
month: buildLocalizeFn({
|
|
12205
|
-
values: monthValues,
|
|
12206
|
-
defaultWidth: 'wide'
|
|
12207
|
-
}),
|
|
12208
|
-
day: buildLocalizeFn({
|
|
12209
|
-
values: dayValues,
|
|
12210
|
-
defaultWidth: 'wide'
|
|
12211
|
-
}),
|
|
12212
|
-
dayPeriod: buildLocalizeFn({
|
|
12213
|
-
values: dayPeriodValues,
|
|
12214
|
-
defaultWidth: 'wide',
|
|
12215
|
-
formattingValues: formattingDayPeriodValues,
|
|
12216
|
-
defaultFormattingWidth: 'wide'
|
|
12217
|
-
})
|
|
12218
|
-
};
|
|
12219
|
-
|
|
12220
|
-
function buildMatchFn(args) {
|
|
12221
|
-
return function (string) {
|
|
12222
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
12223
|
-
var width = options.width;
|
|
12224
|
-
var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
|
12225
|
-
var matchResult = string.match(matchPattern);
|
|
12226
|
-
if (!matchResult) {
|
|
12227
|
-
return null;
|
|
12228
|
-
}
|
|
12229
|
-
var matchedString = matchResult[0];
|
|
12230
|
-
var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
|
12231
|
-
var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
|
|
12232
|
-
return pattern.test(matchedString);
|
|
12233
|
-
}) : findKey(parsePatterns, function (pattern) {
|
|
12234
|
-
return pattern.test(matchedString);
|
|
12235
|
-
});
|
|
12236
|
-
var value;
|
|
12237
|
-
value = args.valueCallback ? args.valueCallback(key) : key;
|
|
12238
|
-
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
12239
|
-
var rest = string.slice(matchedString.length);
|
|
12240
|
-
return {
|
|
12241
|
-
value: value,
|
|
12242
|
-
rest: rest
|
|
12243
|
-
};
|
|
12244
|
-
};
|
|
12245
|
-
}
|
|
12246
|
-
function findKey(object, predicate) {
|
|
12247
|
-
for (var key in object) {
|
|
12248
|
-
if (object.hasOwnProperty(key) && predicate(object[key])) {
|
|
12249
|
-
return key;
|
|
12272
|
+
return 'GMT' + formatTimezone(timezoneOffset, ':');
|
|
12273
|
+
}
|
|
12274
|
+
},
|
|
12275
|
+
// Timezone (specific non-location)
|
|
12276
|
+
z: function z(date, token, _localize, options) {
|
|
12277
|
+
var originalDate = options._originalDate || date;
|
|
12278
|
+
var timezoneOffset = originalDate.getTimezoneOffset();
|
|
12279
|
+
switch (token) {
|
|
12280
|
+
// Short
|
|
12281
|
+
case 'z':
|
|
12282
|
+
case 'zz':
|
|
12283
|
+
case 'zzz':
|
|
12284
|
+
return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
|
|
12285
|
+
// Long
|
|
12286
|
+
|
|
12287
|
+
case 'zzzz':
|
|
12288
|
+
default:
|
|
12289
|
+
return 'GMT' + formatTimezone(timezoneOffset, ':');
|
|
12250
12290
|
}
|
|
12291
|
+
},
|
|
12292
|
+
// Seconds timestamp
|
|
12293
|
+
t: function t(date, token, _localize, options) {
|
|
12294
|
+
var originalDate = options._originalDate || date;
|
|
12295
|
+
var timestamp = Math.floor(originalDate.getTime() / 1000);
|
|
12296
|
+
return addLeadingZeros(timestamp, token.length);
|
|
12297
|
+
},
|
|
12298
|
+
// Milliseconds timestamp
|
|
12299
|
+
T: function T(date, token, _localize, options) {
|
|
12300
|
+
var originalDate = options._originalDate || date;
|
|
12301
|
+
var timestamp = originalDate.getTime();
|
|
12302
|
+
return addLeadingZeros(timestamp, token.length);
|
|
12251
12303
|
}
|
|
12252
|
-
|
|
12304
|
+
};
|
|
12305
|
+
function formatTimezoneShort(offset, dirtyDelimiter) {
|
|
12306
|
+
var sign = offset > 0 ? '-' : '+';
|
|
12307
|
+
var absOffset = Math.abs(offset);
|
|
12308
|
+
var hours = Math.floor(absOffset / 60);
|
|
12309
|
+
var minutes = absOffset % 60;
|
|
12310
|
+
if (minutes === 0) {
|
|
12311
|
+
return sign + String(hours);
|
|
12312
|
+
}
|
|
12313
|
+
var delimiter = dirtyDelimiter;
|
|
12314
|
+
return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
|
|
12253
12315
|
}
|
|
12254
|
-
function
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
}
|
|
12316
|
+
function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
|
|
12317
|
+
if (offset % 60 === 0) {
|
|
12318
|
+
var sign = offset > 0 ? '-' : '+';
|
|
12319
|
+
return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
|
|
12259
12320
|
}
|
|
12260
|
-
return
|
|
12321
|
+
return formatTimezone(offset, dirtyDelimiter);
|
|
12261
12322
|
}
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
|
|
12265
|
-
|
|
12266
|
-
|
|
12267
|
-
|
|
12268
|
-
|
|
12269
|
-
var parseResult = string.match(args.parsePattern);
|
|
12270
|
-
if (!parseResult) return null;
|
|
12271
|
-
var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
|
12272
|
-
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
12273
|
-
var rest = string.slice(matchedString.length);
|
|
12274
|
-
return {
|
|
12275
|
-
value: value,
|
|
12276
|
-
rest: rest
|
|
12277
|
-
};
|
|
12278
|
-
};
|
|
12323
|
+
function formatTimezone(offset, dirtyDelimiter) {
|
|
12324
|
+
var delimiter = dirtyDelimiter || '';
|
|
12325
|
+
var sign = offset > 0 ? '-' : '+';
|
|
12326
|
+
var absOffset = Math.abs(offset);
|
|
12327
|
+
var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
|
|
12328
|
+
var minutes = addLeadingZeros(absOffset % 60, 2);
|
|
12329
|
+
return sign + hours + delimiter + minutes;
|
|
12279
12330
|
}
|
|
12280
12331
|
|
|
12281
|
-
|
|
12282
|
-
|
|
12283
|
-
|
|
12284
|
-
|
|
12285
|
-
|
|
12286
|
-
|
|
12287
|
-
|
|
12288
|
-
|
|
12289
|
-
|
|
12290
|
-
};
|
|
12291
|
-
|
|
12292
|
-
|
|
12293
|
-
|
|
12294
|
-
|
|
12295
|
-
|
|
12296
|
-
|
|
12297
|
-
|
|
12298
|
-
|
|
12299
|
-
|
|
12300
|
-
narrow: /^[jfmasond]/i,
|
|
12301
|
-
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
12302
|
-
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
12303
|
-
};
|
|
12304
|
-
var parseMonthPatterns = {
|
|
12305
|
-
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],
|
|
12306
|
-
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]
|
|
12307
|
-
};
|
|
12308
|
-
var matchDayPatterns = {
|
|
12309
|
-
narrow: /^[smtwf]/i,
|
|
12310
|
-
"short": /^(su|mo|tu|we|th|fr|sa)/i,
|
|
12311
|
-
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
12312
|
-
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
12313
|
-
};
|
|
12314
|
-
var parseDayPatterns = {
|
|
12315
|
-
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
12316
|
-
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
12317
|
-
};
|
|
12318
|
-
var matchDayPeriodPatterns = {
|
|
12319
|
-
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
12320
|
-
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
12321
|
-
};
|
|
12322
|
-
var parseDayPeriodPatterns = {
|
|
12323
|
-
any: {
|
|
12324
|
-
am: /^a/i,
|
|
12325
|
-
pm: /^p/i,
|
|
12326
|
-
midnight: /^mi/i,
|
|
12327
|
-
noon: /^no/i,
|
|
12328
|
-
morning: /morning/i,
|
|
12329
|
-
afternoon: /afternoon/i,
|
|
12330
|
-
evening: /evening/i,
|
|
12331
|
-
night: /night/i
|
|
12332
|
+
function dateLongFormatter(pattern, formatLong) {
|
|
12333
|
+
switch (pattern) {
|
|
12334
|
+
case 'P':
|
|
12335
|
+
return formatLong.date({
|
|
12336
|
+
width: 'short'
|
|
12337
|
+
});
|
|
12338
|
+
case 'PP':
|
|
12339
|
+
return formatLong.date({
|
|
12340
|
+
width: 'medium'
|
|
12341
|
+
});
|
|
12342
|
+
case 'PPP':
|
|
12343
|
+
return formatLong.date({
|
|
12344
|
+
width: 'long'
|
|
12345
|
+
});
|
|
12346
|
+
case 'PPPP':
|
|
12347
|
+
default:
|
|
12348
|
+
return formatLong.date({
|
|
12349
|
+
width: 'full'
|
|
12350
|
+
});
|
|
12332
12351
|
}
|
|
12333
|
-
}
|
|
12334
|
-
|
|
12335
|
-
|
|
12336
|
-
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
|
|
12343
|
-
|
|
12344
|
-
|
|
12345
|
-
|
|
12346
|
-
|
|
12347
|
-
|
|
12348
|
-
|
|
12349
|
-
|
|
12350
|
-
|
|
12351
|
-
|
|
12352
|
-
|
|
12353
|
-
|
|
12354
|
-
|
|
12355
|
-
|
|
12356
|
-
|
|
12357
|
-
|
|
12358
|
-
|
|
12359
|
-
|
|
12360
|
-
|
|
12361
|
-
|
|
12362
|
-
|
|
12363
|
-
|
|
12364
|
-
|
|
12365
|
-
|
|
12366
|
-
|
|
12367
|
-
|
|
12368
|
-
|
|
12369
|
-
|
|
12370
|
-
|
|
12371
|
-
|
|
12372
|
-
|
|
12373
|
-
|
|
12374
|
-
|
|
12352
|
+
}
|
|
12353
|
+
function timeLongFormatter(pattern, formatLong) {
|
|
12354
|
+
switch (pattern) {
|
|
12355
|
+
case 'p':
|
|
12356
|
+
return formatLong.time({
|
|
12357
|
+
width: 'short'
|
|
12358
|
+
});
|
|
12359
|
+
case 'pp':
|
|
12360
|
+
return formatLong.time({
|
|
12361
|
+
width: 'medium'
|
|
12362
|
+
});
|
|
12363
|
+
case 'ppp':
|
|
12364
|
+
return formatLong.time({
|
|
12365
|
+
width: 'long'
|
|
12366
|
+
});
|
|
12367
|
+
case 'pppp':
|
|
12368
|
+
default:
|
|
12369
|
+
return formatLong.time({
|
|
12370
|
+
width: 'full'
|
|
12371
|
+
});
|
|
12372
|
+
}
|
|
12373
|
+
}
|
|
12374
|
+
function dateTimeLongFormatter(pattern, formatLong) {
|
|
12375
|
+
var matchResult = pattern.match(/(P+)(p+)?/);
|
|
12376
|
+
var datePattern = matchResult[1];
|
|
12377
|
+
var timePattern = matchResult[2];
|
|
12378
|
+
if (!timePattern) {
|
|
12379
|
+
return dateLongFormatter(pattern, formatLong);
|
|
12380
|
+
}
|
|
12381
|
+
var dateTimeFormat;
|
|
12382
|
+
switch (datePattern) {
|
|
12383
|
+
case 'P':
|
|
12384
|
+
dateTimeFormat = formatLong.dateTime({
|
|
12385
|
+
width: 'short'
|
|
12386
|
+
});
|
|
12387
|
+
break;
|
|
12388
|
+
case 'PP':
|
|
12389
|
+
dateTimeFormat = formatLong.dateTime({
|
|
12390
|
+
width: 'medium'
|
|
12391
|
+
});
|
|
12392
|
+
break;
|
|
12393
|
+
case 'PPP':
|
|
12394
|
+
dateTimeFormat = formatLong.dateTime({
|
|
12395
|
+
width: 'long'
|
|
12396
|
+
});
|
|
12397
|
+
break;
|
|
12398
|
+
case 'PPPP':
|
|
12399
|
+
default:
|
|
12400
|
+
dateTimeFormat = formatLong.dateTime({
|
|
12401
|
+
width: 'full'
|
|
12402
|
+
});
|
|
12403
|
+
break;
|
|
12404
|
+
}
|
|
12405
|
+
return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
|
|
12406
|
+
}
|
|
12407
|
+
var longFormatters = {
|
|
12408
|
+
p: timeLongFormatter,
|
|
12409
|
+
P: dateTimeLongFormatter
|
|
12375
12410
|
};
|
|
12376
12411
|
|
|
12412
|
+
var MILLISECONDS_IN_MINUTE = 60000;
|
|
12413
|
+
function getDateMillisecondsPart(date) {
|
|
12414
|
+
return date.getTime() % MILLISECONDS_IN_MINUTE;
|
|
12415
|
+
}
|
|
12377
12416
|
/**
|
|
12378
|
-
*
|
|
12379
|
-
*
|
|
12380
|
-
*
|
|
12381
|
-
*
|
|
12382
|
-
*
|
|
12383
|
-
*
|
|
12384
|
-
*
|
|
12417
|
+
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
|
|
12418
|
+
* They usually appear for dates that denote time before the timezones were introduced
|
|
12419
|
+
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
|
|
12420
|
+
* and GMT+01:00:00 after that date)
|
|
12421
|
+
*
|
|
12422
|
+
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
|
|
12423
|
+
* which would lead to incorrect calculations.
|
|
12424
|
+
*
|
|
12425
|
+
* This function returns the timezone offset in milliseconds that takes seconds in account.
|
|
12385
12426
|
*/
|
|
12386
|
-
|
|
12387
|
-
|
|
12388
|
-
|
|
12389
|
-
|
|
12390
|
-
|
|
12391
|
-
|
|
12392
|
-
|
|
12393
|
-
|
|
12394
|
-
|
|
12395
|
-
|
|
12427
|
+
|
|
12428
|
+
function getTimezoneOffsetInMilliseconds(dirtyDate) {
|
|
12429
|
+
var date = new Date(dirtyDate.getTime());
|
|
12430
|
+
var baseTimezoneOffset = Math.ceil(date.getTimezoneOffset());
|
|
12431
|
+
date.setSeconds(0, 0);
|
|
12432
|
+
var hasNegativeUTCOffset = baseTimezoneOffset > 0;
|
|
12433
|
+
var millisecondsPartOfTimezoneOffset = hasNegativeUTCOffset ? (MILLISECONDS_IN_MINUTE + getDateMillisecondsPart(date)) % MILLISECONDS_IN_MINUTE : getDateMillisecondsPart(date);
|
|
12434
|
+
return baseTimezoneOffset * MILLISECONDS_IN_MINUTE + millisecondsPartOfTimezoneOffset;
|
|
12435
|
+
}
|
|
12436
|
+
|
|
12437
|
+
var protectedDayOfYearTokens = ['D', 'DD'];
|
|
12438
|
+
var protectedWeekYearTokens = ['YY', 'YYYY'];
|
|
12439
|
+
function isProtectedDayOfYearToken(token) {
|
|
12440
|
+
return protectedDayOfYearTokens.indexOf(token) !== -1;
|
|
12441
|
+
}
|
|
12442
|
+
function isProtectedWeekYearToken(token) {
|
|
12443
|
+
return protectedWeekYearTokens.indexOf(token) !== -1;
|
|
12444
|
+
}
|
|
12445
|
+
function throwProtectedError(token, format, input) {
|
|
12446
|
+
if (token === 'YYYY') {
|
|
12447
|
+
throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
|
|
12448
|
+
} else if (token === 'YY') {
|
|
12449
|
+
throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
|
|
12450
|
+
} else if (token === 'D') {
|
|
12451
|
+
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"));
|
|
12452
|
+
} else if (token === 'DD') {
|
|
12453
|
+
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"));
|
|
12396
12454
|
}
|
|
12397
|
-
}
|
|
12455
|
+
}
|
|
12398
12456
|
|
|
12399
12457
|
// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
|
|
12400
12458
|
// (one of the certain letters followed by `o`)
|
|
@@ -12406,15 +12464,14 @@ var locale = {
|
|
|
12406
12464
|
// If there is no matching single quote
|
|
12407
12465
|
// then the sequence will continue until the end of the string.
|
|
12408
12466
|
// - . matches any single character unmatched by previous parts of the RegExps
|
|
12409
|
-
var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
|
12410
12467
|
|
|
12411
|
-
// This RegExp catches symbols escaped by quotes, and also
|
|
12468
|
+
var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also
|
|
12412
12469
|
// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
|
|
12470
|
+
|
|
12413
12471
|
var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
12414
12472
|
var escapedStringRegExp = /^'([^]*?)'?$/;
|
|
12415
12473
|
var doubleQuoteRegExp = /''/g;
|
|
12416
12474
|
var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
12417
|
-
|
|
12418
12475
|
/**
|
|
12419
12476
|
* @name format
|
|
12420
12477
|
* @category Common Helpers
|
|
@@ -12424,7 +12481,7 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
|
12424
12481
|
* Return the formatted date string in the given format. The result may vary by locale.
|
|
12425
12482
|
*
|
|
12426
12483
|
* > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
|
|
12427
|
-
* > See: https://
|
|
12484
|
+
* > See: https://git.io/fxCyr
|
|
12428
12485
|
*
|
|
12429
12486
|
* The characters wrapped between two single quotes characters (') are escaped.
|
|
12430
12487
|
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
|
|
@@ -12503,34 +12560,32 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
|
12503
12560
|
* | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
|
|
12504
12561
|
* | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
|
|
12505
12562
|
* | | EEEEE | M, T, W, T, F, S, S | |
|
|
12506
|
-
* | | EEEEEE | Mo, Tu, We, Th, Fr,
|
|
12563
|
+
* | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |
|
|
12507
12564
|
* | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
|
|
12508
12565
|
* | | io | 1st, 2nd, ..., 7th | 7 |
|
|
12509
12566
|
* | | ii | 01, 02, ..., 07 | 7 |
|
|
12510
12567
|
* | | iii | Mon, Tue, Wed, ..., Sun | 7 |
|
|
12511
12568
|
* | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
|
|
12512
12569
|
* | | iiiii | M, T, W, T, F, S, S | 7 |
|
|
12513
|
-
* | | iiiiii | Mo, Tu, We, Th, Fr,
|
|
12570
|
+
* | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 |
|
|
12514
12571
|
* | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
|
|
12515
12572
|
* | | eo | 2nd, 3rd, ..., 1st | 7 |
|
|
12516
12573
|
* | | ee | 02, 03, ..., 01 | |
|
|
12517
12574
|
* | | eee | Mon, Tue, Wed, ..., Sun | |
|
|
12518
12575
|
* | | eeee | Monday, Tuesday, ..., Sunday | 2 |
|
|
12519
12576
|
* | | eeeee | M, T, W, T, F, S, S | |
|
|
12520
|
-
* | | eeeeee | Mo, Tu, We, Th, Fr,
|
|
12577
|
+
* | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |
|
|
12521
12578
|
* | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
|
|
12522
12579
|
* | | co | 2nd, 3rd, ..., 1st | 7 |
|
|
12523
12580
|
* | | cc | 02, 03, ..., 01 | |
|
|
12524
12581
|
* | | ccc | Mon, Tue, Wed, ..., Sun | |
|
|
12525
12582
|
* | | cccc | Monday, Tuesday, ..., Sunday | 2 |
|
|
12526
12583
|
* | | ccccc | M, T, W, T, F, S, S | |
|
|
12527
|
-
* | | cccccc | Mo, Tu, We, Th, Fr,
|
|
12528
|
-
* | AM, PM | a..
|
|
12529
|
-
* | | aaa | am, pm | |
|
|
12584
|
+
* | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |
|
|
12585
|
+
* | AM, PM | a..aaa | AM, PM | |
|
|
12530
12586
|
* | | aaaa | a.m., p.m. | 2 |
|
|
12531
12587
|
* | | aaaaa | a, p | |
|
|
12532
|
-
* | AM, PM, noon, midnight | b..
|
|
12533
|
-
* | | bbb | am, pm, noon, midnight | |
|
|
12588
|
+
* | AM, PM, noon, midnight | b..bbb | AM, PM, noon, midnight | |
|
|
12534
12589
|
* | | bbbb | a.m., p.m., noon, midnight | 2 |
|
|
12535
12590
|
* | | bbbbb | a, p, n, mi | |
|
|
12536
12591
|
* | Flexible day period | B..BBB | at night, in the morning, ... | |
|
|
@@ -12556,7 +12611,7 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
|
12556
12611
|
* | | ss | 00, 01, ..., 59 | |
|
|
12557
12612
|
* | Fraction of second | S | 0, 1, ..., 9 | |
|
|
12558
12613
|
* | | SS | 00, 01, ..., 99 | |
|
|
12559
|
-
* | | SSS | 000,
|
|
12614
|
+
* | | SSS | 000, 0001, ..., 999 | |
|
|
12560
12615
|
* | | SSSS | ... | 3 |
|
|
12561
12616
|
* | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
|
|
12562
12617
|
* | | XX | -0800, +0530, Z | |
|
|
@@ -12576,18 +12631,18 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
|
12576
12631
|
* | | tt | ... | 3,7 |
|
|
12577
12632
|
* | Milliseconds timestamp | T | 512969520900 | 7 |
|
|
12578
12633
|
* | | TT | ... | 3,7 |
|
|
12579
|
-
* | Long localized date | P |
|
|
12580
|
-
* | | PP |
|
|
12581
|
-
* | | PPP |
|
|
12582
|
-
* | | PPPP |
|
|
12634
|
+
* | Long localized date | P | 05/29/1453 | 7 |
|
|
12635
|
+
* | | PP | May 29, 1453 | 7 |
|
|
12636
|
+
* | | PPP | May 29th, 1453 | 7 |
|
|
12637
|
+
* | | PPPP | Sunday, May 29th, 1453 | 2,7 |
|
|
12583
12638
|
* | Long localized time | p | 12:00 AM | 7 |
|
|
12584
12639
|
* | | pp | 12:00:00 AM | 7 |
|
|
12585
12640
|
* | | ppp | 12:00:00 AM GMT+2 | 7 |
|
|
12586
12641
|
* | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
|
|
12587
|
-
* | Combination of date and time | Pp |
|
|
12588
|
-
* | | PPpp |
|
|
12589
|
-
* | | PPPppp |
|
|
12590
|
-
* | | PPPPpppp|
|
|
12642
|
+
* | Combination of date and time | Pp | 05/29/1453, 12:00 AM | 7 |
|
|
12643
|
+
* | | PPpp | May 29, 1453, 12:00:00 AM | 7 |
|
|
12644
|
+
* | | PPPppp | May 29th, 1453 at ... | 7 |
|
|
12645
|
+
* | | PPPPpppp| Sunday, May 29th, 1453 at ... | 2,7 |
|
|
12591
12646
|
* Notes:
|
|
12592
12647
|
* 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
|
|
12593
12648
|
* are the same as "stand-alone" units, but are different in some languages.
|
|
@@ -12660,10 +12715,30 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
|
12660
12715
|
* - `p`: long localized time
|
|
12661
12716
|
*
|
|
12662
12717
|
* 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
|
|
12663
|
-
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://
|
|
12718
|
+
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://git.io/fxCyr
|
|
12719
|
+
*
|
|
12720
|
+
* 9. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.
|
|
12721
|
+
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://git.io/fxCyr
|
|
12722
|
+
*
|
|
12723
|
+
* ### v2.0.0 breaking changes:
|
|
12724
|
+
*
|
|
12725
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
12726
|
+
*
|
|
12727
|
+
* - The second argument is now required for the sake of explicitness.
|
|
12664
12728
|
*
|
|
12665
|
-
*
|
|
12666
|
-
*
|
|
12729
|
+
* ```javascript
|
|
12730
|
+
* // Before v2.0.0
|
|
12731
|
+
* format(new Date(2016, 0, 1))
|
|
12732
|
+
*
|
|
12733
|
+
* // v2.0.0 onward
|
|
12734
|
+
* format(new Date(2016, 0, 1), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")
|
|
12735
|
+
* ```
|
|
12736
|
+
*
|
|
12737
|
+
* - New format string API for `format` function
|
|
12738
|
+
* which is based on [Unicode Technical Standard #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).
|
|
12739
|
+
* See [this post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.
|
|
12740
|
+
*
|
|
12741
|
+
* - Characters are now escaped using single quote symbols (`'`) instead of square brackets.
|
|
12667
12742
|
*
|
|
12668
12743
|
* @param {Date|Number} date - the original date
|
|
12669
12744
|
* @param {String} format - the string of tokens
|
|
@@ -12672,9 +12747,9 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
|
12672
12747
|
* @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
|
|
12673
12748
|
* @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
|
|
12674
12749
|
* @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
|
|
12675
|
-
* see: https://
|
|
12750
|
+
* see: https://git.io/fxCyr
|
|
12676
12751
|
* @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
|
|
12677
|
-
* see: https://
|
|
12752
|
+
* see: https://git.io/fxCyr
|
|
12678
12753
|
* @returns {String} the formatted date string
|
|
12679
12754
|
* @throws {TypeError} 2 arguments required
|
|
12680
12755
|
* @throws {RangeError} `date` must not be Invalid Date
|
|
@@ -12682,46 +12757,47 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
|
12682
12757
|
* @throws {RangeError} `options.locale` must contain `formatLong` property
|
|
12683
12758
|
* @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
|
|
12684
12759
|
* @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
|
|
12685
|
-
* @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://
|
|
12686
|
-
* @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://
|
|
12687
|
-
* @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://
|
|
12688
|
-
* @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://
|
|
12760
|
+
* @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
|
|
12761
|
+
* @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
|
|
12762
|
+
* @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
|
|
12763
|
+
* @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
|
|
12689
12764
|
* @throws {RangeError} format string contains an unescaped latin alphabet character
|
|
12690
12765
|
*
|
|
12691
12766
|
* @example
|
|
12692
12767
|
* // Represent 11 February 2014 in middle-endian format:
|
|
12693
|
-
*
|
|
12768
|
+
* var result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
|
|
12694
12769
|
* //=> '02/11/2014'
|
|
12695
12770
|
*
|
|
12696
12771
|
* @example
|
|
12697
12772
|
* // Represent 2 July 2014 in Esperanto:
|
|
12698
12773
|
* import { eoLocale } from 'date-fns/locale/eo'
|
|
12699
|
-
*
|
|
12774
|
+
* var result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
|
|
12700
12775
|
* locale: eoLocale
|
|
12701
12776
|
* })
|
|
12702
12777
|
* //=> '2-a de julio 2014'
|
|
12703
12778
|
*
|
|
12704
12779
|
* @example
|
|
12705
12780
|
* // Escape string by single quote characters:
|
|
12706
|
-
*
|
|
12781
|
+
* var result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
|
|
12707
12782
|
* //=> "3 o'clock"
|
|
12708
12783
|
*/
|
|
12709
12784
|
|
|
12710
|
-
function format(dirtyDate, dirtyFormatStr,
|
|
12711
|
-
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;
|
|
12785
|
+
function format$1(dirtyDate, dirtyFormatStr, dirtyOptions) {
|
|
12712
12786
|
requiredArgs(2, arguments);
|
|
12713
12787
|
var formatStr = String(dirtyFormatStr);
|
|
12714
|
-
var
|
|
12715
|
-
var locale$1 =
|
|
12716
|
-
var
|
|
12788
|
+
var options = dirtyOptions || {};
|
|
12789
|
+
var locale$1 = options.locale || locale;
|
|
12790
|
+
var localeFirstWeekContainsDate = locale$1.options && locale$1.options.firstWeekContainsDate;
|
|
12791
|
+
var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
|
|
12792
|
+
var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
|
|
12717
12793
|
|
|
12718
|
-
// Test if weekStartsOn is between 1 and 7 _and_ is not NaN
|
|
12719
12794
|
if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
|
|
12720
12795
|
throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
|
|
12721
12796
|
}
|
|
12722
|
-
var
|
|
12797
|
+
var localeWeekStartsOn = locale$1.options && locale$1.options.weekStartsOn;
|
|
12798
|
+
var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
|
|
12799
|
+
var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
|
|
12723
12800
|
|
|
12724
|
-
// Test if weekStartsOn is between 0 and 6 _and_ is not NaN
|
|
12725
12801
|
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
|
|
12726
12802
|
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
|
|
12727
12803
|
}
|
|
@@ -12734,11 +12810,10 @@ function format(dirtyDate, dirtyFormatStr, options) {
|
|
|
12734
12810
|
var originalDate = toDate(dirtyDate);
|
|
12735
12811
|
if (!isValid(originalDate)) {
|
|
12736
12812
|
throw new RangeError('Invalid time value');
|
|
12737
|
-
}
|
|
12738
|
-
|
|
12739
|
-
// Convert the date in system timezone to the same date in UTC+00:00 timezone.
|
|
12813
|
+
} // Convert the date in system timezone to the same date in UTC+00:00 timezone.
|
|
12740
12814
|
// This ensures that when UTC functions will be implemented, locales will be compatible with them.
|
|
12741
12815
|
// See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
|
|
12816
|
+
|
|
12742
12817
|
var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
|
|
12743
12818
|
var utcDate = subMilliseconds(originalDate, timezoneOffset);
|
|
12744
12819
|
var formatterOptions = {
|
|
@@ -12751,7 +12826,7 @@ function format(dirtyDate, dirtyFormatStr, options) {
|
|
|
12751
12826
|
var firstCharacter = substring[0];
|
|
12752
12827
|
if (firstCharacter === 'p' || firstCharacter === 'P') {
|
|
12753
12828
|
var longFormatter = longFormatters[firstCharacter];
|
|
12754
|
-
return longFormatter(substring, locale$1.formatLong);
|
|
12829
|
+
return longFormatter(substring, locale$1.formatLong, formatterOptions);
|
|
12755
12830
|
}
|
|
12756
12831
|
return substring;
|
|
12757
12832
|
}).join('').match(formattingTokensRegExp).map(function (substring) {
|
|
@@ -12765,11 +12840,11 @@ function format(dirtyDate, dirtyFormatStr, options) {
|
|
|
12765
12840
|
}
|
|
12766
12841
|
var formatter = formatters[firstCharacter];
|
|
12767
12842
|
if (formatter) {
|
|
12768
|
-
if (!
|
|
12769
|
-
throwProtectedError(substring, dirtyFormatStr,
|
|
12843
|
+
if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
|
|
12844
|
+
throwProtectedError(substring, dirtyFormatStr, dirtyDate);
|
|
12770
12845
|
}
|
|
12771
|
-
if (!
|
|
12772
|
-
throwProtectedError(substring, dirtyFormatStr,
|
|
12846
|
+
if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
|
|
12847
|
+
throwProtectedError(substring, dirtyFormatStr, dirtyDate);
|
|
12773
12848
|
}
|
|
12774
12849
|
return formatter(utcDate, substring, locale$1.localize, formatterOptions);
|
|
12775
12850
|
}
|
|
@@ -12781,28 +12856,22 @@ function format(dirtyDate, dirtyFormatStr, options) {
|
|
|
12781
12856
|
return result;
|
|
12782
12857
|
}
|
|
12783
12858
|
function cleanEscapedString(input) {
|
|
12784
|
-
|
|
12785
|
-
if (!matched) {
|
|
12786
|
-
return input;
|
|
12787
|
-
}
|
|
12788
|
-
return matched[1].replace(doubleQuoteRegExp, "'");
|
|
12859
|
+
return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
|
|
12789
12860
|
}
|
|
12790
12861
|
|
|
12791
|
-
function convertToFP(fn, arity) {
|
|
12792
|
-
|
|
12862
|
+
function convertToFP(fn, arity, a) {
|
|
12863
|
+
a = a || [];
|
|
12793
12864
|
if (a.length >= arity) {
|
|
12794
12865
|
return fn.apply(null, a.slice(0, arity).reverse());
|
|
12795
12866
|
}
|
|
12796
12867
|
return function () {
|
|
12797
|
-
|
|
12798
|
-
args[_key] = arguments[_key];
|
|
12799
|
-
}
|
|
12868
|
+
var args = Array.prototype.slice.call(arguments);
|
|
12800
12869
|
return convertToFP(fn, arity, a.concat(args));
|
|
12801
12870
|
};
|
|
12802
12871
|
}
|
|
12803
12872
|
|
|
12804
|
-
// This file is generated automatically by `scripts/build/fp.
|
|
12805
|
-
var
|
|
12873
|
+
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
|
|
12874
|
+
var format = convertToFP(format$1, 2);
|
|
12806
12875
|
|
|
12807
12876
|
var Wrapper = index$a(reactNative.View)(function () {
|
|
12808
12877
|
return {
|
|
@@ -12883,17 +12952,18 @@ var StyledCalendarDayNameCell = index$a(reactNative.View)(function (_ref3) {
|
|
|
12883
12952
|
var StyledCalendarCell = index$a(reactNative.TouchableOpacity)(function (_ref4) {
|
|
12884
12953
|
var theme = _ref4.theme,
|
|
12885
12954
|
_ref4$variant = _ref4.variant,
|
|
12886
|
-
variant = _ref4$variant === void 0 ? 'default' : _ref4$variant
|
|
12887
|
-
themeItemWidth = _ref4.themeItemWidth;
|
|
12955
|
+
variant = _ref4$variant === void 0 ? 'default' : _ref4$variant;
|
|
12888
12956
|
return {
|
|
12889
12957
|
borderColor: theme.__hd__.calendar.colors.border,
|
|
12890
12958
|
borderWidth: variant === 'current' ? 1 : 0,
|
|
12891
|
-
borderRadius: theme.__hd__.calendar.radii["default"],
|
|
12959
|
+
borderRadius: variant === 'highlighted' ? undefined : theme.__hd__.calendar.radii["default"],
|
|
12892
12960
|
alignItems: 'center',
|
|
12893
12961
|
justifyContent: 'center',
|
|
12894
|
-
backgroundColor: variant === 'selected' ? theme.__hd__.calendar.colors.
|
|
12895
|
-
width:
|
|
12896
|
-
height:
|
|
12962
|
+
backgroundColor: variant === 'selected' ? theme.__hd__.calendar.colors.rowItem.selected : 'transparent',
|
|
12963
|
+
width: '100%',
|
|
12964
|
+
height: '100%',
|
|
12965
|
+
maxWidth: theme.__hd__.calendar.sizes.cellWidth,
|
|
12966
|
+
maxHeight: theme.__hd__.calendar.sizes.cellHeight
|
|
12897
12967
|
};
|
|
12898
12968
|
});
|
|
12899
12969
|
var StyledCalendarRow = index$a(reactNative.View)(function (_ref5) {
|
|
@@ -12901,18 +12971,24 @@ var StyledCalendarRow = index$a(reactNative.View)(function (_ref5) {
|
|
|
12901
12971
|
return {
|
|
12902
12972
|
flexDirection: 'row',
|
|
12903
12973
|
paddingHorizontal: theme.__hd__.calendar.space.rowVerticalPadding,
|
|
12904
|
-
flexWrap: 'wrap'
|
|
12974
|
+
flexWrap: 'wrap',
|
|
12975
|
+
justifyContent: 'center',
|
|
12976
|
+
alignItems: 'center'
|
|
12905
12977
|
};
|
|
12906
12978
|
});
|
|
12907
12979
|
var StyledCalendarRowItem = index$a(reactNative.View)(function (_ref6) {
|
|
12908
12980
|
var theme = _ref6.theme,
|
|
12909
|
-
themeItemWidth = _ref6.themeItemWidth
|
|
12981
|
+
themeItemWidth = _ref6.themeItemWidth,
|
|
12982
|
+
isHighlighted = _ref6.isHighlighted;
|
|
12910
12983
|
return {
|
|
12911
12984
|
flexBasis: "".concat(Math.floor(100.0 / 7.0), "%"),
|
|
12985
|
+
lineHeight: 0,
|
|
12912
12986
|
alignItems: 'center',
|
|
12913
12987
|
width: themeItemWidth || theme.__hd__.calendar.sizes.cellWidth,
|
|
12914
|
-
height: theme.__hd__.calendar.sizes.cellHeight,
|
|
12915
|
-
|
|
12988
|
+
height: themeItemWidth || theme.__hd__.calendar.sizes.cellHeight,
|
|
12989
|
+
maxHeight: theme.__hd__.calendar.sizes.cellHeight,
|
|
12990
|
+
justifyContent: 'center',
|
|
12991
|
+
backgroundColor: isHighlighted ? theme.__hd__.calendar.colors.rowItem.highlighted : undefined
|
|
12916
12992
|
};
|
|
12917
12993
|
});
|
|
12918
12994
|
var StyledDisabledCalendarRowItem = index$a(reactNative.View)(function (_ref7) {
|
|
@@ -12922,7 +12998,8 @@ var StyledDisabledCalendarRowItem = index$a(reactNative.View)(function (_ref7) {
|
|
|
12922
12998
|
flexBasis: "".concat(Math.floor(100.0 / 7.0), "%"),
|
|
12923
12999
|
alignItems: 'center',
|
|
12924
13000
|
width: themeItemWidth || theme.__hd__.calendar.sizes.cellWidth,
|
|
12925
|
-
height: theme.__hd__.calendar.sizes.cellHeight
|
|
13001
|
+
height: themeItemWidth || theme.__hd__.calendar.sizes.cellHeight,
|
|
13002
|
+
maxHeight: theme.__hd__.calendar.sizes.cellHeight
|
|
12926
13003
|
};
|
|
12927
13004
|
});
|
|
12928
13005
|
var StyledMark = index$a(reactNative.View)(function (_ref8) {
|
|
@@ -12942,8 +13019,10 @@ var StyledMark = index$a(reactNative.View)(function (_ref8) {
|
|
|
12942
13019
|
var getCellVariant = function getCellVariant() {
|
|
12943
13020
|
var isSelected = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
12944
13021
|
var isCurrent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
13022
|
+
var isHighlighted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
12945
13023
|
if (isSelected) return 'selected';
|
|
12946
13024
|
if (isCurrent) return 'current';
|
|
13025
|
+
if (isHighlighted) return 'highlighted';
|
|
12947
13026
|
return 'default';
|
|
12948
13027
|
};
|
|
12949
13028
|
var CalendarRowItem = function CalendarRowItem(_ref) {
|
|
@@ -12955,12 +13034,14 @@ var CalendarRowItem = function CalendarRowItem(_ref) {
|
|
|
12955
13034
|
textIntent = _ref$textIntent === void 0 ? 'body' : _ref$textIntent,
|
|
12956
13035
|
_ref$marked = _ref.marked,
|
|
12957
13036
|
marked = _ref$marked === void 0 ? false : _ref$marked,
|
|
12958
|
-
itemWidth = _ref.itemWidth
|
|
13037
|
+
itemWidth = _ref.itemWidth,
|
|
13038
|
+
isHighlighted = _ref.isHighlighted;
|
|
12959
13039
|
return /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRowItem, {
|
|
12960
13040
|
testID: "calendar-date-cell",
|
|
12961
|
-
themeItemWidth: itemWidth
|
|
13041
|
+
themeItemWidth: itemWidth,
|
|
13042
|
+
isHighlighted: isHighlighted
|
|
12962
13043
|
}, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarCell, {
|
|
12963
|
-
variant: getCellVariant(isSelected, isCurrent),
|
|
13044
|
+
variant: getCellVariant(isSelected, isCurrent, isHighlighted),
|
|
12964
13045
|
onPress: onPress
|
|
12965
13046
|
}, /*#__PURE__*/React__namespace.default.createElement(Typography.Body, {
|
|
12966
13047
|
variant: "small",
|
|
@@ -12979,6 +13060,14 @@ var initArray = function initArray(length, func) {
|
|
|
12979
13060
|
var isEqDate = function isEqDate(dateA, dateB) {
|
|
12980
13061
|
return (dateA === null || dateA === void 0 ? void 0 : dateA.toDateString()) === (dateB === null || dateB === void 0 ? void 0 : dateB.toDateString());
|
|
12981
13062
|
};
|
|
13063
|
+
var isDateInRange = function isDateInRange(_ref) {
|
|
13064
|
+
var date = _ref.date,
|
|
13065
|
+
range = _ref.range;
|
|
13066
|
+
if (!range || range.startDate === undefined || range.endDate === undefined) {
|
|
13067
|
+
return false;
|
|
13068
|
+
}
|
|
13069
|
+
return date >= range.startDate && date <= range.endDate;
|
|
13070
|
+
};
|
|
12982
13071
|
var getValidDate = function getValidDate(date, minDate, maxDate) {
|
|
12983
13072
|
if (minDate === undefined && maxDate === undefined) {
|
|
12984
13073
|
return date;
|
|
@@ -12994,6 +13083,297 @@ var getValidDate = function getValidDate(date, minDate, maxDate) {
|
|
|
12994
13083
|
}
|
|
12995
13084
|
return undefined;
|
|
12996
13085
|
};
|
|
13086
|
+
var setStartOrEndDate = function setStartOrEndDate(_ref2) {
|
|
13087
|
+
var date = _ref2.date,
|
|
13088
|
+
startDate = _ref2.startDate,
|
|
13089
|
+
endDate = _ref2.endDate;
|
|
13090
|
+
// Prevent selecting same date
|
|
13091
|
+
if (isEqDate(date, startDate) || isEqDate(date, endDate)) {
|
|
13092
|
+
return {
|
|
13093
|
+
startDate: startDate,
|
|
13094
|
+
endDate: endDate
|
|
13095
|
+
};
|
|
13096
|
+
}
|
|
13097
|
+
// No start date yet - set as start
|
|
13098
|
+
if (!startDate) {
|
|
13099
|
+
return {
|
|
13100
|
+
startDate: date,
|
|
13101
|
+
endDate: undefined
|
|
13102
|
+
};
|
|
13103
|
+
}
|
|
13104
|
+
// Have start but no end - set as end and reorder if needed
|
|
13105
|
+
if (!endDate) {
|
|
13106
|
+
return date < startDate ? {
|
|
13107
|
+
startDate: date,
|
|
13108
|
+
endDate: startDate
|
|
13109
|
+
} : {
|
|
13110
|
+
startDate: startDate,
|
|
13111
|
+
endDate: date
|
|
13112
|
+
};
|
|
13113
|
+
}
|
|
13114
|
+
// Clicking within range - start new selection
|
|
13115
|
+
if (date >= startDate && date <= endDate) {
|
|
13116
|
+
return {
|
|
13117
|
+
startDate: date,
|
|
13118
|
+
endDate: undefined
|
|
13119
|
+
};
|
|
13120
|
+
}
|
|
13121
|
+
// Clicking outside range - extend range
|
|
13122
|
+
return date < startDate ? {
|
|
13123
|
+
startDate: date,
|
|
13124
|
+
endDate: endDate
|
|
13125
|
+
} : {
|
|
13126
|
+
startDate: startDate,
|
|
13127
|
+
endDate: date
|
|
13128
|
+
};
|
|
13129
|
+
};
|
|
13130
|
+
|
|
13131
|
+
var SelectedDate = function SelectedDate(_ref) {
|
|
13132
|
+
var date = _ref.date,
|
|
13133
|
+
onPress = _ref.onPress,
|
|
13134
|
+
marked = _ref.marked,
|
|
13135
|
+
isStart = _ref.isStart,
|
|
13136
|
+
showConnector = _ref.showConnector,
|
|
13137
|
+
itemWidth = _ref.itemWidth;
|
|
13138
|
+
return /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRowItem, {
|
|
13139
|
+
themeItemWidth: itemWidth,
|
|
13140
|
+
testID: "calendar-date-cell"
|
|
13141
|
+
}, showConnector ? /*#__PURE__*/React__namespace.default.createElement(Box, {
|
|
13142
|
+
testID: "range-connector",
|
|
13143
|
+
style: _objectSpread2(_objectSpread2({
|
|
13144
|
+
width: '50%',
|
|
13145
|
+
height: '100%'
|
|
13146
|
+
}, reactNative.StyleSheet.absoluteFillObject), {}, {
|
|
13147
|
+
transform: isStart ? [{
|
|
13148
|
+
translateX: itemWidth ? itemWidth / 2 : 0
|
|
13149
|
+
}] : undefined
|
|
13150
|
+
}),
|
|
13151
|
+
bgColor: "highlightedSurface"
|
|
13152
|
+
}) : null, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarCell, {
|
|
13153
|
+
testID: "selected-date-cell",
|
|
13154
|
+
variant: "selected",
|
|
13155
|
+
onPress: onPress
|
|
13156
|
+
}, /*#__PURE__*/React__namespace.default.createElement(Typography.Body, {
|
|
13157
|
+
variant: "small",
|
|
13158
|
+
intent: "inverted"
|
|
13159
|
+
}, date ? date.getDate() : ''), marked ? /*#__PURE__*/React__namespace.default.createElement(StyledMark, {
|
|
13160
|
+
testID: "calendar-date-mark",
|
|
13161
|
+
variant: "inverted"
|
|
13162
|
+
}) : null));
|
|
13163
|
+
};
|
|
13164
|
+
|
|
13165
|
+
var DAYS_OF_WEEK$1 = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
|
|
13166
|
+
// Sunday first column => 0
|
|
13167
|
+
// Sunday last column => 1
|
|
13168
|
+
var WEEK_INDEX_OFFSET$1 = 1;
|
|
13169
|
+
var SUNDAY_INDEX$1 = 6;
|
|
13170
|
+
// Always render 7 rows x 6 items for consistent layout
|
|
13171
|
+
var TOTAL_DATES_ITEMS$1 = 7 * 6;
|
|
13172
|
+
var CalendarRange = function CalendarRange(_ref) {
|
|
13173
|
+
var value = _ref.value,
|
|
13174
|
+
visibleDate = _ref.visibleDate,
|
|
13175
|
+
onChange = _ref.onChange,
|
|
13176
|
+
_ref$onPreviousPress = _ref.onPreviousPress,
|
|
13177
|
+
onPreviousPress = _ref$onPreviousPress === void 0 ? noop$1 : _ref$onPreviousPress,
|
|
13178
|
+
_ref$onNextPress = _ref.onNextPress,
|
|
13179
|
+
onNextPress = _ref$onNextPress === void 0 ? noop$1 : _ref$onNextPress,
|
|
13180
|
+
_ref$onTitlePress = _ref.onTitlePress,
|
|
13181
|
+
onTitlePress = _ref$onTitlePress === void 0 ? noop$1 : _ref$onTitlePress,
|
|
13182
|
+
minDate = _ref.minDate,
|
|
13183
|
+
maxDate = _ref.maxDate,
|
|
13184
|
+
_ref$markedDates = _ref.markedDates,
|
|
13185
|
+
markedDates = _ref$markedDates === void 0 ? [] : _ref$markedDates,
|
|
13186
|
+
testID = _ref.testID,
|
|
13187
|
+
_ref$onMonthChange = _ref.onMonthChange,
|
|
13188
|
+
onMonthChange = _ref$onMonthChange === void 0 ? noop$1 : _ref$onMonthChange,
|
|
13189
|
+
_ref$onToggleMonthPic = _ref.onToggleMonthPicker,
|
|
13190
|
+
onToggleMonthPicker = _ref$onToggleMonthPic === void 0 ? noop$1 : _ref$onToggleMonthPic,
|
|
13191
|
+
monthPickerConfirmLabel = _ref.monthPickerConfirmLabel,
|
|
13192
|
+
monthPickerCancelLabel = _ref.monthPickerCancelLabel;
|
|
13193
|
+
var theme = useTheme();
|
|
13194
|
+
var currentMonth = visibleDate.getMonth();
|
|
13195
|
+
var currentYear = visibleDate.getFullYear();
|
|
13196
|
+
var now = new Date();
|
|
13197
|
+
var parsedMaskedDate = markedDates.reduce(function (current, markedDate) {
|
|
13198
|
+
return _objectSpread2(_objectSpread2({}, current), {}, _defineProperty({}, markedDate.toDateString(), true));
|
|
13199
|
+
}, {});
|
|
13200
|
+
var _useState = React.useState(false),
|
|
13201
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13202
|
+
monthPickerVisible = _useState2[0],
|
|
13203
|
+
setMonthPickerVisible = _useState2[1];
|
|
13204
|
+
var _useState3 = React.useState(0),
|
|
13205
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
13206
|
+
contentHeight = _useState4[0],
|
|
13207
|
+
setContentHeight = _useState4[1];
|
|
13208
|
+
var _useState5 = React.useState(0),
|
|
13209
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
13210
|
+
contentWidth = _useState6[0],
|
|
13211
|
+
setContentWidth = _useState6[1];
|
|
13212
|
+
var calendarItemWidth = React.useMemo(function () {
|
|
13213
|
+
return contentWidth > 0 ? Math.floor((contentWidth - theme.__hd__.calendar.space.cellPadding) / 7) : undefined;
|
|
13214
|
+
}, [contentWidth, theme]);
|
|
13215
|
+
var useMonthPicker = onMonthChange !== noop$1;
|
|
13216
|
+
var firstDateOfMonth = new Date(currentYear, currentMonth, 1);
|
|
13217
|
+
var lastDateOfMonth = new Date(currentYear, currentMonth + 1, 0);
|
|
13218
|
+
var lastDateOfPreviousMonth = new Date(currentYear, currentMonth, 0);
|
|
13219
|
+
// Index of day in week is shifted by 1 due to Sunday is the last column
|
|
13220
|
+
var firstDayWeekIndexOfMonth = firstDateOfMonth.getDay() === 0 ? SUNDAY_INDEX$1 : firstDateOfMonth.getDay() - WEEK_INDEX_OFFSET$1;
|
|
13221
|
+
var lastDayIndexOfCurrentMonth = lastDateOfMonth.getDate();
|
|
13222
|
+
var lastDayIndexOfPreviousMonth = lastDateOfPreviousMonth.getDate();
|
|
13223
|
+
var daysOfPreviousMonth = initArray(firstDayWeekIndexOfMonth, function (index) {
|
|
13224
|
+
var reversedIndex = firstDayWeekIndexOfMonth - index - 1;
|
|
13225
|
+
var count = lastDayIndexOfPreviousMonth - reversedIndex;
|
|
13226
|
+
return getValidDate(new Date(currentYear, currentMonth - 1, count), minDate, maxDate);
|
|
13227
|
+
});
|
|
13228
|
+
var daysOfCurrentMonth = initArray(lastDayIndexOfCurrentMonth, function (index) {
|
|
13229
|
+
return getValidDate(new Date(currentYear, currentMonth, index + 1), minDate, maxDate);
|
|
13230
|
+
});
|
|
13231
|
+
var daysOfNextMonth = initArray(TOTAL_DATES_ITEMS$1 - (daysOfPreviousMonth.length + daysOfCurrentMonth.length), function (index) {
|
|
13232
|
+
return getValidDate(new Date(currentYear, currentMonth + 1, index + 1), minDate, maxDate);
|
|
13233
|
+
});
|
|
13234
|
+
var disablePrevButton = minDate === undefined ? false : !daysOfPreviousMonth.some(function (date) {
|
|
13235
|
+
return date !== undefined;
|
|
13236
|
+
}) && minDate >= firstDateOfMonth;
|
|
13237
|
+
var disableNextButton = maxDate === undefined ? false : !daysOfNextMonth.some(function (date) {
|
|
13238
|
+
return date !== undefined;
|
|
13239
|
+
}) || maxDate <= lastDateOfMonth;
|
|
13240
|
+
var onDateChange = function onDateChange(date) {
|
|
13241
|
+
var newDateRange = setStartOrEndDate({
|
|
13242
|
+
date: date,
|
|
13243
|
+
startDate: value === null || value === void 0 ? void 0 : value.startDate,
|
|
13244
|
+
endDate: value === null || value === void 0 ? void 0 : value.endDate
|
|
13245
|
+
});
|
|
13246
|
+
onChange === null || onChange === void 0 || onChange(newDateRange);
|
|
13247
|
+
};
|
|
13248
|
+
var renderDateCell = function renderDateCell(_ref2) {
|
|
13249
|
+
var date = _ref2.date,
|
|
13250
|
+
isCurrentMonth = _ref2.isCurrentMonth;
|
|
13251
|
+
if (!date) {
|
|
13252
|
+
return /*#__PURE__*/React__namespace.default.createElement(StyledDisabledCalendarRowItem, {
|
|
13253
|
+
themeItemWidth: calendarItemWidth,
|
|
13254
|
+
testID: "calendar-disabled-cell"
|
|
13255
|
+
});
|
|
13256
|
+
}
|
|
13257
|
+
if (isEqDate(value === null || value === void 0 ? void 0 : value.startDate, date) || isEqDate(value === null || value === void 0 ? void 0 : value.endDate, date)) {
|
|
13258
|
+
return /*#__PURE__*/React__namespace.default.createElement(SelectedDate, {
|
|
13259
|
+
isStart: isEqDate(date, value === null || value === void 0 ? void 0 : value.startDate),
|
|
13260
|
+
showConnector: !!(value !== null && value !== void 0 && value.startDate) && !!(value !== null && value !== void 0 && value.endDate),
|
|
13261
|
+
key: date.toDateString(),
|
|
13262
|
+
date: date,
|
|
13263
|
+
onPress: function onPress() {
|
|
13264
|
+
return onDateChange(date);
|
|
13265
|
+
},
|
|
13266
|
+
marked: parsedMaskedDate[date.toDateString()],
|
|
13267
|
+
itemWidth: calendarItemWidth
|
|
13268
|
+
});
|
|
13269
|
+
}
|
|
13270
|
+
return /*#__PURE__*/React__namespace.default.createElement(CalendarRowItem, {
|
|
13271
|
+
itemWidth: calendarItemWidth,
|
|
13272
|
+
key: date.toDateString(),
|
|
13273
|
+
date: date,
|
|
13274
|
+
isCurrent: isEqDate(now, date),
|
|
13275
|
+
isSelected: isEqDate(value === null || value === void 0 ? void 0 : value.startDate, date) || isEqDate(value === null || value === void 0 ? void 0 : value.endDate, date),
|
|
13276
|
+
isHighlighted: isDateInRange({
|
|
13277
|
+
date: date,
|
|
13278
|
+
range: value
|
|
13279
|
+
}),
|
|
13280
|
+
onPress: function onPress() {
|
|
13281
|
+
return onDateChange(date);
|
|
13282
|
+
},
|
|
13283
|
+
marked: parsedMaskedDate[date.toDateString()],
|
|
13284
|
+
textIntent: isCurrentMonth ? undefined : 'subdued'
|
|
13285
|
+
});
|
|
13286
|
+
};
|
|
13287
|
+
var onLayout = function onLayout(e) {
|
|
13288
|
+
var _e$nativeEvent$layout = e.nativeEvent.layout,
|
|
13289
|
+
width = _e$nativeEvent$layout.width,
|
|
13290
|
+
height = _e$nativeEvent$layout.height;
|
|
13291
|
+
setContentHeight(height);
|
|
13292
|
+
setContentWidth(width);
|
|
13293
|
+
};
|
|
13294
|
+
return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$7, {
|
|
13295
|
+
testID: testID
|
|
13296
|
+
}, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__namespace.default.createElement(ContentNavigator, {
|
|
13297
|
+
value: !useMonthPicker ? format('MMMM yyyy', visibleDate) : /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
|
|
13298
|
+
testID: "calendar-month-picker",
|
|
13299
|
+
onPress: function onPress() {
|
|
13300
|
+
onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(!monthPickerVisible);
|
|
13301
|
+
setMonthPickerVisible(!monthPickerVisible);
|
|
13302
|
+
}
|
|
13303
|
+
}, /*#__PURE__*/React__namespace.default.createElement(Box, {
|
|
13304
|
+
flexDirection: "row",
|
|
13305
|
+
justifyContent: "center",
|
|
13306
|
+
alignItems: "center"
|
|
13307
|
+
}, /*#__PURE__*/React__namespace.default.createElement(Typography.Title, {
|
|
13308
|
+
level: "h5",
|
|
13309
|
+
style: {
|
|
13310
|
+
textAlign: 'center',
|
|
13311
|
+
marginRight: theme.__hd__.calendar.space.headerMarginRight
|
|
13312
|
+
}
|
|
13313
|
+
}, format('MMMM yyyy', visibleDate)), /*#__PURE__*/React__namespace.default.createElement(Icon, {
|
|
13314
|
+
icon: monthPickerVisible ? 'arrow-up' : 'arrow-down',
|
|
13315
|
+
size: "small"
|
|
13316
|
+
}))),
|
|
13317
|
+
onPreviousPress: onPreviousPress,
|
|
13318
|
+
onNextPress: onNextPress,
|
|
13319
|
+
onPress: useMonthPicker ? undefined : onTitlePress,
|
|
13320
|
+
previousDisabled: disablePrevButton,
|
|
13321
|
+
nextDisabled: disableNextButton,
|
|
13322
|
+
fontSize: "large"
|
|
13323
|
+
})), reactNative.Platform.OS === 'ios' && monthPickerVisible ? /*#__PURE__*/React__namespace.default.createElement(Box, {
|
|
13324
|
+
style: {
|
|
13325
|
+
overflow: 'hidden'
|
|
13326
|
+
}
|
|
13327
|
+
}, /*#__PURE__*/React__namespace.default.createElement(reactNativeMonthYearPicker.MonthYearPickerViewIOS, {
|
|
13328
|
+
value: value === null || value === void 0 ? void 0 : value.startDate,
|
|
13329
|
+
minimumDate: minDate,
|
|
13330
|
+
maximumDate: maxDate,
|
|
13331
|
+
onChange: onMonthChange,
|
|
13332
|
+
style: {
|
|
13333
|
+
height: contentHeight + theme.__hd__.calendar.space.iosPickerMarginVertical * 2,
|
|
13334
|
+
marginVertical: -theme.__hd__.calendar.space.iosPickerMarginVertical,
|
|
13335
|
+
width: contentWidth
|
|
13336
|
+
}
|
|
13337
|
+
})) : /*#__PURE__*/React__namespace.default.createElement(Box, {
|
|
13338
|
+
onLayout: onLayout
|
|
13339
|
+
}, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRow, null, DAYS_OF_WEEK$1.map(function (day) {
|
|
13340
|
+
return /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRowItem, {
|
|
13341
|
+
key: day
|
|
13342
|
+
}, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarDayNameCell, {
|
|
13343
|
+
themeItemWidth: calendarItemWidth
|
|
13344
|
+
}, /*#__PURE__*/React__namespace.default.createElement(Typography.Body, {
|
|
13345
|
+
variant: "small"
|
|
13346
|
+
}, day)));
|
|
13347
|
+
})), /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRow, null, daysOfPreviousMonth.map(function (date) {
|
|
13348
|
+
return renderDateCell({
|
|
13349
|
+
date: date,
|
|
13350
|
+
isCurrentMonth: false
|
|
13351
|
+
});
|
|
13352
|
+
}), daysOfCurrentMonth.map(function (date) {
|
|
13353
|
+
return renderDateCell({
|
|
13354
|
+
date: date,
|
|
13355
|
+
isCurrentMonth: true
|
|
13356
|
+
});
|
|
13357
|
+
}), daysOfNextMonth.map(function (date) {
|
|
13358
|
+
return renderDateCell({
|
|
13359
|
+
date: date,
|
|
13360
|
+
isCurrentMonth: false
|
|
13361
|
+
});
|
|
13362
|
+
})), reactNative.Platform.OS === 'android' && monthPickerVisible && /*#__PURE__*/React__namespace.default.createElement(reactNativeMonthYearPicker.MonthYearPickerDialogueAndroid, {
|
|
13363
|
+
doneButtonLabel: monthPickerConfirmLabel,
|
|
13364
|
+
cancelButtonLabel: monthPickerCancelLabel,
|
|
13365
|
+
value: value === null || value === void 0 ? void 0 : value.startDate,
|
|
13366
|
+
minimumDate: minDate,
|
|
13367
|
+
maximumDate: maxDate,
|
|
13368
|
+
onChange: function onChange(action, date) {
|
|
13369
|
+
setMonthPickerVisible(false);
|
|
13370
|
+
onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(false);
|
|
13371
|
+
if (action === 'dateSetAction' && !!date) {
|
|
13372
|
+
onMonthChange(date);
|
|
13373
|
+
}
|
|
13374
|
+
}
|
|
13375
|
+
})));
|
|
13376
|
+
};
|
|
12997
13377
|
|
|
12998
13378
|
var DAYS_OF_WEEK = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
|
|
12999
13379
|
// Sunday first column => 0
|
|
@@ -13043,8 +13423,8 @@ var Calendar = function Calendar(_ref) {
|
|
|
13043
13423
|
contentWidth = _useState6[0],
|
|
13044
13424
|
setContentWidth = _useState6[1];
|
|
13045
13425
|
var calendarItemWidth = React.useMemo(function () {
|
|
13046
|
-
return contentWidth > 0 ? contentWidth / 7 : undefined;
|
|
13047
|
-
}, [contentWidth]);
|
|
13426
|
+
return contentWidth > 0 ? Math.floor((contentWidth - theme.__hd__.calendar.space.cellPadding) / 7) : undefined;
|
|
13427
|
+
}, [contentWidth, theme]);
|
|
13048
13428
|
var useMonthPicker = onMonthChange !== noop$1;
|
|
13049
13429
|
var firstDateOfMonth = new Date(currentYear, currentMonth, 1);
|
|
13050
13430
|
var lastDateOfMonth = new Date(currentYear, currentMonth + 1, 0);
|
|
@@ -13070,10 +13450,17 @@ var Calendar = function Calendar(_ref) {
|
|
|
13070
13450
|
var disableNextButton = maxDate === undefined ? false : !daysOfNextMonth.some(function (date) {
|
|
13071
13451
|
return date !== undefined;
|
|
13072
13452
|
}) || maxDate <= lastDateOfMonth;
|
|
13453
|
+
var onLayout = function onLayout(e) {
|
|
13454
|
+
var _e$nativeEvent$layout = e.nativeEvent.layout,
|
|
13455
|
+
width = _e$nativeEvent$layout.width,
|
|
13456
|
+
height = _e$nativeEvent$layout.height;
|
|
13457
|
+
setContentHeight(height);
|
|
13458
|
+
setContentWidth(width);
|
|
13459
|
+
};
|
|
13073
13460
|
return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$7, {
|
|
13074
13461
|
testID: testID
|
|
13075
13462
|
}, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__namespace.default.createElement(ContentNavigator, {
|
|
13076
|
-
value: !useMonthPicker ?
|
|
13463
|
+
value: !useMonthPicker ? format('MMMM yyyy', visibleDate) : /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
|
|
13077
13464
|
testID: "calendar-month-picker",
|
|
13078
13465
|
onPress: function onPress() {
|
|
13079
13466
|
onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(!monthPickerVisible);
|
|
@@ -13089,7 +13476,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
13089
13476
|
textAlign: 'center',
|
|
13090
13477
|
marginRight: theme.__hd__.calendar.space.headerMarginRight
|
|
13091
13478
|
}
|
|
13092
|
-
},
|
|
13479
|
+
}, format('MMMM yyyy', visibleDate)), /*#__PURE__*/React__namespace.default.createElement(Icon, {
|
|
13093
13480
|
icon: monthPickerVisible ? 'arrow-up' : 'arrow-down',
|
|
13094
13481
|
size: "small"
|
|
13095
13482
|
}))),
|
|
@@ -13114,13 +13501,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
13114
13501
|
width: contentWidth
|
|
13115
13502
|
}
|
|
13116
13503
|
})) : /*#__PURE__*/React__namespace.default.createElement(Box, {
|
|
13117
|
-
onLayout:
|
|
13118
|
-
var _e$nativeEvent$layout = e.nativeEvent.layout,
|
|
13119
|
-
width = _e$nativeEvent$layout.width,
|
|
13120
|
-
height = _e$nativeEvent$layout.height;
|
|
13121
|
-
setContentHeight(height);
|
|
13122
|
-
setContentWidth(width);
|
|
13123
|
-
} : undefined
|
|
13504
|
+
onLayout: onLayout
|
|
13124
13505
|
}, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRow, null, DAYS_OF_WEEK.map(function (day) {
|
|
13125
13506
|
return /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRowItem, {
|
|
13126
13507
|
key: day
|
|
@@ -13191,6 +13572,9 @@ var Calendar = function Calendar(_ref) {
|
|
|
13191
13572
|
}
|
|
13192
13573
|
})));
|
|
13193
13574
|
};
|
|
13575
|
+
var Calendar$1 = Object.assign(Calendar, {
|
|
13576
|
+
Range: CalendarRange
|
|
13577
|
+
});
|
|
13194
13578
|
|
|
13195
13579
|
var StyledDataCard = index$a(reactNative.View)(function (_ref) {
|
|
13196
13580
|
var theme = _ref.theme;
|
|
@@ -13602,7 +13986,7 @@ var StyledPageControlWrapper = index$a(reactNative.View)(function (_ref7) {
|
|
|
13602
13986
|
});
|
|
13603
13987
|
|
|
13604
13988
|
function isCarouselImageProps(image) {
|
|
13605
|
-
return _typeof
|
|
13989
|
+
return _typeof(image) === 'object';
|
|
13606
13990
|
}
|
|
13607
13991
|
var CarouselItem = function CarouselItem(_ref) {
|
|
13608
13992
|
var width = _ref.width,
|
|
@@ -14537,7 +14921,7 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
|
|
|
14537
14921
|
_useState2 = _slicedToArray(_useState, 2),
|
|
14538
14922
|
open = _useState2[0],
|
|
14539
14923
|
setOpen = _useState2[1];
|
|
14540
|
-
var displayValue = value ?
|
|
14924
|
+
var displayValue = value ? format(displayFormat, value) : '';
|
|
14541
14925
|
var pickerInitValue = value || new Date();
|
|
14542
14926
|
useCalculateDate({
|
|
14543
14927
|
minDate: minDate,
|
|
@@ -14606,7 +14990,7 @@ var InternalCalendar = function InternalCalendar(_ref) {
|
|
|
14606
14990
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
14607
14991
|
selectingDate = _useState4[0],
|
|
14608
14992
|
setSelectingDate = _useState4[1];
|
|
14609
|
-
return /*#__PURE__*/React__namespace.default.createElement(Calendar, {
|
|
14993
|
+
return /*#__PURE__*/React__namespace.default.createElement(Calendar$1, {
|
|
14610
14994
|
testID: "calendar",
|
|
14611
14995
|
value: selectingDate,
|
|
14612
14996
|
visibleDate: visibleDate,
|
|
@@ -14668,7 +15052,7 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
|
|
|
14668
15052
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
14669
15053
|
selectingDate = _useState10[0],
|
|
14670
15054
|
setSelectingDate = _useState10[1];
|
|
14671
|
-
var displayValue = value ?
|
|
15055
|
+
var displayValue = value ? format(displayFormat, value) : '';
|
|
14672
15056
|
useCalculateDate({
|
|
14673
15057
|
minDate: minDate,
|
|
14674
15058
|
maxDate: maxDate,
|
|
@@ -14761,7 +15145,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
|
|
|
14761
15145
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
14762
15146
|
open = _useState4[0],
|
|
14763
15147
|
setOpen = _useState4[1];
|
|
14764
|
-
var displayValue = value ?
|
|
15148
|
+
var displayValue = value ? format(displayFormat, value) : '';
|
|
14765
15149
|
var theme = useTheme();
|
|
14766
15150
|
useCalculateDate({
|
|
14767
15151
|
minDate: minDate,
|
|
@@ -19933,7 +20317,7 @@ var TimePickerAndroid = function TimePickerAndroid(_ref) {
|
|
|
19933
20317
|
open = _useState2[0],
|
|
19934
20318
|
setOpen = _useState2[1];
|
|
19935
20319
|
var is12Hour = displayFormat.includes('hh');
|
|
19936
|
-
var displayValue = value ?
|
|
20320
|
+
var displayValue = value ? format(displayFormat, value) : '';
|
|
19937
20321
|
var pickerInitValue = value || new Date();
|
|
19938
20322
|
return /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
|
|
19939
20323
|
onPress: function onPress() {
|
|
@@ -20004,7 +20388,7 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
|
|
|
20004
20388
|
open = _useState4[0],
|
|
20005
20389
|
setOpen = _useState4[1];
|
|
20006
20390
|
var is12Hour = displayFormat.includes('hh');
|
|
20007
|
-
var displayValue = value ?
|
|
20391
|
+
var displayValue = value ? format(displayFormat, value) : '';
|
|
20008
20392
|
var theme = useTheme();
|
|
20009
20393
|
React.useEffect(function () {
|
|
20010
20394
|
setSelectingDate(value || new Date());
|
|
@@ -20743,7 +21127,7 @@ function requireScheduler_production_min() {
|
|
|
20743
21127
|
var c = a.sortIndex - b.sortIndex;
|
|
20744
21128
|
return 0 !== c ? c : a.id - b.id;
|
|
20745
21129
|
}
|
|
20746
|
-
if ("object" === (typeof performance === "undefined" ? "undefined" : _typeof
|
|
21130
|
+
if ("object" === (typeof performance === "undefined" ? "undefined" : _typeof(performance)) && "function" === typeof performance.now) {
|
|
20747
21131
|
var l = performance;
|
|
20748
21132
|
exports.unstable_now = function () {
|
|
20749
21133
|
return l.now();
|
|
@@ -20914,7 +21298,7 @@ function requireScheduler_production_min() {
|
|
|
20914
21298
|
};
|
|
20915
21299
|
exports.unstable_scheduleCallback = function (a, b, c) {
|
|
20916
21300
|
var d = exports.unstable_now();
|
|
20917
|
-
"object" === _typeof
|
|
21301
|
+
"object" === _typeof(c) && null !== c ? (c = c.delay, c = "number" === typeof c && 0 < c ? d + c : d) : c = d;
|
|
20918
21302
|
switch (a) {
|
|
20919
21303
|
case 1:
|
|
20920
21304
|
var e = -1;
|
|
@@ -21004,7 +21388,7 @@ function requireReactDom_production_min() {
|
|
|
21004
21388
|
}
|
|
21005
21389
|
function pa(a, b, c, d) {
|
|
21006
21390
|
if (null !== c && 0 === c.type) return !1;
|
|
21007
|
-
switch (_typeof
|
|
21391
|
+
switch (_typeof(b)) {
|
|
21008
21392
|
case "function":
|
|
21009
21393
|
case "symbol":
|
|
21010
21394
|
return !0;
|
|
@@ -21114,7 +21498,7 @@ function requireReactDom_production_min() {
|
|
|
21114
21498
|
var Ia = Symbol["for"]("react.offscreen");
|
|
21115
21499
|
var Ja = Symbol.iterator;
|
|
21116
21500
|
function Ka(a) {
|
|
21117
|
-
if (null === a || "object" !== _typeof
|
|
21501
|
+
if (null === a || "object" !== _typeof(a)) return null;
|
|
21118
21502
|
a = Ja && a[Ja] || a["@@iterator"];
|
|
21119
21503
|
return "function" === typeof a ? a : null;
|
|
21120
21504
|
}
|
|
@@ -21143,7 +21527,7 @@ function requireReactDom_production_min() {
|
|
|
21143
21527
|
set: function set() {
|
|
21144
21528
|
throw Error();
|
|
21145
21529
|
}
|
|
21146
|
-
}), "object" === (typeof Reflect === "undefined" ? "undefined" : _typeof
|
|
21530
|
+
}), "object" === (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && Reflect.construct) {
|
|
21147
21531
|
try {
|
|
21148
21532
|
Reflect.construct(b, []);
|
|
21149
21533
|
} catch (l) {
|
|
@@ -21225,7 +21609,7 @@ function requireReactDom_production_min() {
|
|
|
21225
21609
|
case Fa:
|
|
21226
21610
|
return "SuspenseList";
|
|
21227
21611
|
}
|
|
21228
|
-
if ("object" === _typeof
|
|
21612
|
+
if ("object" === _typeof(a)) switch (a.$$typeof) {
|
|
21229
21613
|
case Ca:
|
|
21230
21614
|
return (a.displayName || "Context") + ".Consumer";
|
|
21231
21615
|
case Ba:
|
|
@@ -21297,7 +21681,7 @@ function requireReactDom_production_min() {
|
|
|
21297
21681
|
return null;
|
|
21298
21682
|
}
|
|
21299
21683
|
function Sa(a) {
|
|
21300
|
-
switch (_typeof
|
|
21684
|
+
switch (_typeof(a)) {
|
|
21301
21685
|
case "boolean":
|
|
21302
21686
|
case "number":
|
|
21303
21687
|
case "string":
|
|
@@ -21608,9 +21992,9 @@ function requireReactDom_production_min() {
|
|
|
21608
21992
|
if (tb[a] && (null != b.children || null != b.dangerouslySetInnerHTML)) throw Error(p(137, a));
|
|
21609
21993
|
if (null != b.dangerouslySetInnerHTML) {
|
|
21610
21994
|
if (null != b.children) throw Error(p(60));
|
|
21611
|
-
if ("object" !== _typeof
|
|
21995
|
+
if ("object" !== _typeof(b.dangerouslySetInnerHTML) || !("__html" in b.dangerouslySetInnerHTML)) throw Error(p(61));
|
|
21612
21996
|
}
|
|
21613
|
-
if (null != b.style && "object" !== _typeof
|
|
21997
|
+
if (null != b.style && "object" !== _typeof(b.style)) throw Error(p(62));
|
|
21614
21998
|
}
|
|
21615
21999
|
}
|
|
21616
22000
|
function vb(a, b) {
|
|
@@ -21696,7 +22080,7 @@ function requireReactDom_production_min() {
|
|
|
21696
22080
|
a = !1;
|
|
21697
22081
|
}
|
|
21698
22082
|
if (a) return null;
|
|
21699
|
-
if (c && "function" !== typeof c) throw Error(p(231, b, _typeof
|
|
22083
|
+
if (c && "function" !== typeof c) throw Error(p(231, b, _typeof(c)));
|
|
21700
22084
|
return c;
|
|
21701
22085
|
}
|
|
21702
22086
|
var Lb = !1;
|
|
@@ -22610,7 +22994,7 @@ function requireReactDom_production_min() {
|
|
|
22610
22994
|
}
|
|
22611
22995
|
function he(a) {
|
|
22612
22996
|
a = a.detail;
|
|
22613
|
-
return "object" === _typeof
|
|
22997
|
+
return "object" === _typeof(a) && "data" in a ? a.data : null;
|
|
22614
22998
|
}
|
|
22615
22999
|
var ie = !1;
|
|
22616
23000
|
function je(a, b) {
|
|
@@ -22727,7 +23111,7 @@ function requireReactDom_production_min() {
|
|
|
22727
23111
|
var He = "function" === typeof Object.is ? Object.is : Ge;
|
|
22728
23112
|
function Ie(a, b) {
|
|
22729
23113
|
if (He(a, b)) return !0;
|
|
22730
|
-
if ("object" !== _typeof
|
|
23114
|
+
if ("object" !== _typeof(a) || null === a || "object" !== _typeof(b) || null === b) return !1;
|
|
22731
23115
|
var c = Object.keys(a),
|
|
22732
23116
|
d = Object.keys(b);
|
|
22733
23117
|
if (c.length !== d.length) return !1;
|
|
@@ -23254,7 +23638,7 @@ function requireReactDom_production_min() {
|
|
|
23254
23638
|
var Cf = null,
|
|
23255
23639
|
Df = null;
|
|
23256
23640
|
function Ef(a, b) {
|
|
23257
|
-
return "textarea" === a || "noscript" === a || "string" === typeof b.children || "number" === typeof b.children || "object" === _typeof
|
|
23641
|
+
return "textarea" === a || "noscript" === a || "string" === typeof b.children || "number" === typeof b.children || "object" === _typeof(b.dangerouslySetInnerHTML) && null !== b.dangerouslySetInnerHTML && null != b.dangerouslySetInnerHTML.__html;
|
|
23258
23642
|
}
|
|
23259
23643
|
var Ff = "function" === typeof setTimeout ? setTimeout : void 0,
|
|
23260
23644
|
Gf = "function" === typeof clearTimeout ? clearTimeout : void 0,
|
|
@@ -23902,7 +24286,7 @@ function requireReactDom_production_min() {
|
|
|
23902
24286
|
var d = !1,
|
|
23903
24287
|
e = Vf;
|
|
23904
24288
|
var f = b.contextType;
|
|
23905
|
-
"object" === _typeof
|
|
24289
|
+
"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);
|
|
23906
24290
|
b = new b(c, f);
|
|
23907
24291
|
a.memoizedState = null !== b.state && void 0 !== b.state ? b.state : null;
|
|
23908
24292
|
b.updater = nh;
|
|
@@ -23924,7 +24308,7 @@ function requireReactDom_production_min() {
|
|
|
23924
24308
|
e.refs = jh;
|
|
23925
24309
|
ah(a);
|
|
23926
24310
|
var f = b.contextType;
|
|
23927
|
-
"object" === _typeof
|
|
24311
|
+
"object" === _typeof(f) && null !== f ? e.context = Vg(f) : (f = Zf(b) ? Xf : H.current, e.context = Yf(a, f));
|
|
23928
24312
|
e.state = a.memoizedState;
|
|
23929
24313
|
f = b.getDerivedStateFromProps;
|
|
23930
24314
|
"function" === typeof f && (kh(a, b, f, c), e.state = a.memoizedState);
|
|
@@ -23933,7 +24317,7 @@ function requireReactDom_production_min() {
|
|
|
23933
24317
|
}
|
|
23934
24318
|
function sh(a, b, c) {
|
|
23935
24319
|
a = c.ref;
|
|
23936
|
-
if (null !== a && "function" !== typeof a && "object" !== _typeof
|
|
24320
|
+
if (null !== a && "function" !== typeof a && "object" !== _typeof(a)) {
|
|
23937
24321
|
if (c._owner) {
|
|
23938
24322
|
c = c._owner;
|
|
23939
24323
|
if (c) {
|
|
@@ -24008,7 +24392,7 @@ function requireReactDom_production_min() {
|
|
|
24008
24392
|
function k(a, b, c, d) {
|
|
24009
24393
|
var f = c.type;
|
|
24010
24394
|
if (f === ya) return m(a, b, c.props.children, d, c.key);
|
|
24011
|
-
if (null !== b && (b.elementType === f || "object" === _typeof
|
|
24395
|
+
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;
|
|
24012
24396
|
d = yh(c.type, c.key, c.props, null, a.mode, d);
|
|
24013
24397
|
d.ref = sh(a, b, c);
|
|
24014
24398
|
d["return"] = a;
|
|
@@ -24028,7 +24412,7 @@ function requireReactDom_production_min() {
|
|
|
24028
24412
|
}
|
|
24029
24413
|
function q(a, b, c) {
|
|
24030
24414
|
if ("string" === typeof b && "" !== b || "number" === typeof b) return b = xh("" + b, a.mode, c), b["return"] = a, b;
|
|
24031
|
-
if ("object" === _typeof
|
|
24415
|
+
if ("object" === _typeof(b) && null !== b) {
|
|
24032
24416
|
switch (b.$$typeof) {
|
|
24033
24417
|
case va:
|
|
24034
24418
|
return c = yh(b.type, b.key, b.props, null, a.mode, c), c.ref = sh(a, null, b), c["return"] = a, c;
|
|
@@ -24046,7 +24430,7 @@ function requireReactDom_production_min() {
|
|
|
24046
24430
|
function r(a, b, c, d) {
|
|
24047
24431
|
var e = null !== b ? b.key : null;
|
|
24048
24432
|
if ("string" === typeof c && "" !== c || "number" === typeof c) return null !== e ? null : h(a, b, "" + c, d);
|
|
24049
|
-
if ("object" === _typeof
|
|
24433
|
+
if ("object" === _typeof(c) && null !== c) {
|
|
24050
24434
|
switch (c.$$typeof) {
|
|
24051
24435
|
case va:
|
|
24052
24436
|
return c.key === e ? k(a, b, c, d) : null;
|
|
@@ -24062,7 +24446,7 @@ function requireReactDom_production_min() {
|
|
|
24062
24446
|
}
|
|
24063
24447
|
function y(a, b, c, d, e) {
|
|
24064
24448
|
if ("string" === typeof d && "" !== d || "number" === typeof d) return a = a.get(c) || null, h(b, a, "" + d, e);
|
|
24065
|
-
if ("object" === _typeof
|
|
24449
|
+
if ("object" === _typeof(d) && null !== d) {
|
|
24066
24450
|
switch (d.$$typeof) {
|
|
24067
24451
|
case va:
|
|
24068
24452
|
return a = a.get(null === d.key ? c : d.key) || null, k(b, a, d, e);
|
|
@@ -24136,8 +24520,8 @@ function requireReactDom_production_min() {
|
|
|
24136
24520
|
return l;
|
|
24137
24521
|
}
|
|
24138
24522
|
function J(a, d, f, h) {
|
|
24139
|
-
"object" === _typeof
|
|
24140
|
-
if ("object" === _typeof
|
|
24523
|
+
"object" === _typeof(f) && null !== f && f.type === ya && null === f.key && (f = f.props.children);
|
|
24524
|
+
if ("object" === _typeof(f) && null !== f) {
|
|
24141
24525
|
switch (f.$$typeof) {
|
|
24142
24526
|
case va:
|
|
24143
24527
|
a: {
|
|
@@ -24152,7 +24536,7 @@ function requireReactDom_production_min() {
|
|
|
24152
24536
|
a = d;
|
|
24153
24537
|
break a;
|
|
24154
24538
|
}
|
|
24155
|
-
} else if (l.elementType === k || "object" === _typeof
|
|
24539
|
+
} else if (l.elementType === k || "object" === _typeof(k) && null !== k && k.$$typeof === Ha && uh(k) === l.type) {
|
|
24156
24540
|
c(a, l.sibling);
|
|
24157
24541
|
d = e(l, f.props);
|
|
24158
24542
|
d.ref = sh(a, l, f);
|
|
@@ -25037,7 +25421,7 @@ function requireReactDom_production_min() {
|
|
|
25037
25421
|
g.props = h;
|
|
25038
25422
|
var k = g.context,
|
|
25039
25423
|
l = c.contextType;
|
|
25040
|
-
"object" === _typeof
|
|
25424
|
+
"object" === _typeof(l) && null !== l ? l = Vg(l) : (l = Zf(c) ? Xf : H.current, l = Yf(b, l));
|
|
25041
25425
|
var m = c.getDerivedStateFromProps,
|
|
25042
25426
|
q = "function" === typeof m || "function" === typeof g.getSnapshotBeforeUpdate;
|
|
25043
25427
|
q || "function" !== typeof g.UNSAFE_componentWillReceiveProps && "function" !== typeof g.componentWillReceiveProps || (h !== d || k !== l) && qh(b, g, d, l);
|
|
@@ -25056,7 +25440,7 @@ function requireReactDom_production_min() {
|
|
|
25056
25440
|
q = b.pendingProps;
|
|
25057
25441
|
r = g.context;
|
|
25058
25442
|
k = c.contextType;
|
|
25059
|
-
"object" === _typeof
|
|
25443
|
+
"object" === _typeof(k) && null !== k ? k = Vg(k) : (k = Zf(c) ? Xf : H.current, k = Yf(b, k));
|
|
25060
25444
|
var y = c.getDerivedStateFromProps;
|
|
25061
25445
|
(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);
|
|
25062
25446
|
$g = !1;
|
|
@@ -26969,7 +27353,7 @@ function requireReactDom_production_min() {
|
|
|
26969
27353
|
k = b;
|
|
26970
27354
|
b = Z;
|
|
26971
27355
|
h.flags |= 32768;
|
|
26972
|
-
if (null !== k && "object" === _typeof
|
|
27356
|
+
if (null !== k && "object" === _typeof(k) && "function" === typeof k.then) {
|
|
26973
27357
|
var l = k,
|
|
26974
27358
|
m = h,
|
|
26975
27359
|
q = m.tag;
|
|
@@ -27390,7 +27774,7 @@ function requireReactDom_production_min() {
|
|
|
27390
27774
|
e = Xh(null, b, d, a, e, c);
|
|
27391
27775
|
var f = bi();
|
|
27392
27776
|
b.flags |= 1;
|
|
27393
|
-
"object" === _typeof
|
|
27777
|
+
"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);
|
|
27394
27778
|
return b;
|
|
27395
27779
|
case 16:
|
|
27396
27780
|
d = b.elementType;
|
|
@@ -27631,7 +28015,7 @@ function requireReactDom_production_min() {
|
|
|
27631
28015
|
case Ia:
|
|
27632
28016
|
return qj(c, e, f, b);
|
|
27633
28017
|
default:
|
|
27634
|
-
if ("object" === _typeof
|
|
28018
|
+
if ("object" === _typeof(a) && null !== a) switch (a.$$typeof) {
|
|
27635
28019
|
case Ba:
|
|
27636
28020
|
g = 10;
|
|
27637
28021
|
break a;
|
|
@@ -27649,7 +28033,7 @@ function requireReactDom_production_min() {
|
|
|
27649
28033
|
d = null;
|
|
27650
28034
|
break a;
|
|
27651
28035
|
}
|
|
27652
|
-
throw Error(p(130, null == a ? a : _typeof
|
|
28036
|
+
throw Error(p(130, null == a ? a : _typeof(a), ""));
|
|
27653
28037
|
}
|
|
27654
28038
|
b = Bg(g, c, b, e);
|
|
27655
28039
|
b.elementType = a;
|
|
@@ -28297,7 +28681,7 @@ function requireLib() {
|
|
|
28297
28681
|
};
|
|
28298
28682
|
},
|
|
28299
28683
|
380: function _(e, t, r) {
|
|
28300
|
-
var n = "object" == _typeof
|
|
28684
|
+
var n = "object" == _typeof(r.g) && r.g && r.g.Object === Object && r.g;
|
|
28301
28685
|
e.exports = n;
|
|
28302
28686
|
},
|
|
28303
28687
|
903: function _(e, t, r) {
|
|
@@ -28325,7 +28709,7 @@ function requireLib() {
|
|
|
28325
28709
|
},
|
|
28326
28710
|
433: function _(e, t, r) {
|
|
28327
28711
|
var n = r(380),
|
|
28328
|
-
u = "object" == (typeof self === "undefined" ? "undefined" : _typeof
|
|
28712
|
+
u = "object" == (typeof self === "undefined" ? "undefined" : _typeof(self)) && self && self.Object === Object && self,
|
|
28329
28713
|
o = n || u || Function("return this")();
|
|
28330
28714
|
e.exports = o;
|
|
28331
28715
|
},
|
|
@@ -28394,20 +28778,20 @@ function requireLib() {
|
|
|
28394
28778
|
},
|
|
28395
28779
|
953: function _(e) {
|
|
28396
28780
|
e.exports = function (e) {
|
|
28397
|
-
var t = _typeof
|
|
28781
|
+
var t = _typeof(e);
|
|
28398
28782
|
return null != e && ("object" == t || "function" == t);
|
|
28399
28783
|
};
|
|
28400
28784
|
},
|
|
28401
28785
|
934: function _(e) {
|
|
28402
28786
|
e.exports = function (e) {
|
|
28403
|
-
return null != e && "object" == _typeof
|
|
28787
|
+
return null != e && "object" == _typeof(e);
|
|
28404
28788
|
};
|
|
28405
28789
|
},
|
|
28406
28790
|
414: function _(e, t, r) {
|
|
28407
28791
|
var n = r(148),
|
|
28408
28792
|
u = r(934);
|
|
28409
28793
|
e.exports = function (e) {
|
|
28410
|
-
return "symbol" == _typeof
|
|
28794
|
+
return "symbol" == _typeof(e) || u(e) && "[object Symbol]" == n(e);
|
|
28411
28795
|
};
|
|
28412
28796
|
},
|
|
28413
28797
|
664: function _(e, t, r) {
|
|
@@ -28484,11 +28868,11 @@ function requireLib() {
|
|
|
28484
28868
|
get: t[r]
|
|
28485
28869
|
});
|
|
28486
28870
|
}, u.g = function () {
|
|
28487
|
-
if ("object" == (typeof globalThis === "undefined" ? "undefined" : _typeof
|
|
28871
|
+
if ("object" == (typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis))) return globalThis;
|
|
28488
28872
|
try {
|
|
28489
28873
|
return this || new Function("return this")();
|
|
28490
28874
|
} catch (e) {
|
|
28491
|
-
if ("object" == (typeof window === "undefined" ? "undefined" : _typeof
|
|
28875
|
+
if ("object" == (typeof window === "undefined" ? "undefined" : _typeof(window))) return window;
|
|
28492
28876
|
}
|
|
28493
28877
|
}(), u.o = function (e, t) {
|
|
28494
28878
|
return Object.prototype.hasOwnProperty.call(e, t);
|
|
@@ -28610,7 +28994,7 @@ function requireLib() {
|
|
|
28610
28994
|
}
|
|
28611
28995
|
var h = Object.prototype.constructor.toString();
|
|
28612
28996
|
function p(e) {
|
|
28613
|
-
if (!e || "object" != _typeof
|
|
28997
|
+
if (!e || "object" != _typeof(e)) return !1;
|
|
28614
28998
|
var t = c(e);
|
|
28615
28999
|
if (null === t) return !0;
|
|
28616
29000
|
var r = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
|
|
@@ -28907,7 +29291,7 @@ function requireLib() {
|
|
|
28907
29291
|
}
|
|
28908
29292
|
return k(_u4, r), R(n, _u4);
|
|
28909
29293
|
}
|
|
28910
|
-
if (!e || "object" != _typeof
|
|
29294
|
+
if (!e || "object" != _typeof(e)) {
|
|
28911
29295
|
if (n = t(e), void 0 === n && (n = e), n === a && (n = void 0), _this.autoFreeze_ && E(n, !0), r) {
|
|
28912
29296
|
var _t6 = [],
|
|
28913
29297
|
_u5 = [];
|
|
@@ -29185,10 +29569,10 @@ function requireLib() {
|
|
|
29185
29569
|
}
|
|
29186
29570
|
};
|
|
29187
29571
|
function se(e) {
|
|
29188
|
-
return se = "function" == typeof Symbol && "symbol" == _typeof
|
|
29189
|
-
return _typeof
|
|
29572
|
+
return se = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
29573
|
+
return _typeof(e);
|
|
29190
29574
|
} : function (e) {
|
|
29191
|
-
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof
|
|
29575
|
+
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
29192
29576
|
}, se(e);
|
|
29193
29577
|
}
|
|
29194
29578
|
function le(e, t, r) {
|
|
@@ -33872,7 +34256,7 @@ function requireLib() {
|
|
|
33872
34256
|
Jt = u(858),
|
|
33873
34257
|
Yt = u.n(Jt);
|
|
33874
34258
|
var Zt = function Zt(e) {
|
|
33875
|
-
return "object" == _typeof
|
|
34259
|
+
return "object" == _typeof(e) && null != e && 1 === e.nodeType;
|
|
33876
34260
|
},
|
|
33877
34261
|
Gt = function Gt(e, t) {
|
|
33878
34262
|
return (!t || "hidden" !== e) && "visible" !== e && "clip" !== e;
|
|
@@ -34092,10 +34476,10 @@ function requireLib() {
|
|
|
34092
34476
|
"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);
|
|
34093
34477
|
var Tr = (!Or || !xr) && !Ar && "undefined" != typeof globalThis && globalThis.InputEvent && "function" == typeof globalThis.InputEvent.prototype.getTargetRanges;
|
|
34094
34478
|
function Mr(e) {
|
|
34095
|
-
return Mr = "function" == typeof Symbol && "symbol" == _typeof
|
|
34096
|
-
return _typeof
|
|
34479
|
+
return Mr = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
34480
|
+
return _typeof(e);
|
|
34097
34481
|
} : function (e) {
|
|
34098
|
-
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof
|
|
34482
|
+
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
34099
34483
|
}, Mr(e);
|
|
34100
34484
|
}
|
|
34101
34485
|
function Rr(e, t, r) {
|
|
@@ -35168,10 +35552,10 @@ function requireLib() {
|
|
|
35168
35552
|
return u;
|
|
35169
35553
|
}
|
|
35170
35554
|
function mu(e) {
|
|
35171
|
-
return mu = "function" == typeof Symbol && "symbol" == _typeof
|
|
35172
|
-
return _typeof
|
|
35555
|
+
return mu = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
35556
|
+
return _typeof(e);
|
|
35173
35557
|
} : function (e) {
|
|
35174
|
-
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof
|
|
35558
|
+
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
35175
35559
|
}, mu(e);
|
|
35176
35560
|
}
|
|
35177
35561
|
function yu(e, t, r) {
|
|
@@ -36923,7 +37307,7 @@ function requireLib() {
|
|
|
36923
37307
|
};
|
|
36924
37308
|
}(e);
|
|
36925
37309
|
if (function (e) {
|
|
36926
|
-
return "object" == _typeof
|
|
37310
|
+
return "object" == _typeof(e) && "function" == typeof e.behavior;
|
|
36927
37311
|
}(t)) return t.behavior(rr(e, t));
|
|
36928
37312
|
var n = "boolean" == typeof t || null == t ? void 0 : t.behavior;
|
|
36929
37313
|
var _iterator47 = _createForOfIteratorHelper(rr(e, function (e) {
|
|
@@ -39268,10 +39652,6 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
39268
39652
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
39269
39653
|
inputSize = _React$useState2[0],
|
|
39270
39654
|
setInputSize = _React$useState2[1];
|
|
39271
|
-
var _React$useState3 = React__namespace.default.useState(0),
|
|
39272
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
39273
|
-
labelWidth = _React$useState4[0],
|
|
39274
|
-
setLabelWidth = _React$useState4[1];
|
|
39275
39655
|
var focusAnimation = React.useRef(new reactNative.Animated.Value(0)).current;
|
|
39276
39656
|
React.useEffect(function () {
|
|
39277
39657
|
reactNative.Animated.timing(focusAnimation, {
|
|
@@ -39292,10 +39672,6 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
39292
39672
|
});
|
|
39293
39673
|
});
|
|
39294
39674
|
}, []);
|
|
39295
|
-
var onLabelLayout = React.useCallback(function (event) {
|
|
39296
|
-
var width = event.nativeEvent.layout.width;
|
|
39297
|
-
setLabelWidth(width);
|
|
39298
|
-
}, []);
|
|
39299
39675
|
React.useEffect(function () {
|
|
39300
39676
|
var removeFocusListener = on(emitter, normalizeEventName('editor-focus'), function () {
|
|
39301
39677
|
return setIsFocused(true);
|
|
@@ -39422,12 +39798,12 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
39422
39798
|
transform: [{
|
|
39423
39799
|
translateY: focusAnimation.interpolate({
|
|
39424
39800
|
inputRange: [0, 1],
|
|
39425
|
-
outputRange: [inputSize.height / 2,
|
|
39801
|
+
outputRange: [inputSize.height / 2, theme.space.xsmall]
|
|
39426
39802
|
})
|
|
39427
39803
|
}, {
|
|
39428
39804
|
translateX: focusAnimation.interpolate({
|
|
39429
39805
|
inputRange: [0, 1],
|
|
39430
|
-
outputRange: [
|
|
39806
|
+
outputRange: [theme.space.medium, -theme.space.xlarge + theme.space.xsmall]
|
|
39431
39807
|
})
|
|
39432
39808
|
}, {
|
|
39433
39809
|
scale: focusAnimation.interpolate({
|
|
@@ -39436,19 +39812,18 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
39436
39812
|
})
|
|
39437
39813
|
}]
|
|
39438
39814
|
}]
|
|
39439
|
-
},
|
|
39815
|
+
}, !!label && /*#__PURE__*/React__namespace.default.createElement(StyledLabelInsideTextInput, {
|
|
39440
39816
|
style: {
|
|
39441
39817
|
backgroundColor: theme.__hd__.textInput.colors.labelBackground
|
|
39442
39818
|
},
|
|
39819
|
+
testID: "input-label",
|
|
39443
39820
|
themeState: state
|
|
39444
|
-
},
|
|
39821
|
+
}, required && /*#__PURE__*/React__namespace.default.createElement(StyledAsteriskLabelInsideTextInput, {
|
|
39445
39822
|
style: {
|
|
39446
39823
|
backgroundColor: theme.__hd__.textInput.colors.labelBackground
|
|
39447
39824
|
},
|
|
39448
|
-
|
|
39449
|
-
|
|
39450
|
-
onLayout: onLabelLayout
|
|
39451
|
-
}, label)), /*#__PURE__*/React__namespace.default.createElement(StyledTextInputContainer, {
|
|
39825
|
+
themeState: state
|
|
39826
|
+
}, "*"), label)), /*#__PURE__*/React__namespace.default.createElement(StyledTextInputContainer, {
|
|
39452
39827
|
onLayout: onLayout
|
|
39453
39828
|
}, /*#__PURE__*/React__namespace.default.createElement(StyledBorderBackDrop, {
|
|
39454
39829
|
themeState: state,
|
|
@@ -40067,7 +40442,7 @@ exports.BottomNavigation = BottomNavigation;
|
|
|
40067
40442
|
exports.BottomSheet = BottomSheet$1;
|
|
40068
40443
|
exports.Box = Box;
|
|
40069
40444
|
exports.Button = CompoundButton;
|
|
40070
|
-
exports.Calendar = Calendar;
|
|
40445
|
+
exports.Calendar = Calendar$1;
|
|
40071
40446
|
exports.Card = Card$1;
|
|
40072
40447
|
exports.Carousel = index$8;
|
|
40073
40448
|
exports.Checkbox = Checkbox;
|
|
@@ -40116,7 +40491,7 @@ exports.Toast = Toast;
|
|
|
40116
40491
|
exports.Toolbar = index$1;
|
|
40117
40492
|
exports.Typography = Typography;
|
|
40118
40493
|
exports.eBensSystemPalette = eBensSystemPalette;
|
|
40119
|
-
exports.
|
|
40494
|
+
exports.ehWorkDarkSystemPalette = ehWorkDarkSystemPalette;
|
|
40120
40495
|
exports.getTheme = getTheme$1;
|
|
40121
40496
|
exports.jobsSystemPalette = jobsSystemPalette;
|
|
40122
40497
|
exports.scale = scale;
|