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