@hero-design/rn 8.89.0-alpha.0 → 8.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +13 -0
- package/CHANGELOG.md +10 -0
- package/es/index.js +1441 -1126
- package/lib/index.js +1441 -1127
- package/package.json +2 -3
- package/src/components/Calendar/CalendarRange.tsx +337 -0
- package/src/components/Calendar/CalendarRangeConnector.tsx +68 -0
- package/src/components/Calendar/CalendarRowItem.tsx +14 -3
- package/src/components/Calendar/StyledCalendar.tsx +23 -9
- package/src/components/Calendar/__tests__/CalendarRange.spec.tsx +284 -0
- package/src/components/Calendar/__tests__/CalendarRangeConnector.spec.tsx +73 -0
- package/src/components/Calendar/__tests__/__snapshots__/CalendarRangeConnector.spec.tsx.snap +632 -0
- package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +45 -20
- package/src/components/Calendar/__tests__/helper.spec.ts +110 -1
- package/src/components/Calendar/helpers.ts +75 -0
- package/src/components/Calendar/index.tsx +19 -15
- package/src/components/RichTextEditor/RichTextEditor.tsx +14 -20
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +2 -4
- package/src/index.ts +0 -2
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +9 -4
- package/src/theme/components/calendar.ts +6 -1
- package/src/theme/global/index.ts +0 -2
- package/src/theme/index.ts +0 -2
- package/src/types.ts +2 -0
- package/stats/8.88.0/rn-stats.html +0 -2
- package/stats/8.89.0/rn-stats.html +4842 -0
- package/types/components/Calendar/CalendarRowItem.d.ts +3 -1
- package/types/components/Calendar/StyledCalendar.d.ts +2 -1
- package/types/components/Calendar/helpers.d.ts +15 -0
- package/types/components/Calendar/index.d.ts +4 -2
- package/types/index.d.ts +2 -2
- package/types/theme/components/calendar.d.ts +5 -0
- package/types/theme/global/index.d.ts +1 -2
- package/types/theme/index.d.ts +2 -2
- package/types/types.d.ts +2 -1
- package/src/theme/global/colors/ehWorkDark.ts +0 -60
- 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/types/theme/global/colors/ehWorkDark.d.ts +0 -48
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,62 +2090,6 @@ var eBensBrandSystemPallete = {
|
|
|
2090
2090
|
};
|
|
2091
2091
|
var eBensSystemPalette = _objectSpread2(_objectSpread2({}, swagSystemPalette$1), eBensBrandSystemPallete);
|
|
2092
2092
|
|
|
2093
|
-
var ehWorkDarkPalette = _objectSpread2(_objectSpread2({}, swagLightGlobalPalette), {}, {
|
|
2094
|
-
// Surface
|
|
2095
|
-
defaultGlobalSurface: '#27272A',
|
|
2096
|
-
neutralGlobalSurface: '#121214',
|
|
2097
|
-
darkGlobalSurface: '#fcfbff',
|
|
2098
|
-
overlayGlobalSurface: '#ffffff',
|
|
2099
|
-
// On Surface
|
|
2100
|
-
onDefaultGlobalSurface: '#ffffff',
|
|
2101
|
-
mutedOnDefaultGlobalSurface: '#a9a9b2',
|
|
2102
|
-
inactiveOnDefaultGlobalSurface: '#71717a',
|
|
2103
|
-
disabledOnDefaultGlobalSurface: '#52525b',
|
|
2104
|
-
onOnDarkGlobalSurface: '#121214',
|
|
2105
|
-
// Outline:
|
|
2106
|
-
primaryOutline: '#a9a9b2',
|
|
2107
|
-
secondaryOutline: '#3f3f46',
|
|
2108
|
-
inactiveOutline: '#71717a',
|
|
2109
|
-
disabledOutline: '#52525b',
|
|
2110
|
-
// Archived:
|
|
2111
|
-
archivedSurface: '#52525b',
|
|
2112
|
-
mutedArchived: '#3f3f46',
|
|
2113
|
-
archived: '#71717a',
|
|
2114
|
-
onArchivedSurface: '#a9a9b2',
|
|
2115
|
-
// Error:
|
|
2116
|
-
errorSurface: '#7a1d06',
|
|
2117
|
-
mutedError: '#9b2508',
|
|
2118
|
-
error: '#bd2d09',
|
|
2119
|
-
onErrorSurface: '#fecfca',
|
|
2120
|
-
// Warming:
|
|
2121
|
-
warningSurface: '#963e03',
|
|
2122
|
-
mutedWarning: '#c35004',
|
|
2123
|
-
warning: '#dc6204',
|
|
2124
|
-
onWarningSurface: '#fff0d5',
|
|
2125
|
-
// Success:
|
|
2126
|
-
successSurface: '#00483e',
|
|
2127
|
-
mutedSuccess: '#016256',
|
|
2128
|
-
success: '#017d6d',
|
|
2129
|
-
onSuccessSurface: '#a7f3e9',
|
|
2130
|
-
// Info:
|
|
2131
|
-
infoSurface: '#004a61',
|
|
2132
|
-
mutedInfo: '#006585',
|
|
2133
|
-
info: '#007da3',
|
|
2134
|
-
onInfoSurface: '#a0e8ff',
|
|
2135
|
-
// Brand:
|
|
2136
|
-
primary: '#cdacfe',
|
|
2137
|
-
onPrimary: '#fdfbff',
|
|
2138
|
-
secondary: '#7622d7',
|
|
2139
|
-
onSecondary: '#ffffff',
|
|
2140
|
-
defaultSurface: '#fdfbff',
|
|
2141
|
-
highlightedSurface: '#280541',
|
|
2142
|
-
pressedSurface: '#9a58fc',
|
|
2143
|
-
decorativePrimary: '#fdfbff',
|
|
2144
|
-
decorativePrimarySurface: '#74409a',
|
|
2145
|
-
decorativeSecondary: '#fdfbff',
|
|
2146
|
-
decorativeSecondarySurface: '#f0e6ff'
|
|
2147
|
-
});
|
|
2148
|
-
|
|
2149
2093
|
var BASE_WIDTH = 390; // Based on iPhone 13's viewport size
|
|
2150
2094
|
var horizontalScale = function horizontalScale(size) {
|
|
2151
2095
|
if (reactNative.Platform.OS === 'web') {
|
|
@@ -2712,9 +2656,13 @@ var getCalendarTheme = function getCalendarTheme(theme) {
|
|
|
2712
2656
|
background: theme.colors.defaultGlobalSurface,
|
|
2713
2657
|
border: theme.colors.primaryOutline,
|
|
2714
2658
|
primary: theme.colors.primary,
|
|
2715
|
-
inverted: theme.colors.onDarkGlobalSurface
|
|
2659
|
+
inverted: theme.colors.onDarkGlobalSurface,
|
|
2660
|
+
rowItem: {
|
|
2661
|
+
selected: theme.colors.primary,
|
|
2662
|
+
highlighted: theme.colors.highlightedSurface
|
|
2663
|
+
}
|
|
2716
2664
|
};
|
|
2717
|
-
var cellSize = theme.sizes.
|
|
2665
|
+
var cellSize = theme.sizes.xxxxlarge;
|
|
2718
2666
|
var markSize = theme.sizes.xsmall;
|
|
2719
2667
|
var sizes = {
|
|
2720
2668
|
cellWidth: cellSize,
|
|
@@ -2729,7 +2677,8 @@ var getCalendarTheme = function getCalendarTheme(theme) {
|
|
|
2729
2677
|
headerVerticalPadding: theme.space.medium,
|
|
2730
2678
|
headerHorizontalPadding: theme.space.smallMedium,
|
|
2731
2679
|
headerMarginRight: theme.space.small,
|
|
2732
|
-
iosPickerMarginVertical: theme.space['5xlarge']
|
|
2680
|
+
iosPickerMarginVertical: theme.space['5xlarge'],
|
|
2681
|
+
cellPadding: theme.space.xlarge
|
|
2733
2682
|
};
|
|
2734
2683
|
var radii = {
|
|
2735
2684
|
"default": theme.radii.rounded
|
|
@@ -5979,7 +5928,7 @@ function requireCamelize() {
|
|
|
5979
5928
|
return walk(obj);
|
|
5980
5929
|
};
|
|
5981
5930
|
function walk(obj) {
|
|
5982
|
-
if (!obj || _typeof
|
|
5931
|
+
if (!obj || _typeof(obj) !== 'object') return obj;
|
|
5983
5932
|
if (isDate(obj) || isRegex(obj)) return obj;
|
|
5984
5933
|
if (isArray(obj)) return map(obj, walk);
|
|
5985
5934
|
return reduce(objectKeys(obj), function (acc, key) {
|
|
@@ -6342,7 +6291,7 @@ function requireCssToReactNative() {
|
|
|
6342
6291
|
value: true
|
|
6343
6292
|
});
|
|
6344
6293
|
function _interopDefault(ex) {
|
|
6345
|
-
return ex && _typeof
|
|
6294
|
+
return ex && _typeof(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
|
|
6346
6295
|
}
|
|
6347
6296
|
var parse = requireLib$1();
|
|
6348
6297
|
var parse__default = _interopDefault(parse);
|
|
@@ -7066,7 +7015,7 @@ var generated = {};
|
|
|
7066
7015
|
var buffer = '';
|
|
7067
7016
|
var lastType;
|
|
7068
7017
|
function handleInterpolation(interpolation, i, arr) {
|
|
7069
|
-
var type = _typeof
|
|
7018
|
+
var type = _typeof(interpolation);
|
|
7070
7019
|
if (type === 'string') {
|
|
7071
7020
|
// strip comments
|
|
7072
7021
|
interpolation = interpolation.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '');
|
|
@@ -10601,59 +10550,12 @@ var BottomSheet$1 = Object.assign(BottomSheet, {
|
|
|
10601
10550
|
ScrollView: BottomSheetScrollView
|
|
10602
10551
|
});
|
|
10603
10552
|
|
|
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
10553
|
function requiredArgs(required, args) {
|
|
10615
10554
|
if (args.length < required) {
|
|
10616
10555
|
throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
|
|
10617
10556
|
}
|
|
10618
10557
|
}
|
|
10619
10558
|
|
|
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
10559
|
/**
|
|
10658
10560
|
* @name toDate
|
|
10659
10561
|
* @category Common Helpers
|
|
@@ -10684,11 +10586,11 @@ function isDate(value) {
|
|
|
10684
10586
|
* const result = toDate(1392098430000)
|
|
10685
10587
|
* //=> Tue Feb 11 2014 11:30:30
|
|
10686
10588
|
*/
|
|
10589
|
+
|
|
10687
10590
|
function toDate(argument) {
|
|
10688
10591
|
requiredArgs(1, arguments);
|
|
10689
|
-
var argStr = Object.prototype.toString.call(argument);
|
|
10592
|
+
var argStr = Object.prototype.toString.call(argument); // Clone the date
|
|
10690
10593
|
|
|
10691
|
-
// Clone the date
|
|
10692
10594
|
if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
|
|
10693
10595
|
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
|
|
10694
10596
|
return new Date(argument.getTime());
|
|
@@ -10697,8 +10599,8 @@ function toDate(argument) {
|
|
|
10697
10599
|
} else {
|
|
10698
10600
|
if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
|
|
10699
10601
|
// 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
|
-
|
|
10602
|
+
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
|
|
10603
|
+
|
|
10702
10604
|
console.warn(new Error().stack);
|
|
10703
10605
|
}
|
|
10704
10606
|
return new Date(NaN);
|
|
@@ -10717,34 +10619,544 @@ function toDate(argument) {
|
|
|
10717
10619
|
*
|
|
10718
10620
|
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
|
10719
10621
|
*
|
|
10622
|
+
* ### v2.0.0 breaking changes:
|
|
10623
|
+
*
|
|
10624
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
10625
|
+
*
|
|
10626
|
+
* - Now `isValid` doesn't throw an exception
|
|
10627
|
+
* if the first argument is not an instance of Date.
|
|
10628
|
+
* Instead, argument is converted beforehand using `toDate`.
|
|
10629
|
+
*
|
|
10630
|
+
* Examples:
|
|
10631
|
+
*
|
|
10632
|
+
* | `isValid` argument | Before v2.0.0 | v2.0.0 onward |
|
|
10633
|
+
* |---------------------------|---------------|---------------|
|
|
10634
|
+
* | `new Date()` | `true` | `true` |
|
|
10635
|
+
* | `new Date('2016-01-01')` | `true` | `true` |
|
|
10636
|
+
* | `new Date('')` | `false` | `false` |
|
|
10637
|
+
* | `new Date(1488370835081)` | `true` | `true` |
|
|
10638
|
+
* | `new Date(NaN)` | `false` | `false` |
|
|
10639
|
+
* | `'2016-01-01'` | `TypeError` | `false` |
|
|
10640
|
+
* | `''` | `TypeError` | `false` |
|
|
10641
|
+
* | `1488370835081` | `TypeError` | `true` |
|
|
10642
|
+
* | `NaN` | `TypeError` | `false` |
|
|
10643
|
+
*
|
|
10644
|
+
* We introduce this change to make *date-fns* consistent with ECMAScript behavior
|
|
10645
|
+
* that try to coerce arguments to the expected type
|
|
10646
|
+
* (which is also the case with other *date-fns* functions).
|
|
10647
|
+
*
|
|
10720
10648
|
* @param {*} date - the date to check
|
|
10721
10649
|
* @returns {Boolean} the date is valid
|
|
10722
10650
|
* @throws {TypeError} 1 argument required
|
|
10723
10651
|
*
|
|
10724
10652
|
* @example
|
|
10725
10653
|
* // For the valid date:
|
|
10726
|
-
*
|
|
10654
|
+
* var result = isValid(new Date(2014, 1, 31))
|
|
10727
10655
|
* //=> true
|
|
10728
10656
|
*
|
|
10729
10657
|
* @example
|
|
10730
10658
|
* // For the value, convertable into a date:
|
|
10731
|
-
*
|
|
10659
|
+
* var result = isValid(1393804800000)
|
|
10732
10660
|
* //=> true
|
|
10733
10661
|
*
|
|
10734
10662
|
* @example
|
|
10735
10663
|
* // For the invalid date:
|
|
10736
|
-
*
|
|
10664
|
+
* var result = isValid(new Date(''))
|
|
10737
10665
|
* //=> false
|
|
10738
10666
|
*/
|
|
10667
|
+
|
|
10739
10668
|
function isValid(dirtyDate) {
|
|
10740
10669
|
requiredArgs(1, arguments);
|
|
10741
|
-
if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
|
|
10742
|
-
return false;
|
|
10743
|
-
}
|
|
10744
10670
|
var date = toDate(dirtyDate);
|
|
10745
|
-
return !isNaN(
|
|
10671
|
+
return !isNaN(date);
|
|
10672
|
+
}
|
|
10673
|
+
|
|
10674
|
+
var formatDistanceLocale = {
|
|
10675
|
+
lessThanXSeconds: {
|
|
10676
|
+
one: 'less than a second',
|
|
10677
|
+
other: 'less than {{count}} seconds'
|
|
10678
|
+
},
|
|
10679
|
+
xSeconds: {
|
|
10680
|
+
one: '1 second',
|
|
10681
|
+
other: '{{count}} seconds'
|
|
10682
|
+
},
|
|
10683
|
+
halfAMinute: 'half a minute',
|
|
10684
|
+
lessThanXMinutes: {
|
|
10685
|
+
one: 'less than a minute',
|
|
10686
|
+
other: 'less than {{count}} minutes'
|
|
10687
|
+
},
|
|
10688
|
+
xMinutes: {
|
|
10689
|
+
one: '1 minute',
|
|
10690
|
+
other: '{{count}} minutes'
|
|
10691
|
+
},
|
|
10692
|
+
aboutXHours: {
|
|
10693
|
+
one: 'about 1 hour',
|
|
10694
|
+
other: 'about {{count}} hours'
|
|
10695
|
+
},
|
|
10696
|
+
xHours: {
|
|
10697
|
+
one: '1 hour',
|
|
10698
|
+
other: '{{count}} hours'
|
|
10699
|
+
},
|
|
10700
|
+
xDays: {
|
|
10701
|
+
one: '1 day',
|
|
10702
|
+
other: '{{count}} days'
|
|
10703
|
+
},
|
|
10704
|
+
aboutXWeeks: {
|
|
10705
|
+
one: 'about 1 week',
|
|
10706
|
+
other: 'about {{count}} weeks'
|
|
10707
|
+
},
|
|
10708
|
+
xWeeks: {
|
|
10709
|
+
one: '1 week',
|
|
10710
|
+
other: '{{count}} weeks'
|
|
10711
|
+
},
|
|
10712
|
+
aboutXMonths: {
|
|
10713
|
+
one: 'about 1 month',
|
|
10714
|
+
other: 'about {{count}} months'
|
|
10715
|
+
},
|
|
10716
|
+
xMonths: {
|
|
10717
|
+
one: '1 month',
|
|
10718
|
+
other: '{{count}} months'
|
|
10719
|
+
},
|
|
10720
|
+
aboutXYears: {
|
|
10721
|
+
one: 'about 1 year',
|
|
10722
|
+
other: 'about {{count}} years'
|
|
10723
|
+
},
|
|
10724
|
+
xYears: {
|
|
10725
|
+
one: '1 year',
|
|
10726
|
+
other: '{{count}} years'
|
|
10727
|
+
},
|
|
10728
|
+
overXYears: {
|
|
10729
|
+
one: 'over 1 year',
|
|
10730
|
+
other: 'over {{count}} years'
|
|
10731
|
+
},
|
|
10732
|
+
almostXYears: {
|
|
10733
|
+
one: 'almost 1 year',
|
|
10734
|
+
other: 'almost {{count}} years'
|
|
10735
|
+
}
|
|
10736
|
+
};
|
|
10737
|
+
function formatDistance(token, count, options) {
|
|
10738
|
+
options = options || {};
|
|
10739
|
+
var result;
|
|
10740
|
+
if (typeof formatDistanceLocale[token] === 'string') {
|
|
10741
|
+
result = formatDistanceLocale[token];
|
|
10742
|
+
} else if (count === 1) {
|
|
10743
|
+
result = formatDistanceLocale[token].one;
|
|
10744
|
+
} else {
|
|
10745
|
+
result = formatDistanceLocale[token].other.replace('{{count}}', count);
|
|
10746
|
+
}
|
|
10747
|
+
if (options.addSuffix) {
|
|
10748
|
+
if (options.comparison > 0) {
|
|
10749
|
+
return 'in ' + result;
|
|
10750
|
+
} else {
|
|
10751
|
+
return result + ' ago';
|
|
10752
|
+
}
|
|
10753
|
+
}
|
|
10754
|
+
return result;
|
|
10755
|
+
}
|
|
10756
|
+
|
|
10757
|
+
function buildFormatLongFn(args) {
|
|
10758
|
+
return function (dirtyOptions) {
|
|
10759
|
+
var options = dirtyOptions || {};
|
|
10760
|
+
var width = options.width ? String(options.width) : args.defaultWidth;
|
|
10761
|
+
var format = args.formats[width] || args.formats[args.defaultWidth];
|
|
10762
|
+
return format;
|
|
10763
|
+
};
|
|
10764
|
+
}
|
|
10765
|
+
|
|
10766
|
+
var dateFormats = {
|
|
10767
|
+
full: 'EEEE, MMMM do, y',
|
|
10768
|
+
"long": 'MMMM do, y',
|
|
10769
|
+
medium: 'MMM d, y',
|
|
10770
|
+
"short": 'MM/dd/yyyy'
|
|
10771
|
+
};
|
|
10772
|
+
var timeFormats = {
|
|
10773
|
+
full: 'h:mm:ss a zzzz',
|
|
10774
|
+
"long": 'h:mm:ss a z',
|
|
10775
|
+
medium: 'h:mm:ss a',
|
|
10776
|
+
"short": 'h:mm a'
|
|
10777
|
+
};
|
|
10778
|
+
var dateTimeFormats = {
|
|
10779
|
+
full: "{{date}} 'at' {{time}}",
|
|
10780
|
+
"long": "{{date}} 'at' {{time}}",
|
|
10781
|
+
medium: '{{date}}, {{time}}',
|
|
10782
|
+
"short": '{{date}}, {{time}}'
|
|
10783
|
+
};
|
|
10784
|
+
var formatLong = {
|
|
10785
|
+
date: buildFormatLongFn({
|
|
10786
|
+
formats: dateFormats,
|
|
10787
|
+
defaultWidth: 'full'
|
|
10788
|
+
}),
|
|
10789
|
+
time: buildFormatLongFn({
|
|
10790
|
+
formats: timeFormats,
|
|
10791
|
+
defaultWidth: 'full'
|
|
10792
|
+
}),
|
|
10793
|
+
dateTime: buildFormatLongFn({
|
|
10794
|
+
formats: dateTimeFormats,
|
|
10795
|
+
defaultWidth: 'full'
|
|
10796
|
+
})
|
|
10797
|
+
};
|
|
10798
|
+
|
|
10799
|
+
var formatRelativeLocale = {
|
|
10800
|
+
lastWeek: "'last' eeee 'at' p",
|
|
10801
|
+
yesterday: "'yesterday at' p",
|
|
10802
|
+
today: "'today at' p",
|
|
10803
|
+
tomorrow: "'tomorrow at' p",
|
|
10804
|
+
nextWeek: "eeee 'at' p",
|
|
10805
|
+
other: 'P'
|
|
10806
|
+
};
|
|
10807
|
+
function formatRelative(token, _date, _baseDate, _options) {
|
|
10808
|
+
return formatRelativeLocale[token];
|
|
10809
|
+
}
|
|
10810
|
+
|
|
10811
|
+
function buildLocalizeFn(args) {
|
|
10812
|
+
return function (dirtyIndex, dirtyOptions) {
|
|
10813
|
+
var options = dirtyOptions || {};
|
|
10814
|
+
var context = options.context ? String(options.context) : 'standalone';
|
|
10815
|
+
var valuesArray;
|
|
10816
|
+
if (context === 'formatting' && args.formattingValues) {
|
|
10817
|
+
var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
|
10818
|
+
var width = options.width ? String(options.width) : defaultWidth;
|
|
10819
|
+
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
|
10820
|
+
} else {
|
|
10821
|
+
var _defaultWidth = args.defaultWidth;
|
|
10822
|
+
var _width = options.width ? String(options.width) : args.defaultWidth;
|
|
10823
|
+
valuesArray = args.values[_width] || args.values[_defaultWidth];
|
|
10824
|
+
}
|
|
10825
|
+
var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
|
|
10826
|
+
return valuesArray[index];
|
|
10827
|
+
};
|
|
10828
|
+
}
|
|
10829
|
+
|
|
10830
|
+
var eraValues = {
|
|
10831
|
+
narrow: ['B', 'A'],
|
|
10832
|
+
abbreviated: ['BC', 'AD'],
|
|
10833
|
+
wide: ['Before Christ', 'Anno Domini']
|
|
10834
|
+
};
|
|
10835
|
+
var quarterValues = {
|
|
10836
|
+
narrow: ['1', '2', '3', '4'],
|
|
10837
|
+
abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
|
|
10838
|
+
wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter'] // Note: in English, the names of days of the week and months are capitalized.
|
|
10839
|
+
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
|
|
10840
|
+
// Generally, formatted dates should look like they are in the middle of a sentence,
|
|
10841
|
+
// e.g. in Spanish language the weekdays and months should be in the lowercase.
|
|
10842
|
+
};
|
|
10843
|
+
|
|
10844
|
+
var monthValues = {
|
|
10845
|
+
narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
|
|
10846
|
+
abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
10847
|
+
wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
|
|
10848
|
+
};
|
|
10849
|
+
var dayValues = {
|
|
10850
|
+
narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
|
|
10851
|
+
"short": ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
10852
|
+
abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
10853
|
+
wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
|
|
10854
|
+
};
|
|
10855
|
+
var dayPeriodValues = {
|
|
10856
|
+
narrow: {
|
|
10857
|
+
am: 'a',
|
|
10858
|
+
pm: 'p',
|
|
10859
|
+
midnight: 'mi',
|
|
10860
|
+
noon: 'n',
|
|
10861
|
+
morning: 'morning',
|
|
10862
|
+
afternoon: 'afternoon',
|
|
10863
|
+
evening: 'evening',
|
|
10864
|
+
night: 'night'
|
|
10865
|
+
},
|
|
10866
|
+
abbreviated: {
|
|
10867
|
+
am: 'AM',
|
|
10868
|
+
pm: 'PM',
|
|
10869
|
+
midnight: 'midnight',
|
|
10870
|
+
noon: 'noon',
|
|
10871
|
+
morning: 'morning',
|
|
10872
|
+
afternoon: 'afternoon',
|
|
10873
|
+
evening: 'evening',
|
|
10874
|
+
night: 'night'
|
|
10875
|
+
},
|
|
10876
|
+
wide: {
|
|
10877
|
+
am: 'a.m.',
|
|
10878
|
+
pm: 'p.m.',
|
|
10879
|
+
midnight: 'midnight',
|
|
10880
|
+
noon: 'noon',
|
|
10881
|
+
morning: 'morning',
|
|
10882
|
+
afternoon: 'afternoon',
|
|
10883
|
+
evening: 'evening',
|
|
10884
|
+
night: 'night'
|
|
10885
|
+
}
|
|
10886
|
+
};
|
|
10887
|
+
var formattingDayPeriodValues = {
|
|
10888
|
+
narrow: {
|
|
10889
|
+
am: 'a',
|
|
10890
|
+
pm: 'p',
|
|
10891
|
+
midnight: 'mi',
|
|
10892
|
+
noon: 'n',
|
|
10893
|
+
morning: 'in the morning',
|
|
10894
|
+
afternoon: 'in the afternoon',
|
|
10895
|
+
evening: 'in the evening',
|
|
10896
|
+
night: 'at night'
|
|
10897
|
+
},
|
|
10898
|
+
abbreviated: {
|
|
10899
|
+
am: 'AM',
|
|
10900
|
+
pm: 'PM',
|
|
10901
|
+
midnight: 'midnight',
|
|
10902
|
+
noon: 'noon',
|
|
10903
|
+
morning: 'in the morning',
|
|
10904
|
+
afternoon: 'in the afternoon',
|
|
10905
|
+
evening: 'in the evening',
|
|
10906
|
+
night: 'at night'
|
|
10907
|
+
},
|
|
10908
|
+
wide: {
|
|
10909
|
+
am: 'a.m.',
|
|
10910
|
+
pm: 'p.m.',
|
|
10911
|
+
midnight: 'midnight',
|
|
10912
|
+
noon: 'noon',
|
|
10913
|
+
morning: 'in the morning',
|
|
10914
|
+
afternoon: 'in the afternoon',
|
|
10915
|
+
evening: 'in the evening',
|
|
10916
|
+
night: 'at night'
|
|
10917
|
+
}
|
|
10918
|
+
};
|
|
10919
|
+
function ordinalNumber(dirtyNumber, _dirtyOptions) {
|
|
10920
|
+
var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
|
|
10921
|
+
// if they are different for different grammatical genders,
|
|
10922
|
+
// use `options.unit`:
|
|
10923
|
+
//
|
|
10924
|
+
// var options = dirtyOptions || {}
|
|
10925
|
+
// var unit = String(options.unit)
|
|
10926
|
+
//
|
|
10927
|
+
// where `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
|
|
10928
|
+
// 'day', 'hour', 'minute', 'second'
|
|
10929
|
+
|
|
10930
|
+
var rem100 = number % 100;
|
|
10931
|
+
if (rem100 > 20 || rem100 < 10) {
|
|
10932
|
+
switch (rem100 % 10) {
|
|
10933
|
+
case 1:
|
|
10934
|
+
return number + 'st';
|
|
10935
|
+
case 2:
|
|
10936
|
+
return number + 'nd';
|
|
10937
|
+
case 3:
|
|
10938
|
+
return number + 'rd';
|
|
10939
|
+
}
|
|
10940
|
+
}
|
|
10941
|
+
return number + 'th';
|
|
10942
|
+
}
|
|
10943
|
+
var localize = {
|
|
10944
|
+
ordinalNumber: ordinalNumber,
|
|
10945
|
+
era: buildLocalizeFn({
|
|
10946
|
+
values: eraValues,
|
|
10947
|
+
defaultWidth: 'wide'
|
|
10948
|
+
}),
|
|
10949
|
+
quarter: buildLocalizeFn({
|
|
10950
|
+
values: quarterValues,
|
|
10951
|
+
defaultWidth: 'wide',
|
|
10952
|
+
argumentCallback: function argumentCallback(quarter) {
|
|
10953
|
+
return Number(quarter) - 1;
|
|
10954
|
+
}
|
|
10955
|
+
}),
|
|
10956
|
+
month: buildLocalizeFn({
|
|
10957
|
+
values: monthValues,
|
|
10958
|
+
defaultWidth: 'wide'
|
|
10959
|
+
}),
|
|
10960
|
+
day: buildLocalizeFn({
|
|
10961
|
+
values: dayValues,
|
|
10962
|
+
defaultWidth: 'wide'
|
|
10963
|
+
}),
|
|
10964
|
+
dayPeriod: buildLocalizeFn({
|
|
10965
|
+
values: dayPeriodValues,
|
|
10966
|
+
defaultWidth: 'wide',
|
|
10967
|
+
formattingValues: formattingDayPeriodValues,
|
|
10968
|
+
defaultFormattingWidth: 'wide'
|
|
10969
|
+
})
|
|
10970
|
+
};
|
|
10971
|
+
|
|
10972
|
+
function buildMatchPatternFn(args) {
|
|
10973
|
+
return function (dirtyString, dirtyOptions) {
|
|
10974
|
+
var string = String(dirtyString);
|
|
10975
|
+
var options = dirtyOptions || {};
|
|
10976
|
+
var matchResult = string.match(args.matchPattern);
|
|
10977
|
+
if (!matchResult) {
|
|
10978
|
+
return null;
|
|
10979
|
+
}
|
|
10980
|
+
var matchedString = matchResult[0];
|
|
10981
|
+
var parseResult = string.match(args.parsePattern);
|
|
10982
|
+
if (!parseResult) {
|
|
10983
|
+
return null;
|
|
10984
|
+
}
|
|
10985
|
+
var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
|
10986
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
10987
|
+
return {
|
|
10988
|
+
value: value,
|
|
10989
|
+
rest: string.slice(matchedString.length)
|
|
10990
|
+
};
|
|
10991
|
+
};
|
|
10992
|
+
}
|
|
10993
|
+
|
|
10994
|
+
function buildMatchFn(args) {
|
|
10995
|
+
return function (dirtyString, dirtyOptions) {
|
|
10996
|
+
var string = String(dirtyString);
|
|
10997
|
+
var options = dirtyOptions || {};
|
|
10998
|
+
var width = options.width;
|
|
10999
|
+
var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
|
11000
|
+
var matchResult = string.match(matchPattern);
|
|
11001
|
+
if (!matchResult) {
|
|
11002
|
+
return null;
|
|
11003
|
+
}
|
|
11004
|
+
var matchedString = matchResult[0];
|
|
11005
|
+
var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
|
11006
|
+
var value;
|
|
11007
|
+
if (Object.prototype.toString.call(parsePatterns) === '[object Array]') {
|
|
11008
|
+
value = findIndex(parsePatterns, function (pattern) {
|
|
11009
|
+
return pattern.test(matchedString);
|
|
11010
|
+
});
|
|
11011
|
+
} else {
|
|
11012
|
+
value = findKey(parsePatterns, function (pattern) {
|
|
11013
|
+
return pattern.test(matchedString);
|
|
11014
|
+
});
|
|
11015
|
+
}
|
|
11016
|
+
value = args.valueCallback ? args.valueCallback(value) : value;
|
|
11017
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
11018
|
+
return {
|
|
11019
|
+
value: value,
|
|
11020
|
+
rest: string.slice(matchedString.length)
|
|
11021
|
+
};
|
|
11022
|
+
};
|
|
11023
|
+
}
|
|
11024
|
+
function findKey(object, predicate) {
|
|
11025
|
+
for (var key in object) {
|
|
11026
|
+
if (object.hasOwnProperty(key) && predicate(object[key])) {
|
|
11027
|
+
return key;
|
|
11028
|
+
}
|
|
11029
|
+
}
|
|
11030
|
+
}
|
|
11031
|
+
function findIndex(array, predicate) {
|
|
11032
|
+
for (var key = 0; key < array.length; key++) {
|
|
11033
|
+
if (predicate(array[key])) {
|
|
11034
|
+
return key;
|
|
11035
|
+
}
|
|
11036
|
+
}
|
|
10746
11037
|
}
|
|
10747
11038
|
|
|
11039
|
+
var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
|
11040
|
+
var parseOrdinalNumberPattern = /\d+/i;
|
|
11041
|
+
var matchEraPatterns = {
|
|
11042
|
+
narrow: /^(b|a)/i,
|
|
11043
|
+
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
11044
|
+
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
11045
|
+
};
|
|
11046
|
+
var parseEraPatterns = {
|
|
11047
|
+
any: [/^b/i, /^(a|c)/i]
|
|
11048
|
+
};
|
|
11049
|
+
var matchQuarterPatterns = {
|
|
11050
|
+
narrow: /^[1234]/i,
|
|
11051
|
+
abbreviated: /^q[1234]/i,
|
|
11052
|
+
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
11053
|
+
};
|
|
11054
|
+
var parseQuarterPatterns = {
|
|
11055
|
+
any: [/1/i, /2/i, /3/i, /4/i]
|
|
11056
|
+
};
|
|
11057
|
+
var matchMonthPatterns = {
|
|
11058
|
+
narrow: /^[jfmasond]/i,
|
|
11059
|
+
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
11060
|
+
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
11061
|
+
};
|
|
11062
|
+
var parseMonthPatterns = {
|
|
11063
|
+
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],
|
|
11064
|
+
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]
|
|
11065
|
+
};
|
|
11066
|
+
var matchDayPatterns = {
|
|
11067
|
+
narrow: /^[smtwf]/i,
|
|
11068
|
+
"short": /^(su|mo|tu|we|th|fr|sa)/i,
|
|
11069
|
+
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
11070
|
+
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
11071
|
+
};
|
|
11072
|
+
var parseDayPatterns = {
|
|
11073
|
+
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
11074
|
+
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
11075
|
+
};
|
|
11076
|
+
var matchDayPeriodPatterns = {
|
|
11077
|
+
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
11078
|
+
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
11079
|
+
};
|
|
11080
|
+
var parseDayPeriodPatterns = {
|
|
11081
|
+
any: {
|
|
11082
|
+
am: /^a/i,
|
|
11083
|
+
pm: /^p/i,
|
|
11084
|
+
midnight: /^mi/i,
|
|
11085
|
+
noon: /^no/i,
|
|
11086
|
+
morning: /morning/i,
|
|
11087
|
+
afternoon: /afternoon/i,
|
|
11088
|
+
evening: /evening/i,
|
|
11089
|
+
night: /night/i
|
|
11090
|
+
}
|
|
11091
|
+
};
|
|
11092
|
+
var match = {
|
|
11093
|
+
ordinalNumber: buildMatchPatternFn({
|
|
11094
|
+
matchPattern: matchOrdinalNumberPattern,
|
|
11095
|
+
parsePattern: parseOrdinalNumberPattern,
|
|
11096
|
+
valueCallback: function valueCallback(value) {
|
|
11097
|
+
return parseInt(value, 10);
|
|
11098
|
+
}
|
|
11099
|
+
}),
|
|
11100
|
+
era: buildMatchFn({
|
|
11101
|
+
matchPatterns: matchEraPatterns,
|
|
11102
|
+
defaultMatchWidth: 'wide',
|
|
11103
|
+
parsePatterns: parseEraPatterns,
|
|
11104
|
+
defaultParseWidth: 'any'
|
|
11105
|
+
}),
|
|
11106
|
+
quarter: buildMatchFn({
|
|
11107
|
+
matchPatterns: matchQuarterPatterns,
|
|
11108
|
+
defaultMatchWidth: 'wide',
|
|
11109
|
+
parsePatterns: parseQuarterPatterns,
|
|
11110
|
+
defaultParseWidth: 'any',
|
|
11111
|
+
valueCallback: function valueCallback(index) {
|
|
11112
|
+
return index + 1;
|
|
11113
|
+
}
|
|
11114
|
+
}),
|
|
11115
|
+
month: buildMatchFn({
|
|
11116
|
+
matchPatterns: matchMonthPatterns,
|
|
11117
|
+
defaultMatchWidth: 'wide',
|
|
11118
|
+
parsePatterns: parseMonthPatterns,
|
|
11119
|
+
defaultParseWidth: 'any'
|
|
11120
|
+
}),
|
|
11121
|
+
day: buildMatchFn({
|
|
11122
|
+
matchPatterns: matchDayPatterns,
|
|
11123
|
+
defaultMatchWidth: 'wide',
|
|
11124
|
+
parsePatterns: parseDayPatterns,
|
|
11125
|
+
defaultParseWidth: 'any'
|
|
11126
|
+
}),
|
|
11127
|
+
dayPeriod: buildMatchFn({
|
|
11128
|
+
matchPatterns: matchDayPeriodPatterns,
|
|
11129
|
+
defaultMatchWidth: 'any',
|
|
11130
|
+
parsePatterns: parseDayPeriodPatterns,
|
|
11131
|
+
defaultParseWidth: 'any'
|
|
11132
|
+
})
|
|
11133
|
+
};
|
|
11134
|
+
|
|
11135
|
+
/**
|
|
11136
|
+
* @type {Locale}
|
|
11137
|
+
* @category Locales
|
|
11138
|
+
* @summary English locale (United States).
|
|
11139
|
+
* @language English
|
|
11140
|
+
* @iso-639-2 eng
|
|
11141
|
+
* @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
|
|
11142
|
+
* @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
|
|
11143
|
+
*/
|
|
11144
|
+
|
|
11145
|
+
var locale = {
|
|
11146
|
+
code: 'en-US',
|
|
11147
|
+
formatDistance: formatDistance,
|
|
11148
|
+
formatLong: formatLong,
|
|
11149
|
+
formatRelative: formatRelative,
|
|
11150
|
+
localize: localize,
|
|
11151
|
+
match: match,
|
|
11152
|
+
options: {
|
|
11153
|
+
weekStartsOn: 0
|
|
11154
|
+
/* Sunday */,
|
|
11155
|
+
|
|
11156
|
+
firstWeekContainsDate: 1
|
|
11157
|
+
}
|
|
11158
|
+
};
|
|
11159
|
+
|
|
10748
11160
|
function toInteger(dirtyNumber) {
|
|
10749
11161
|
if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
|
|
10750
11162
|
return NaN;
|
|
@@ -10764,6 +11176,10 @@ function toInteger(dirtyNumber) {
|
|
|
10764
11176
|
* @description
|
|
10765
11177
|
* Add the specified number of milliseconds to the given date.
|
|
10766
11178
|
*
|
|
11179
|
+
* ### v2.0.0 breaking changes:
|
|
11180
|
+
*
|
|
11181
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
11182
|
+
*
|
|
10767
11183
|
* @param {Date|Number} date - the date to be changed
|
|
10768
11184
|
* @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
11185
|
* @returns {Date} the new date with the milliseconds added
|
|
@@ -10771,9 +11187,10 @@ function toInteger(dirtyNumber) {
|
|
|
10771
11187
|
*
|
|
10772
11188
|
* @example
|
|
10773
11189
|
* // Add 750 milliseconds to 10 July 2014 12:45:30.000:
|
|
10774
|
-
*
|
|
11190
|
+
* var result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
|
|
10775
11191
|
* //=> Thu Jul 10 2014 12:45:30.750
|
|
10776
11192
|
*/
|
|
11193
|
+
|
|
10777
11194
|
function addMilliseconds(dirtyDate, dirtyAmount) {
|
|
10778
11195
|
requiredArgs(2, arguments);
|
|
10779
11196
|
var timestamp = toDate(dirtyDate).getTime();
|
|
@@ -10789,6 +11206,10 @@ function addMilliseconds(dirtyDate, dirtyAmount) {
|
|
|
10789
11206
|
* @description
|
|
10790
11207
|
* Subtract the specified number of milliseconds from the given date.
|
|
10791
11208
|
*
|
|
11209
|
+
* ### v2.0.0 breaking changes:
|
|
11210
|
+
*
|
|
11211
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
11212
|
+
*
|
|
10792
11213
|
* @param {Date|Number} date - the date to be changed
|
|
10793
11214
|
* @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
11215
|
* @returns {Date} the new date with the milliseconds subtracted
|
|
@@ -10796,27 +11217,119 @@ function addMilliseconds(dirtyDate, dirtyAmount) {
|
|
|
10796
11217
|
*
|
|
10797
11218
|
* @example
|
|
10798
11219
|
* // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
|
|
10799
|
-
*
|
|
11220
|
+
* var result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
|
|
10800
11221
|
* //=> Thu Jul 10 2014 12:45:29.250
|
|
10801
11222
|
*/
|
|
11223
|
+
|
|
10802
11224
|
function subMilliseconds(dirtyDate, dirtyAmount) {
|
|
10803
11225
|
requiredArgs(2, arguments);
|
|
10804
11226
|
var amount = toInteger(dirtyAmount);
|
|
10805
11227
|
return addMilliseconds(dirtyDate, -amount);
|
|
10806
11228
|
}
|
|
10807
11229
|
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
|
|
10817
|
-
|
|
10818
|
-
|
|
10819
|
-
|
|
11230
|
+
function addLeadingZeros(number, targetLength) {
|
|
11231
|
+
var sign = number < 0 ? '-' : '';
|
|
11232
|
+
var output = Math.abs(number).toString();
|
|
11233
|
+
while (output.length < targetLength) {
|
|
11234
|
+
output = '0' + output;
|
|
11235
|
+
}
|
|
11236
|
+
return sign + output;
|
|
11237
|
+
}
|
|
11238
|
+
|
|
11239
|
+
/*
|
|
11240
|
+
* | | Unit | | Unit |
|
|
11241
|
+
* |-----|--------------------------------|-----|--------------------------------|
|
|
11242
|
+
* | a | AM, PM | A* | |
|
|
11243
|
+
* | d | Day of month | D | |
|
|
11244
|
+
* | h | Hour [1-12] | H | Hour [0-23] |
|
|
11245
|
+
* | m | Minute | M | Month |
|
|
11246
|
+
* | s | Second | S | Fraction of second |
|
|
11247
|
+
* | y | Year (abs) | Y | |
|
|
11248
|
+
*
|
|
11249
|
+
* Letters marked by * are not implemented but reserved by Unicode standard.
|
|
11250
|
+
*/
|
|
11251
|
+
|
|
11252
|
+
var formatters$1 = {
|
|
11253
|
+
// Year
|
|
11254
|
+
y: function y(date, token) {
|
|
11255
|
+
// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
|
|
11256
|
+
// | Year | y | yy | yyy | yyyy | yyyyy |
|
|
11257
|
+
// |----------|-------|----|-------|-------|-------|
|
|
11258
|
+
// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
|
|
11259
|
+
// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
|
|
11260
|
+
// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
|
|
11261
|
+
// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
|
|
11262
|
+
// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
|
|
11263
|
+
var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
11264
|
+
|
|
11265
|
+
var year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
11266
|
+
return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
|
|
11267
|
+
},
|
|
11268
|
+
// Month
|
|
11269
|
+
M: function M(date, token) {
|
|
11270
|
+
var month = date.getUTCMonth();
|
|
11271
|
+
return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
|
|
11272
|
+
},
|
|
11273
|
+
// Day of the month
|
|
11274
|
+
d: function d(date, token) {
|
|
11275
|
+
return addLeadingZeros(date.getUTCDate(), token.length);
|
|
11276
|
+
},
|
|
11277
|
+
// AM or PM
|
|
11278
|
+
a: function a(date, token) {
|
|
11279
|
+
var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
|
|
11280
|
+
switch (token) {
|
|
11281
|
+
case 'a':
|
|
11282
|
+
case 'aa':
|
|
11283
|
+
case 'aaa':
|
|
11284
|
+
return dayPeriodEnumValue.toUpperCase();
|
|
11285
|
+
case 'aaaaa':
|
|
11286
|
+
return dayPeriodEnumValue[0];
|
|
11287
|
+
case 'aaaa':
|
|
11288
|
+
default:
|
|
11289
|
+
return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
|
|
11290
|
+
}
|
|
11291
|
+
},
|
|
11292
|
+
// Hour [1-12]
|
|
11293
|
+
h: function h(date, token) {
|
|
11294
|
+
return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
|
|
11295
|
+
},
|
|
11296
|
+
// Hour [0-23]
|
|
11297
|
+
H: function H(date, token) {
|
|
11298
|
+
return addLeadingZeros(date.getUTCHours(), token.length);
|
|
11299
|
+
},
|
|
11300
|
+
// Minute
|
|
11301
|
+
m: function m(date, token) {
|
|
11302
|
+
return addLeadingZeros(date.getUTCMinutes(), token.length);
|
|
11303
|
+
},
|
|
11304
|
+
// Second
|
|
11305
|
+
s: function s(date, token) {
|
|
11306
|
+
return addLeadingZeros(date.getUTCSeconds(), token.length);
|
|
11307
|
+
},
|
|
11308
|
+
// Fraction of second
|
|
11309
|
+
S: function S(date, token) {
|
|
11310
|
+
var numberOfDigits = token.length;
|
|
11311
|
+
var milliseconds = date.getUTCMilliseconds();
|
|
11312
|
+
var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
|
|
11313
|
+
return addLeadingZeros(fractionalSeconds, token.length);
|
|
11314
|
+
}
|
|
11315
|
+
};
|
|
11316
|
+
|
|
11317
|
+
var MILLISECONDS_IN_DAY = 86400000; // This function will be a part of public API when UTC function will be implemented.
|
|
11318
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
11319
|
+
|
|
11320
|
+
function getUTCDayOfYear(dirtyDate) {
|
|
11321
|
+
requiredArgs(1, arguments);
|
|
11322
|
+
var date = toDate(dirtyDate);
|
|
11323
|
+
var timestamp = date.getTime();
|
|
11324
|
+
date.setUTCMonth(0, 1);
|
|
11325
|
+
date.setUTCHours(0, 0, 0, 0);
|
|
11326
|
+
var startOfYearTimestamp = date.getTime();
|
|
11327
|
+
var difference = timestamp - startOfYearTimestamp;
|
|
11328
|
+
return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
|
|
11329
|
+
}
|
|
11330
|
+
|
|
11331
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
11332
|
+
|
|
10820
11333
|
function startOfUTCISOWeek(dirtyDate) {
|
|
10821
11334
|
requiredArgs(1, arguments);
|
|
10822
11335
|
var weekStartsOn = 1;
|
|
@@ -10828,6 +11341,8 @@ function startOfUTCISOWeek(dirtyDate) {
|
|
|
10828
11341
|
return date;
|
|
10829
11342
|
}
|
|
10830
11343
|
|
|
11344
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
11345
|
+
|
|
10831
11346
|
function getUTCISOWeekYear(dirtyDate) {
|
|
10832
11347
|
requiredArgs(1, arguments);
|
|
10833
11348
|
var date = toDate(dirtyDate);
|
|
@@ -10849,6 +11364,8 @@ function getUTCISOWeekYear(dirtyDate) {
|
|
|
10849
11364
|
}
|
|
10850
11365
|
}
|
|
10851
11366
|
|
|
11367
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
11368
|
+
|
|
10852
11369
|
function startOfUTCISOWeekYear(dirtyDate) {
|
|
10853
11370
|
requiredArgs(1, arguments);
|
|
10854
11371
|
var year = getUTCISOWeekYear(dirtyDate);
|
|
@@ -10859,30 +11376,29 @@ function startOfUTCISOWeekYear(dirtyDate) {
|
|
|
10859
11376
|
return date;
|
|
10860
11377
|
}
|
|
10861
11378
|
|
|
10862
|
-
var MILLISECONDS_IN_WEEK$1 = 604800000;
|
|
11379
|
+
var MILLISECONDS_IN_WEEK$1 = 604800000; // This function will be a part of public API when UTC function will be implemented.
|
|
11380
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
11381
|
+
|
|
10863
11382
|
function getUTCISOWeek(dirtyDate) {
|
|
10864
11383
|
requiredArgs(1, arguments);
|
|
10865
11384
|
var date = toDate(dirtyDate);
|
|
10866
|
-
var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
|
|
10867
|
-
|
|
10868
|
-
// Round the number of days to the nearest integer
|
|
11385
|
+
var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer
|
|
10869
11386
|
// because the number of milliseconds in a week is not constant
|
|
10870
11387
|
// (e.g. it's different in the week of the daylight saving time clock shift)
|
|
11388
|
+
|
|
10871
11389
|
return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
|
|
10872
11390
|
}
|
|
10873
11391
|
|
|
10874
|
-
|
|
10875
|
-
function getDefaultOptions() {
|
|
10876
|
-
return defaultOptions;
|
|
10877
|
-
}
|
|
11392
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
10878
11393
|
|
|
10879
|
-
function startOfUTCWeek(dirtyDate,
|
|
10880
|
-
var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
|
|
11394
|
+
function startOfUTCWeek(dirtyDate, dirtyOptions) {
|
|
10881
11395
|
requiredArgs(1, arguments);
|
|
10882
|
-
var
|
|
10883
|
-
var
|
|
11396
|
+
var options = dirtyOptions || {};
|
|
11397
|
+
var locale = options.locale;
|
|
11398
|
+
var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;
|
|
11399
|
+
var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
|
|
11400
|
+
var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
|
|
10884
11401
|
|
|
10885
|
-
// Test if weekStartsOn is between 0 and 6 _and_ is not NaN
|
|
10886
11402
|
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
|
|
10887
11403
|
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
|
|
10888
11404
|
}
|
|
@@ -10894,26 +11410,29 @@ function startOfUTCWeek(dirtyDate, options) {
|
|
|
10894
11410
|
return date;
|
|
10895
11411
|
}
|
|
10896
11412
|
|
|
10897
|
-
|
|
10898
|
-
|
|
11413
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
11414
|
+
|
|
11415
|
+
function getUTCWeekYear(dirtyDate, dirtyOptions) {
|
|
10899
11416
|
requiredArgs(1, arguments);
|
|
10900
|
-
var date = toDate(dirtyDate);
|
|
11417
|
+
var date = toDate(dirtyDate, dirtyOptions);
|
|
10901
11418
|
var year = date.getUTCFullYear();
|
|
10902
|
-
var
|
|
10903
|
-
var
|
|
11419
|
+
var options = dirtyOptions || {};
|
|
11420
|
+
var locale = options.locale;
|
|
11421
|
+
var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
|
|
11422
|
+
var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
|
|
11423
|
+
var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
|
|
10904
11424
|
|
|
10905
|
-
// Test if weekStartsOn is between 1 and 7 _and_ is not NaN
|
|
10906
11425
|
if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
|
|
10907
11426
|
throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
|
|
10908
11427
|
}
|
|
10909
11428
|
var firstWeekOfNextYear = new Date(0);
|
|
10910
11429
|
firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
|
|
10911
11430
|
firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
|
|
10912
|
-
var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear,
|
|
11431
|
+
var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, dirtyOptions);
|
|
10913
11432
|
var firstWeekOfThisYear = new Date(0);
|
|
10914
11433
|
firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
|
|
10915
11434
|
firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
|
|
10916
|
-
var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear,
|
|
11435
|
+
var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, dirtyOptions);
|
|
10917
11436
|
if (date.getTime() >= startOfNextYear.getTime()) {
|
|
10918
11437
|
return year + 1;
|
|
10919
11438
|
} else if (date.getTime() >= startOfThisYear.getTime()) {
|
|
@@ -10923,119 +11442,36 @@ function getUTCWeekYear(dirtyDate, options) {
|
|
|
10923
11442
|
}
|
|
10924
11443
|
}
|
|
10925
11444
|
|
|
10926
|
-
|
|
10927
|
-
|
|
11445
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
11446
|
+
|
|
11447
|
+
function startOfUTCWeekYear(dirtyDate, dirtyOptions) {
|
|
10928
11448
|
requiredArgs(1, arguments);
|
|
10929
|
-
var
|
|
10930
|
-
var
|
|
10931
|
-
var
|
|
11449
|
+
var options = dirtyOptions || {};
|
|
11450
|
+
var locale = options.locale;
|
|
11451
|
+
var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
|
|
11452
|
+
var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
|
|
11453
|
+
var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
|
|
11454
|
+
var year = getUTCWeekYear(dirtyDate, dirtyOptions);
|
|
10932
11455
|
var firstWeek = new Date(0);
|
|
10933
11456
|
firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
|
|
10934
11457
|
firstWeek.setUTCHours(0, 0, 0, 0);
|
|
10935
|
-
var date = startOfUTCWeek(firstWeek,
|
|
11458
|
+
var date = startOfUTCWeek(firstWeek, dirtyOptions);
|
|
10936
11459
|
return date;
|
|
10937
11460
|
}
|
|
10938
11461
|
|
|
10939
|
-
var MILLISECONDS_IN_WEEK = 604800000;
|
|
11462
|
+
var MILLISECONDS_IN_WEEK = 604800000; // This function will be a part of public API when UTC function will be implemented.
|
|
11463
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
11464
|
+
|
|
10940
11465
|
function getUTCWeek(dirtyDate, options) {
|
|
10941
11466
|
requiredArgs(1, arguments);
|
|
10942
11467
|
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
|
|
11468
|
+
var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer
|
|
10946
11469
|
// because the number of milliseconds in a week is not constant
|
|
10947
11470
|
// (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
11471
|
|
|
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;
|
|
11472
|
+
return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
|
|
10958
11473
|
}
|
|
10959
11474
|
|
|
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
11475
|
var dayPeriodEnum = {
|
|
11040
11476
|
am: 'am',
|
|
11041
11477
|
pm: 'pm',
|
|
@@ -11045,52 +11481,52 @@ var dayPeriodEnum = {
|
|
|
11045
11481
|
afternoon: 'afternoon',
|
|
11046
11482
|
evening: 'evening',
|
|
11047
11483
|
night: 'night'
|
|
11484
|
+
/*
|
|
11485
|
+
* | | Unit | | Unit |
|
|
11486
|
+
* |-----|--------------------------------|-----|--------------------------------|
|
|
11487
|
+
* | a | AM, PM | A* | Milliseconds in day |
|
|
11488
|
+
* | b | AM, PM, noon, midnight | B | Flexible day period |
|
|
11489
|
+
* | c | Stand-alone local day of week | C* | Localized hour w/ day period |
|
|
11490
|
+
* | d | Day of month | D | Day of year |
|
|
11491
|
+
* | e | Local day of week | E | Day of week |
|
|
11492
|
+
* | f | | F* | Day of week in month |
|
|
11493
|
+
* | g* | Modified Julian day | G | Era |
|
|
11494
|
+
* | h | Hour [1-12] | H | Hour [0-23] |
|
|
11495
|
+
* | i! | ISO day of week | I! | ISO week of year |
|
|
11496
|
+
* | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
|
|
11497
|
+
* | k | Hour [1-24] | K | Hour [0-11] |
|
|
11498
|
+
* | l* | (deprecated) | L | Stand-alone month |
|
|
11499
|
+
* | m | Minute | M | Month |
|
|
11500
|
+
* | n | | N | |
|
|
11501
|
+
* | o! | Ordinal number modifier | O | Timezone (GMT) |
|
|
11502
|
+
* | p! | Long localized time | P! | Long localized date |
|
|
11503
|
+
* | q | Stand-alone quarter | Q | Quarter |
|
|
11504
|
+
* | r* | Related Gregorian year | R! | ISO week-numbering year |
|
|
11505
|
+
* | s | Second | S | Fraction of second |
|
|
11506
|
+
* | t! | Seconds timestamp | T! | Milliseconds timestamp |
|
|
11507
|
+
* | u | Extended year | U* | Cyclic year |
|
|
11508
|
+
* | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
|
|
11509
|
+
* | w | Local week of year | W* | Week of month |
|
|
11510
|
+
* | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
|
|
11511
|
+
* | y | Year (abs) | Y | Local week-numbering year |
|
|
11512
|
+
* | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
|
|
11513
|
+
*
|
|
11514
|
+
* Letters marked by * are not implemented but reserved by Unicode standard.
|
|
11515
|
+
*
|
|
11516
|
+
* Letters marked by ! are non-standard, but implemented by date-fns:
|
|
11517
|
+
* - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
|
|
11518
|
+
* - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
|
|
11519
|
+
* i.e. 7 for Sunday, 1 for Monday, etc.
|
|
11520
|
+
* - `I` is ISO week of year, as opposed to `w` which is local week of year.
|
|
11521
|
+
* - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
|
|
11522
|
+
* `R` is supposed to be used in conjunction with `I` and `i`
|
|
11523
|
+
* for universal ISO week-numbering date, whereas
|
|
11524
|
+
* `Y` is supposed to be used in conjunction with `w` and `e`
|
|
11525
|
+
* for week-numbering date specific to the locale.
|
|
11526
|
+
* - `P` is long localized date format
|
|
11527
|
+
* - `p` is long localized time format
|
|
11528
|
+
*/
|
|
11048
11529
|
};
|
|
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
11530
|
|
|
11095
11531
|
var formatters = {
|
|
11096
11532
|
// Era
|
|
@@ -11105,11 +11541,13 @@ var formatters = {
|
|
|
11105
11541
|
width: 'abbreviated'
|
|
11106
11542
|
});
|
|
11107
11543
|
// A, B
|
|
11544
|
+
|
|
11108
11545
|
case 'GGGGG':
|
|
11109
11546
|
return localize.era(era, {
|
|
11110
11547
|
width: 'narrow'
|
|
11111
11548
|
});
|
|
11112
11549
|
// Anno Domini, Before Christ
|
|
11550
|
+
|
|
11113
11551
|
case 'GGGG':
|
|
11114
11552
|
default:
|
|
11115
11553
|
return localize.era(era, {
|
|
@@ -11121,8 +11559,8 @@ var formatters = {
|
|
|
11121
11559
|
y: function y(date, token, localize) {
|
|
11122
11560
|
// Ordinal number
|
|
11123
11561
|
if (token === 'yo') {
|
|
11124
|
-
var signedYear = date.getUTCFullYear();
|
|
11125
|
-
|
|
11562
|
+
var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
11563
|
+
|
|
11126
11564
|
var year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
11127
11565
|
return localize.ordinalNumber(year, {
|
|
11128
11566
|
unit: 'year'
|
|
@@ -11132,31 +11570,27 @@ var formatters = {
|
|
|
11132
11570
|
},
|
|
11133
11571
|
// Local week-numbering year
|
|
11134
11572
|
Y: function Y(date, token, localize, options) {
|
|
11135
|
-
var signedWeekYear = getUTCWeekYear(date, options);
|
|
11136
|
-
|
|
11137
|
-
var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
|
|
11573
|
+
var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
11574
|
+
|
|
11575
|
+
var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year
|
|
11138
11576
|
|
|
11139
|
-
// Two digit year
|
|
11140
11577
|
if (token === 'YY') {
|
|
11141
11578
|
var twoDigitYear = weekYear % 100;
|
|
11142
11579
|
return addLeadingZeros(twoDigitYear, 2);
|
|
11143
|
-
}
|
|
11580
|
+
} // Ordinal number
|
|
11144
11581
|
|
|
11145
|
-
// Ordinal number
|
|
11146
11582
|
if (token === 'Yo') {
|
|
11147
11583
|
return localize.ordinalNumber(weekYear, {
|
|
11148
11584
|
unit: 'year'
|
|
11149
11585
|
});
|
|
11150
|
-
}
|
|
11586
|
+
} // Padding
|
|
11151
11587
|
|
|
11152
|
-
// Padding
|
|
11153
11588
|
return addLeadingZeros(weekYear, token.length);
|
|
11154
11589
|
},
|
|
11155
11590
|
// ISO week-numbering year
|
|
11156
11591
|
R: function R(date, token) {
|
|
11157
|
-
var isoWeekYear = getUTCISOWeekYear(date);
|
|
11592
|
+
var isoWeekYear = getUTCISOWeekYear(date); // Padding
|
|
11158
11593
|
|
|
11159
|
-
// Padding
|
|
11160
11594
|
return addLeadingZeros(isoWeekYear, token.length);
|
|
11161
11595
|
},
|
|
11162
11596
|
// Extended year. This is a single number designating the year of this calendar system.
|
|
@@ -11180,26 +11614,31 @@ var formatters = {
|
|
|
11180
11614
|
case 'Q':
|
|
11181
11615
|
return String(quarter);
|
|
11182
11616
|
// 01, 02, 03, 04
|
|
11617
|
+
|
|
11183
11618
|
case 'QQ':
|
|
11184
11619
|
return addLeadingZeros(quarter, 2);
|
|
11185
11620
|
// 1st, 2nd, 3rd, 4th
|
|
11621
|
+
|
|
11186
11622
|
case 'Qo':
|
|
11187
11623
|
return localize.ordinalNumber(quarter, {
|
|
11188
11624
|
unit: 'quarter'
|
|
11189
11625
|
});
|
|
11190
11626
|
// Q1, Q2, Q3, Q4
|
|
11627
|
+
|
|
11191
11628
|
case 'QQQ':
|
|
11192
11629
|
return localize.quarter(quarter, {
|
|
11193
11630
|
width: 'abbreviated',
|
|
11194
11631
|
context: 'formatting'
|
|
11195
11632
|
});
|
|
11196
11633
|
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
11634
|
+
|
|
11197
11635
|
case 'QQQQQ':
|
|
11198
11636
|
return localize.quarter(quarter, {
|
|
11199
11637
|
width: 'narrow',
|
|
11200
11638
|
context: 'formatting'
|
|
11201
11639
|
});
|
|
11202
11640
|
// 1st quarter, 2nd quarter, ...
|
|
11641
|
+
|
|
11203
11642
|
case 'QQQQ':
|
|
11204
11643
|
default:
|
|
11205
11644
|
return localize.quarter(quarter, {
|
|
@@ -11216,26 +11655,31 @@ var formatters = {
|
|
|
11216
11655
|
case 'q':
|
|
11217
11656
|
return String(quarter);
|
|
11218
11657
|
// 01, 02, 03, 04
|
|
11658
|
+
|
|
11219
11659
|
case 'qq':
|
|
11220
11660
|
return addLeadingZeros(quarter, 2);
|
|
11221
11661
|
// 1st, 2nd, 3rd, 4th
|
|
11662
|
+
|
|
11222
11663
|
case 'qo':
|
|
11223
11664
|
return localize.ordinalNumber(quarter, {
|
|
11224
11665
|
unit: 'quarter'
|
|
11225
11666
|
});
|
|
11226
11667
|
// Q1, Q2, Q3, Q4
|
|
11668
|
+
|
|
11227
11669
|
case 'qqq':
|
|
11228
11670
|
return localize.quarter(quarter, {
|
|
11229
11671
|
width: 'abbreviated',
|
|
11230
11672
|
context: 'standalone'
|
|
11231
11673
|
});
|
|
11232
11674
|
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
11675
|
+
|
|
11233
11676
|
case 'qqqqq':
|
|
11234
11677
|
return localize.quarter(quarter, {
|
|
11235
11678
|
width: 'narrow',
|
|
11236
11679
|
context: 'standalone'
|
|
11237
11680
|
});
|
|
11238
11681
|
// 1st quarter, 2nd quarter, ...
|
|
11682
|
+
|
|
11239
11683
|
case 'qqqq':
|
|
11240
11684
|
default:
|
|
11241
11685
|
return localize.quarter(quarter, {
|
|
@@ -11252,23 +11696,27 @@ var formatters = {
|
|
|
11252
11696
|
case 'MM':
|
|
11253
11697
|
return formatters$1.M(date, token);
|
|
11254
11698
|
// 1st, 2nd, ..., 12th
|
|
11699
|
+
|
|
11255
11700
|
case 'Mo':
|
|
11256
11701
|
return localize.ordinalNumber(month + 1, {
|
|
11257
11702
|
unit: 'month'
|
|
11258
11703
|
});
|
|
11259
11704
|
// Jan, Feb, ..., Dec
|
|
11705
|
+
|
|
11260
11706
|
case 'MMM':
|
|
11261
11707
|
return localize.month(month, {
|
|
11262
11708
|
width: 'abbreviated',
|
|
11263
11709
|
context: 'formatting'
|
|
11264
11710
|
});
|
|
11265
11711
|
// J, F, ..., D
|
|
11712
|
+
|
|
11266
11713
|
case 'MMMMM':
|
|
11267
11714
|
return localize.month(month, {
|
|
11268
11715
|
width: 'narrow',
|
|
11269
11716
|
context: 'formatting'
|
|
11270
11717
|
});
|
|
11271
11718
|
// January, February, ..., December
|
|
11719
|
+
|
|
11272
11720
|
case 'MMMM':
|
|
11273
11721
|
default:
|
|
11274
11722
|
return localize.month(month, {
|
|
@@ -11285,26 +11733,31 @@ var formatters = {
|
|
|
11285
11733
|
case 'L':
|
|
11286
11734
|
return String(month + 1);
|
|
11287
11735
|
// 01, 02, ..., 12
|
|
11736
|
+
|
|
11288
11737
|
case 'LL':
|
|
11289
11738
|
return addLeadingZeros(month + 1, 2);
|
|
11290
11739
|
// 1st, 2nd, ..., 12th
|
|
11740
|
+
|
|
11291
11741
|
case 'Lo':
|
|
11292
11742
|
return localize.ordinalNumber(month + 1, {
|
|
11293
11743
|
unit: 'month'
|
|
11294
11744
|
});
|
|
11295
11745
|
// Jan, Feb, ..., Dec
|
|
11746
|
+
|
|
11296
11747
|
case 'LLL':
|
|
11297
11748
|
return localize.month(month, {
|
|
11298
11749
|
width: 'abbreviated',
|
|
11299
11750
|
context: 'standalone'
|
|
11300
11751
|
});
|
|
11301
11752
|
// J, F, ..., D
|
|
11753
|
+
|
|
11302
11754
|
case 'LLLLL':
|
|
11303
11755
|
return localize.month(month, {
|
|
11304
11756
|
width: 'narrow',
|
|
11305
11757
|
context: 'standalone'
|
|
11306
11758
|
});
|
|
11307
11759
|
// January, February, ..., December
|
|
11760
|
+
|
|
11308
11761
|
case 'LLLL':
|
|
11309
11762
|
default:
|
|
11310
11763
|
return localize.month(month, {
|
|
@@ -11365,18 +11818,21 @@ var formatters = {
|
|
|
11365
11818
|
context: 'formatting'
|
|
11366
11819
|
});
|
|
11367
11820
|
// T
|
|
11821
|
+
|
|
11368
11822
|
case 'EEEEE':
|
|
11369
11823
|
return localize.day(dayOfWeek, {
|
|
11370
11824
|
width: 'narrow',
|
|
11371
11825
|
context: 'formatting'
|
|
11372
11826
|
});
|
|
11373
11827
|
// Tu
|
|
11828
|
+
|
|
11374
11829
|
case 'EEEEEE':
|
|
11375
11830
|
return localize.day(dayOfWeek, {
|
|
11376
11831
|
width: 'short',
|
|
11377
11832
|
context: 'formatting'
|
|
11378
11833
|
});
|
|
11379
11834
|
// Tuesday
|
|
11835
|
+
|
|
11380
11836
|
case 'EEEE':
|
|
11381
11837
|
default:
|
|
11382
11838
|
return localize.day(dayOfWeek, {
|
|
@@ -11394,9 +11850,11 @@ var formatters = {
|
|
|
11394
11850
|
case 'e':
|
|
11395
11851
|
return String(localDayOfWeek);
|
|
11396
11852
|
// Padded numerical value
|
|
11853
|
+
|
|
11397
11854
|
case 'ee':
|
|
11398
11855
|
return addLeadingZeros(localDayOfWeek, 2);
|
|
11399
11856
|
// 1st, 2nd, ..., 7th
|
|
11857
|
+
|
|
11400
11858
|
case 'eo':
|
|
11401
11859
|
return localize.ordinalNumber(localDayOfWeek, {
|
|
11402
11860
|
unit: 'day'
|
|
@@ -11407,18 +11865,21 @@ var formatters = {
|
|
|
11407
11865
|
context: 'formatting'
|
|
11408
11866
|
});
|
|
11409
11867
|
// T
|
|
11868
|
+
|
|
11410
11869
|
case 'eeeee':
|
|
11411
11870
|
return localize.day(dayOfWeek, {
|
|
11412
11871
|
width: 'narrow',
|
|
11413
11872
|
context: 'formatting'
|
|
11414
11873
|
});
|
|
11415
11874
|
// Tu
|
|
11875
|
+
|
|
11416
11876
|
case 'eeeeee':
|
|
11417
11877
|
return localize.day(dayOfWeek, {
|
|
11418
11878
|
width: 'short',
|
|
11419
11879
|
context: 'formatting'
|
|
11420
11880
|
});
|
|
11421
11881
|
// Tuesday
|
|
11882
|
+
|
|
11422
11883
|
case 'eeee':
|
|
11423
11884
|
default:
|
|
11424
11885
|
return localize.day(dayOfWeek, {
|
|
@@ -11436,9 +11897,11 @@ var formatters = {
|
|
|
11436
11897
|
case 'c':
|
|
11437
11898
|
return String(localDayOfWeek);
|
|
11438
11899
|
// Padded numerical value
|
|
11900
|
+
|
|
11439
11901
|
case 'cc':
|
|
11440
11902
|
return addLeadingZeros(localDayOfWeek, token.length);
|
|
11441
11903
|
// 1st, 2nd, ..., 7th
|
|
11904
|
+
|
|
11442
11905
|
case 'co':
|
|
11443
11906
|
return localize.ordinalNumber(localDayOfWeek, {
|
|
11444
11907
|
unit: 'day'
|
|
@@ -11449,18 +11912,21 @@ var formatters = {
|
|
|
11449
11912
|
context: 'standalone'
|
|
11450
11913
|
});
|
|
11451
11914
|
// T
|
|
11915
|
+
|
|
11452
11916
|
case 'ccccc':
|
|
11453
11917
|
return localize.day(dayOfWeek, {
|
|
11454
11918
|
width: 'narrow',
|
|
11455
11919
|
context: 'standalone'
|
|
11456
11920
|
});
|
|
11457
11921
|
// Tu
|
|
11922
|
+
|
|
11458
11923
|
case 'cccccc':
|
|
11459
11924
|
return localize.day(dayOfWeek, {
|
|
11460
11925
|
width: 'short',
|
|
11461
11926
|
context: 'standalone'
|
|
11462
11927
|
});
|
|
11463
11928
|
// Tuesday
|
|
11929
|
+
|
|
11464
11930
|
case 'cccc':
|
|
11465
11931
|
default:
|
|
11466
11932
|
return localize.day(dayOfWeek, {
|
|
@@ -11478,32 +11944,38 @@ var formatters = {
|
|
|
11478
11944
|
case 'i':
|
|
11479
11945
|
return String(isoDayOfWeek);
|
|
11480
11946
|
// 02
|
|
11947
|
+
|
|
11481
11948
|
case 'ii':
|
|
11482
11949
|
return addLeadingZeros(isoDayOfWeek, token.length);
|
|
11483
11950
|
// 2nd
|
|
11951
|
+
|
|
11484
11952
|
case 'io':
|
|
11485
11953
|
return localize.ordinalNumber(isoDayOfWeek, {
|
|
11486
11954
|
unit: 'day'
|
|
11487
11955
|
});
|
|
11488
11956
|
// Tue
|
|
11957
|
+
|
|
11489
11958
|
case 'iii':
|
|
11490
11959
|
return localize.day(dayOfWeek, {
|
|
11491
11960
|
width: 'abbreviated',
|
|
11492
11961
|
context: 'formatting'
|
|
11493
11962
|
});
|
|
11494
11963
|
// T
|
|
11964
|
+
|
|
11495
11965
|
case 'iiiii':
|
|
11496
11966
|
return localize.day(dayOfWeek, {
|
|
11497
11967
|
width: 'narrow',
|
|
11498
11968
|
context: 'formatting'
|
|
11499
11969
|
});
|
|
11500
11970
|
// Tu
|
|
11971
|
+
|
|
11501
11972
|
case 'iiiiii':
|
|
11502
11973
|
return localize.day(dayOfWeek, {
|
|
11503
11974
|
width: 'short',
|
|
11504
11975
|
context: 'formatting'
|
|
11505
11976
|
});
|
|
11506
11977
|
// Tuesday
|
|
11978
|
+
|
|
11507
11979
|
case 'iiii':
|
|
11508
11980
|
default:
|
|
11509
11981
|
return localize.day(dayOfWeek, {
|
|
@@ -11519,15 +11991,11 @@ var formatters = {
|
|
|
11519
11991
|
switch (token) {
|
|
11520
11992
|
case 'a':
|
|
11521
11993
|
case 'aa':
|
|
11522
|
-
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
11523
|
-
width: 'abbreviated',
|
|
11524
|
-
context: 'formatting'
|
|
11525
|
-
});
|
|
11526
11994
|
case 'aaa':
|
|
11527
11995
|
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
11528
11996
|
width: 'abbreviated',
|
|
11529
11997
|
context: 'formatting'
|
|
11530
|
-
})
|
|
11998
|
+
});
|
|
11531
11999
|
case 'aaaaa':
|
|
11532
12000
|
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
11533
12001
|
width: 'narrow',
|
|
@@ -11555,15 +12023,11 @@ var formatters = {
|
|
|
11555
12023
|
switch (token) {
|
|
11556
12024
|
case 'b':
|
|
11557
12025
|
case 'bb':
|
|
11558
|
-
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
11559
|
-
width: 'abbreviated',
|
|
11560
|
-
context: 'formatting'
|
|
11561
|
-
});
|
|
11562
12026
|
case 'bbb':
|
|
11563
12027
|
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
11564
12028
|
width: 'abbreviated',
|
|
11565
12029
|
context: 'formatting'
|
|
11566
|
-
})
|
|
12030
|
+
});
|
|
11567
12031
|
case 'bbbbb':
|
|
11568
12032
|
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
11569
12033
|
width: 'narrow',
|
|
@@ -11685,20 +12149,21 @@ var formatters = {
|
|
|
11685
12149
|
// Hours and optional minutes
|
|
11686
12150
|
case 'X':
|
|
11687
12151
|
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
11688
|
-
|
|
11689
12152
|
// Hours, minutes and optional seconds without `:` delimiter
|
|
11690
12153
|
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
11691
12154
|
// so this token always has the same output as `XX`
|
|
12155
|
+
|
|
11692
12156
|
case 'XXXX':
|
|
11693
12157
|
case 'XX':
|
|
11694
12158
|
// Hours and minutes without `:` delimiter
|
|
11695
12159
|
return formatTimezone(timezoneOffset);
|
|
11696
|
-
|
|
11697
12160
|
// Hours, minutes and optional seconds with `:` delimiter
|
|
11698
12161
|
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
11699
12162
|
// so this token always has the same output as `XXX`
|
|
12163
|
+
|
|
11700
12164
|
case 'XXXXX':
|
|
11701
12165
|
case 'XXX': // Hours and minutes with `:` delimiter
|
|
12166
|
+
|
|
11702
12167
|
default:
|
|
11703
12168
|
return formatTimezone(timezoneOffset, ':');
|
|
11704
12169
|
}
|
|
@@ -11711,20 +12176,21 @@ var formatters = {
|
|
|
11711
12176
|
// Hours and optional minutes
|
|
11712
12177
|
case 'x':
|
|
11713
12178
|
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
11714
|
-
|
|
11715
12179
|
// Hours, minutes and optional seconds without `:` delimiter
|
|
11716
12180
|
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
11717
12181
|
// so this token always has the same output as `xx`
|
|
12182
|
+
|
|
11718
12183
|
case 'xxxx':
|
|
11719
12184
|
case 'xx':
|
|
11720
12185
|
// Hours and minutes without `:` delimiter
|
|
11721
12186
|
return formatTimezone(timezoneOffset);
|
|
11722
|
-
|
|
11723
12187
|
// Hours, minutes and optional seconds with `:` delimiter
|
|
11724
12188
|
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
11725
12189
|
// so this token always has the same output as `xxx`
|
|
12190
|
+
|
|
11726
12191
|
case 'xxxxx':
|
|
11727
12192
|
case 'xxx': // Hours and minutes with `:` delimiter
|
|
12193
|
+
|
|
11728
12194
|
default:
|
|
11729
12195
|
return formatTimezone(timezoneOffset, ':');
|
|
11730
12196
|
}
|
|
@@ -11740,661 +12206,193 @@ var formatters = {
|
|
|
11740
12206
|
case 'OOO':
|
|
11741
12207
|
return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
|
|
11742
12208
|
// Long
|
|
12209
|
+
|
|
11743
12210
|
case 'OOOO':
|
|
11744
12211
|
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;
|
|
12212
|
+
return 'GMT' + formatTimezone(timezoneOffset, ':');
|
|
12213
|
+
}
|
|
12214
|
+
},
|
|
12215
|
+
// Timezone (specific non-location)
|
|
12216
|
+
z: function z(date, token, _localize, options) {
|
|
12217
|
+
var originalDate = options._originalDate || date;
|
|
12218
|
+
var timezoneOffset = originalDate.getTimezoneOffset();
|
|
12219
|
+
switch (token) {
|
|
12220
|
+
// Short
|
|
12221
|
+
case 'z':
|
|
12222
|
+
case 'zz':
|
|
12223
|
+
case 'zzz':
|
|
12224
|
+
return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
|
|
12225
|
+
// Long
|
|
12226
|
+
|
|
12227
|
+
case 'zzzz':
|
|
12228
|
+
default:
|
|
12229
|
+
return 'GMT' + formatTimezone(timezoneOffset, ':');
|
|
12250
12230
|
}
|
|
12231
|
+
},
|
|
12232
|
+
// Seconds timestamp
|
|
12233
|
+
t: function t(date, token, _localize, options) {
|
|
12234
|
+
var originalDate = options._originalDate || date;
|
|
12235
|
+
var timestamp = Math.floor(originalDate.getTime() / 1000);
|
|
12236
|
+
return addLeadingZeros(timestamp, token.length);
|
|
12237
|
+
},
|
|
12238
|
+
// Milliseconds timestamp
|
|
12239
|
+
T: function T(date, token, _localize, options) {
|
|
12240
|
+
var originalDate = options._originalDate || date;
|
|
12241
|
+
var timestamp = originalDate.getTime();
|
|
12242
|
+
return addLeadingZeros(timestamp, token.length);
|
|
12251
12243
|
}
|
|
12252
|
-
|
|
12244
|
+
};
|
|
12245
|
+
function formatTimezoneShort(offset, dirtyDelimiter) {
|
|
12246
|
+
var sign = offset > 0 ? '-' : '+';
|
|
12247
|
+
var absOffset = Math.abs(offset);
|
|
12248
|
+
var hours = Math.floor(absOffset / 60);
|
|
12249
|
+
var minutes = absOffset % 60;
|
|
12250
|
+
if (minutes === 0) {
|
|
12251
|
+
return sign + String(hours);
|
|
12252
|
+
}
|
|
12253
|
+
var delimiter = dirtyDelimiter;
|
|
12254
|
+
return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
|
|
12253
12255
|
}
|
|
12254
|
-
function
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
}
|
|
12256
|
+
function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
|
|
12257
|
+
if (offset % 60 === 0) {
|
|
12258
|
+
var sign = offset > 0 ? '-' : '+';
|
|
12259
|
+
return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
|
|
12259
12260
|
}
|
|
12260
|
-
return
|
|
12261
|
+
return formatTimezone(offset, dirtyDelimiter);
|
|
12261
12262
|
}
|
|
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
|
-
};
|
|
12263
|
+
function formatTimezone(offset, dirtyDelimiter) {
|
|
12264
|
+
var delimiter = dirtyDelimiter || '';
|
|
12265
|
+
var sign = offset > 0 ? '-' : '+';
|
|
12266
|
+
var absOffset = Math.abs(offset);
|
|
12267
|
+
var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
|
|
12268
|
+
var minutes = addLeadingZeros(absOffset % 60, 2);
|
|
12269
|
+
return sign + hours + delimiter + minutes;
|
|
12279
12270
|
}
|
|
12280
12271
|
|
|
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
|
|
12272
|
+
function dateLongFormatter(pattern, formatLong) {
|
|
12273
|
+
switch (pattern) {
|
|
12274
|
+
case 'P':
|
|
12275
|
+
return formatLong.date({
|
|
12276
|
+
width: 'short'
|
|
12277
|
+
});
|
|
12278
|
+
case 'PP':
|
|
12279
|
+
return formatLong.date({
|
|
12280
|
+
width: 'medium'
|
|
12281
|
+
});
|
|
12282
|
+
case 'PPP':
|
|
12283
|
+
return formatLong.date({
|
|
12284
|
+
width: 'long'
|
|
12285
|
+
});
|
|
12286
|
+
case 'PPPP':
|
|
12287
|
+
default:
|
|
12288
|
+
return formatLong.date({
|
|
12289
|
+
width: 'full'
|
|
12290
|
+
});
|
|
12332
12291
|
}
|
|
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
|
-
|
|
12292
|
+
}
|
|
12293
|
+
function timeLongFormatter(pattern, formatLong) {
|
|
12294
|
+
switch (pattern) {
|
|
12295
|
+
case 'p':
|
|
12296
|
+
return formatLong.time({
|
|
12297
|
+
width: 'short'
|
|
12298
|
+
});
|
|
12299
|
+
case 'pp':
|
|
12300
|
+
return formatLong.time({
|
|
12301
|
+
width: 'medium'
|
|
12302
|
+
});
|
|
12303
|
+
case 'ppp':
|
|
12304
|
+
return formatLong.time({
|
|
12305
|
+
width: 'long'
|
|
12306
|
+
});
|
|
12307
|
+
case 'pppp':
|
|
12308
|
+
default:
|
|
12309
|
+
return formatLong.time({
|
|
12310
|
+
width: 'full'
|
|
12311
|
+
});
|
|
12312
|
+
}
|
|
12313
|
+
}
|
|
12314
|
+
function dateTimeLongFormatter(pattern, formatLong) {
|
|
12315
|
+
var matchResult = pattern.match(/(P+)(p+)?/);
|
|
12316
|
+
var datePattern = matchResult[1];
|
|
12317
|
+
var timePattern = matchResult[2];
|
|
12318
|
+
if (!timePattern) {
|
|
12319
|
+
return dateLongFormatter(pattern, formatLong);
|
|
12320
|
+
}
|
|
12321
|
+
var dateTimeFormat;
|
|
12322
|
+
switch (datePattern) {
|
|
12323
|
+
case 'P':
|
|
12324
|
+
dateTimeFormat = formatLong.dateTime({
|
|
12325
|
+
width: 'short'
|
|
12326
|
+
});
|
|
12327
|
+
break;
|
|
12328
|
+
case 'PP':
|
|
12329
|
+
dateTimeFormat = formatLong.dateTime({
|
|
12330
|
+
width: 'medium'
|
|
12331
|
+
});
|
|
12332
|
+
break;
|
|
12333
|
+
case 'PPP':
|
|
12334
|
+
dateTimeFormat = formatLong.dateTime({
|
|
12335
|
+
width: 'long'
|
|
12336
|
+
});
|
|
12337
|
+
break;
|
|
12338
|
+
case 'PPPP':
|
|
12339
|
+
default:
|
|
12340
|
+
dateTimeFormat = formatLong.dateTime({
|
|
12341
|
+
width: 'full'
|
|
12342
|
+
});
|
|
12343
|
+
break;
|
|
12344
|
+
}
|
|
12345
|
+
return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
|
|
12346
|
+
}
|
|
12347
|
+
var longFormatters = {
|
|
12348
|
+
p: timeLongFormatter,
|
|
12349
|
+
P: dateTimeLongFormatter
|
|
12375
12350
|
};
|
|
12376
12351
|
|
|
12352
|
+
var MILLISECONDS_IN_MINUTE = 60000;
|
|
12353
|
+
function getDateMillisecondsPart(date) {
|
|
12354
|
+
return date.getTime() % MILLISECONDS_IN_MINUTE;
|
|
12355
|
+
}
|
|
12377
12356
|
/**
|
|
12378
|
-
*
|
|
12379
|
-
*
|
|
12380
|
-
*
|
|
12381
|
-
*
|
|
12382
|
-
*
|
|
12383
|
-
*
|
|
12384
|
-
*
|
|
12357
|
+
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
|
|
12358
|
+
* They usually appear for dates that denote time before the timezones were introduced
|
|
12359
|
+
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
|
|
12360
|
+
* and GMT+01:00:00 after that date)
|
|
12361
|
+
*
|
|
12362
|
+
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
|
|
12363
|
+
* which would lead to incorrect calculations.
|
|
12364
|
+
*
|
|
12365
|
+
* This function returns the timezone offset in milliseconds that takes seconds in account.
|
|
12385
12366
|
*/
|
|
12386
|
-
|
|
12387
|
-
|
|
12388
|
-
|
|
12389
|
-
|
|
12390
|
-
|
|
12391
|
-
|
|
12392
|
-
|
|
12393
|
-
|
|
12394
|
-
|
|
12395
|
-
|
|
12367
|
+
|
|
12368
|
+
function getTimezoneOffsetInMilliseconds(dirtyDate) {
|
|
12369
|
+
var date = new Date(dirtyDate.getTime());
|
|
12370
|
+
var baseTimezoneOffset = Math.ceil(date.getTimezoneOffset());
|
|
12371
|
+
date.setSeconds(0, 0);
|
|
12372
|
+
var hasNegativeUTCOffset = baseTimezoneOffset > 0;
|
|
12373
|
+
var millisecondsPartOfTimezoneOffset = hasNegativeUTCOffset ? (MILLISECONDS_IN_MINUTE + getDateMillisecondsPart(date)) % MILLISECONDS_IN_MINUTE : getDateMillisecondsPart(date);
|
|
12374
|
+
return baseTimezoneOffset * MILLISECONDS_IN_MINUTE + millisecondsPartOfTimezoneOffset;
|
|
12375
|
+
}
|
|
12376
|
+
|
|
12377
|
+
var protectedDayOfYearTokens = ['D', 'DD'];
|
|
12378
|
+
var protectedWeekYearTokens = ['YY', 'YYYY'];
|
|
12379
|
+
function isProtectedDayOfYearToken(token) {
|
|
12380
|
+
return protectedDayOfYearTokens.indexOf(token) !== -1;
|
|
12381
|
+
}
|
|
12382
|
+
function isProtectedWeekYearToken(token) {
|
|
12383
|
+
return protectedWeekYearTokens.indexOf(token) !== -1;
|
|
12384
|
+
}
|
|
12385
|
+
function throwProtectedError(token, format, input) {
|
|
12386
|
+
if (token === 'YYYY') {
|
|
12387
|
+
throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
|
|
12388
|
+
} else if (token === 'YY') {
|
|
12389
|
+
throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
|
|
12390
|
+
} else if (token === 'D') {
|
|
12391
|
+
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"));
|
|
12392
|
+
} else if (token === 'DD') {
|
|
12393
|
+
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
12394
|
}
|
|
12397
|
-
}
|
|
12395
|
+
}
|
|
12398
12396
|
|
|
12399
12397
|
// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
|
|
12400
12398
|
// (one of the certain letters followed by `o`)
|
|
@@ -12406,15 +12404,14 @@ var locale = {
|
|
|
12406
12404
|
// If there is no matching single quote
|
|
12407
12405
|
// then the sequence will continue until the end of the string.
|
|
12408
12406
|
// - . matches any single character unmatched by previous parts of the RegExps
|
|
12409
|
-
var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
|
12410
12407
|
|
|
12411
|
-
// This RegExp catches symbols escaped by quotes, and also
|
|
12408
|
+
var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also
|
|
12412
12409
|
// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
|
|
12410
|
+
|
|
12413
12411
|
var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
12414
12412
|
var escapedStringRegExp = /^'([^]*?)'?$/;
|
|
12415
12413
|
var doubleQuoteRegExp = /''/g;
|
|
12416
12414
|
var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
12417
|
-
|
|
12418
12415
|
/**
|
|
12419
12416
|
* @name format
|
|
12420
12417
|
* @category Common Helpers
|
|
@@ -12424,7 +12421,7 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
|
12424
12421
|
* Return the formatted date string in the given format. The result may vary by locale.
|
|
12425
12422
|
*
|
|
12426
12423
|
* > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
|
|
12427
|
-
* > See: https://
|
|
12424
|
+
* > See: https://git.io/fxCyr
|
|
12428
12425
|
*
|
|
12429
12426
|
* The characters wrapped between two single quotes characters (') are escaped.
|
|
12430
12427
|
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
|
|
@@ -12503,34 +12500,32 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
|
12503
12500
|
* | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
|
|
12504
12501
|
* | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
|
|
12505
12502
|
* | | EEEEE | M, T, W, T, F, S, S | |
|
|
12506
|
-
* | | EEEEEE | Mo, Tu, We, Th, Fr,
|
|
12503
|
+
* | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |
|
|
12507
12504
|
* | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
|
|
12508
12505
|
* | | io | 1st, 2nd, ..., 7th | 7 |
|
|
12509
12506
|
* | | ii | 01, 02, ..., 07 | 7 |
|
|
12510
12507
|
* | | iii | Mon, Tue, Wed, ..., Sun | 7 |
|
|
12511
12508
|
* | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
|
|
12512
12509
|
* | | iiiii | M, T, W, T, F, S, S | 7 |
|
|
12513
|
-
* | | iiiiii | Mo, Tu, We, Th, Fr,
|
|
12510
|
+
* | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 |
|
|
12514
12511
|
* | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
|
|
12515
12512
|
* | | eo | 2nd, 3rd, ..., 1st | 7 |
|
|
12516
12513
|
* | | ee | 02, 03, ..., 01 | |
|
|
12517
12514
|
* | | eee | Mon, Tue, Wed, ..., Sun | |
|
|
12518
12515
|
* | | eeee | Monday, Tuesday, ..., Sunday | 2 |
|
|
12519
12516
|
* | | eeeee | M, T, W, T, F, S, S | |
|
|
12520
|
-
* | | eeeeee | Mo, Tu, We, Th, Fr,
|
|
12517
|
+
* | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |
|
|
12521
12518
|
* | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
|
|
12522
12519
|
* | | co | 2nd, 3rd, ..., 1st | 7 |
|
|
12523
12520
|
* | | cc | 02, 03, ..., 01 | |
|
|
12524
12521
|
* | | ccc | Mon, Tue, Wed, ..., Sun | |
|
|
12525
12522
|
* | | cccc | Monday, Tuesday, ..., Sunday | 2 |
|
|
12526
12523
|
* | | ccccc | M, T, W, T, F, S, S | |
|
|
12527
|
-
* | | cccccc | Mo, Tu, We, Th, Fr,
|
|
12528
|
-
* | AM, PM | a..
|
|
12529
|
-
* | | aaa | am, pm | |
|
|
12524
|
+
* | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |
|
|
12525
|
+
* | AM, PM | a..aaa | AM, PM | |
|
|
12530
12526
|
* | | aaaa | a.m., p.m. | 2 |
|
|
12531
12527
|
* | | aaaaa | a, p | |
|
|
12532
|
-
* | AM, PM, noon, midnight | b..
|
|
12533
|
-
* | | bbb | am, pm, noon, midnight | |
|
|
12528
|
+
* | AM, PM, noon, midnight | b..bbb | AM, PM, noon, midnight | |
|
|
12534
12529
|
* | | bbbb | a.m., p.m., noon, midnight | 2 |
|
|
12535
12530
|
* | | bbbbb | a, p, n, mi | |
|
|
12536
12531
|
* | Flexible day period | B..BBB | at night, in the morning, ... | |
|
|
@@ -12556,7 +12551,7 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
|
12556
12551
|
* | | ss | 00, 01, ..., 59 | |
|
|
12557
12552
|
* | Fraction of second | S | 0, 1, ..., 9 | |
|
|
12558
12553
|
* | | SS | 00, 01, ..., 99 | |
|
|
12559
|
-
* | | SSS | 000,
|
|
12554
|
+
* | | SSS | 000, 0001, ..., 999 | |
|
|
12560
12555
|
* | | SSSS | ... | 3 |
|
|
12561
12556
|
* | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
|
|
12562
12557
|
* | | XX | -0800, +0530, Z | |
|
|
@@ -12576,18 +12571,18 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
|
12576
12571
|
* | | tt | ... | 3,7 |
|
|
12577
12572
|
* | Milliseconds timestamp | T | 512969520900 | 7 |
|
|
12578
12573
|
* | | TT | ... | 3,7 |
|
|
12579
|
-
* | Long localized date | P |
|
|
12580
|
-
* | | PP |
|
|
12581
|
-
* | | PPP |
|
|
12582
|
-
* | | PPPP |
|
|
12574
|
+
* | Long localized date | P | 05/29/1453 | 7 |
|
|
12575
|
+
* | | PP | May 29, 1453 | 7 |
|
|
12576
|
+
* | | PPP | May 29th, 1453 | 7 |
|
|
12577
|
+
* | | PPPP | Sunday, May 29th, 1453 | 2,7 |
|
|
12583
12578
|
* | Long localized time | p | 12:00 AM | 7 |
|
|
12584
12579
|
* | | pp | 12:00:00 AM | 7 |
|
|
12585
12580
|
* | | ppp | 12:00:00 AM GMT+2 | 7 |
|
|
12586
12581
|
* | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
|
|
12587
|
-
* | Combination of date and time | Pp |
|
|
12588
|
-
* | | PPpp |
|
|
12589
|
-
* | | PPPppp |
|
|
12590
|
-
* | | PPPPpppp|
|
|
12582
|
+
* | Combination of date and time | Pp | 05/29/1453, 12:00 AM | 7 |
|
|
12583
|
+
* | | PPpp | May 29, 1453, 12:00:00 AM | 7 |
|
|
12584
|
+
* | | PPPppp | May 29th, 1453 at ... | 7 |
|
|
12585
|
+
* | | PPPPpppp| Sunday, May 29th, 1453 at ... | 2,7 |
|
|
12591
12586
|
* Notes:
|
|
12592
12587
|
* 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
|
|
12593
12588
|
* are the same as "stand-alone" units, but are different in some languages.
|
|
@@ -12660,10 +12655,30 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
|
12660
12655
|
* - `p`: long localized time
|
|
12661
12656
|
*
|
|
12662
12657
|
* 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://
|
|
12658
|
+
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://git.io/fxCyr
|
|
12659
|
+
*
|
|
12660
|
+
* 9. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.
|
|
12661
|
+
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://git.io/fxCyr
|
|
12662
|
+
*
|
|
12663
|
+
* ### v2.0.0 breaking changes:
|
|
12664
|
+
*
|
|
12665
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
12666
|
+
*
|
|
12667
|
+
* - The second argument is now required for the sake of explicitness.
|
|
12664
12668
|
*
|
|
12665
|
-
*
|
|
12666
|
-
*
|
|
12669
|
+
* ```javascript
|
|
12670
|
+
* // Before v2.0.0
|
|
12671
|
+
* format(new Date(2016, 0, 1))
|
|
12672
|
+
*
|
|
12673
|
+
* // v2.0.0 onward
|
|
12674
|
+
* format(new Date(2016, 0, 1), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")
|
|
12675
|
+
* ```
|
|
12676
|
+
*
|
|
12677
|
+
* - New format string API for `format` function
|
|
12678
|
+
* which is based on [Unicode Technical Standard #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).
|
|
12679
|
+
* See [this post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.
|
|
12680
|
+
*
|
|
12681
|
+
* - Characters are now escaped using single quote symbols (`'`) instead of square brackets.
|
|
12667
12682
|
*
|
|
12668
12683
|
* @param {Date|Number} date - the original date
|
|
12669
12684
|
* @param {String} format - the string of tokens
|
|
@@ -12672,9 +12687,9 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
|
12672
12687
|
* @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
|
|
12673
12688
|
* @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
|
|
12674
12689
|
* @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
|
|
12675
|
-
* see: https://
|
|
12690
|
+
* see: https://git.io/fxCyr
|
|
12676
12691
|
* @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
|
|
12677
|
-
* see: https://
|
|
12692
|
+
* see: https://git.io/fxCyr
|
|
12678
12693
|
* @returns {String} the formatted date string
|
|
12679
12694
|
* @throws {TypeError} 2 arguments required
|
|
12680
12695
|
* @throws {RangeError} `date` must not be Invalid Date
|
|
@@ -12682,46 +12697,47 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
|
12682
12697
|
* @throws {RangeError} `options.locale` must contain `formatLong` property
|
|
12683
12698
|
* @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
|
|
12684
12699
|
* @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://
|
|
12700
|
+
* @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
|
|
12701
|
+
* @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
|
|
12702
|
+
* @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
|
|
12703
|
+
* @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
12704
|
* @throws {RangeError} format string contains an unescaped latin alphabet character
|
|
12690
12705
|
*
|
|
12691
12706
|
* @example
|
|
12692
12707
|
* // Represent 11 February 2014 in middle-endian format:
|
|
12693
|
-
*
|
|
12708
|
+
* var result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
|
|
12694
12709
|
* //=> '02/11/2014'
|
|
12695
12710
|
*
|
|
12696
12711
|
* @example
|
|
12697
12712
|
* // Represent 2 July 2014 in Esperanto:
|
|
12698
12713
|
* import { eoLocale } from 'date-fns/locale/eo'
|
|
12699
|
-
*
|
|
12714
|
+
* var result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
|
|
12700
12715
|
* locale: eoLocale
|
|
12701
12716
|
* })
|
|
12702
12717
|
* //=> '2-a de julio 2014'
|
|
12703
12718
|
*
|
|
12704
12719
|
* @example
|
|
12705
12720
|
* // Escape string by single quote characters:
|
|
12706
|
-
*
|
|
12721
|
+
* var result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
|
|
12707
12722
|
* //=> "3 o'clock"
|
|
12708
12723
|
*/
|
|
12709
12724
|
|
|
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;
|
|
12725
|
+
function format$1(dirtyDate, dirtyFormatStr, dirtyOptions) {
|
|
12712
12726
|
requiredArgs(2, arguments);
|
|
12713
12727
|
var formatStr = String(dirtyFormatStr);
|
|
12714
|
-
var
|
|
12715
|
-
var locale$1 =
|
|
12716
|
-
var
|
|
12728
|
+
var options = dirtyOptions || {};
|
|
12729
|
+
var locale$1 = options.locale || locale;
|
|
12730
|
+
var localeFirstWeekContainsDate = locale$1.options && locale$1.options.firstWeekContainsDate;
|
|
12731
|
+
var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
|
|
12732
|
+
var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
|
|
12717
12733
|
|
|
12718
|
-
// Test if weekStartsOn is between 1 and 7 _and_ is not NaN
|
|
12719
12734
|
if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
|
|
12720
12735
|
throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
|
|
12721
12736
|
}
|
|
12722
|
-
var
|
|
12737
|
+
var localeWeekStartsOn = locale$1.options && locale$1.options.weekStartsOn;
|
|
12738
|
+
var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
|
|
12739
|
+
var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
|
|
12723
12740
|
|
|
12724
|
-
// Test if weekStartsOn is between 0 and 6 _and_ is not NaN
|
|
12725
12741
|
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
|
|
12726
12742
|
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
|
|
12727
12743
|
}
|
|
@@ -12734,11 +12750,10 @@ function format(dirtyDate, dirtyFormatStr, options) {
|
|
|
12734
12750
|
var originalDate = toDate(dirtyDate);
|
|
12735
12751
|
if (!isValid(originalDate)) {
|
|
12736
12752
|
throw new RangeError('Invalid time value');
|
|
12737
|
-
}
|
|
12738
|
-
|
|
12739
|
-
// Convert the date in system timezone to the same date in UTC+00:00 timezone.
|
|
12753
|
+
} // Convert the date in system timezone to the same date in UTC+00:00 timezone.
|
|
12740
12754
|
// This ensures that when UTC functions will be implemented, locales will be compatible with them.
|
|
12741
12755
|
// See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
|
|
12756
|
+
|
|
12742
12757
|
var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
|
|
12743
12758
|
var utcDate = subMilliseconds(originalDate, timezoneOffset);
|
|
12744
12759
|
var formatterOptions = {
|
|
@@ -12751,7 +12766,7 @@ function format(dirtyDate, dirtyFormatStr, options) {
|
|
|
12751
12766
|
var firstCharacter = substring[0];
|
|
12752
12767
|
if (firstCharacter === 'p' || firstCharacter === 'P') {
|
|
12753
12768
|
var longFormatter = longFormatters[firstCharacter];
|
|
12754
|
-
return longFormatter(substring, locale$1.formatLong);
|
|
12769
|
+
return longFormatter(substring, locale$1.formatLong, formatterOptions);
|
|
12755
12770
|
}
|
|
12756
12771
|
return substring;
|
|
12757
12772
|
}).join('').match(formattingTokensRegExp).map(function (substring) {
|
|
@@ -12765,11 +12780,11 @@ function format(dirtyDate, dirtyFormatStr, options) {
|
|
|
12765
12780
|
}
|
|
12766
12781
|
var formatter = formatters[firstCharacter];
|
|
12767
12782
|
if (formatter) {
|
|
12768
|
-
if (!
|
|
12769
|
-
throwProtectedError(substring, dirtyFormatStr,
|
|
12783
|
+
if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
|
|
12784
|
+
throwProtectedError(substring, dirtyFormatStr, dirtyDate);
|
|
12770
12785
|
}
|
|
12771
|
-
if (!
|
|
12772
|
-
throwProtectedError(substring, dirtyFormatStr,
|
|
12786
|
+
if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
|
|
12787
|
+
throwProtectedError(substring, dirtyFormatStr, dirtyDate);
|
|
12773
12788
|
}
|
|
12774
12789
|
return formatter(utcDate, substring, locale$1.localize, formatterOptions);
|
|
12775
12790
|
}
|
|
@@ -12781,28 +12796,22 @@ function format(dirtyDate, dirtyFormatStr, options) {
|
|
|
12781
12796
|
return result;
|
|
12782
12797
|
}
|
|
12783
12798
|
function cleanEscapedString(input) {
|
|
12784
|
-
|
|
12785
|
-
if (!matched) {
|
|
12786
|
-
return input;
|
|
12787
|
-
}
|
|
12788
|
-
return matched[1].replace(doubleQuoteRegExp, "'");
|
|
12799
|
+
return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
|
|
12789
12800
|
}
|
|
12790
12801
|
|
|
12791
|
-
function convertToFP(fn, arity) {
|
|
12792
|
-
|
|
12802
|
+
function convertToFP(fn, arity, a) {
|
|
12803
|
+
a = a || [];
|
|
12793
12804
|
if (a.length >= arity) {
|
|
12794
12805
|
return fn.apply(null, a.slice(0, arity).reverse());
|
|
12795
12806
|
}
|
|
12796
12807
|
return function () {
|
|
12797
|
-
|
|
12798
|
-
args[_key] = arguments[_key];
|
|
12799
|
-
}
|
|
12808
|
+
var args = Array.prototype.slice.call(arguments);
|
|
12800
12809
|
return convertToFP(fn, arity, a.concat(args));
|
|
12801
12810
|
};
|
|
12802
12811
|
}
|
|
12803
12812
|
|
|
12804
|
-
// This file is generated automatically by `scripts/build/fp.
|
|
12805
|
-
var
|
|
12813
|
+
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
|
|
12814
|
+
var format = convertToFP(format$1, 2);
|
|
12806
12815
|
|
|
12807
12816
|
var Wrapper = index$a(reactNative.View)(function () {
|
|
12808
12817
|
return {
|
|
@@ -12883,17 +12892,18 @@ var StyledCalendarDayNameCell = index$a(reactNative.View)(function (_ref3) {
|
|
|
12883
12892
|
var StyledCalendarCell = index$a(reactNative.TouchableOpacity)(function (_ref4) {
|
|
12884
12893
|
var theme = _ref4.theme,
|
|
12885
12894
|
_ref4$variant = _ref4.variant,
|
|
12886
|
-
variant = _ref4$variant === void 0 ? 'default' : _ref4$variant
|
|
12887
|
-
themeItemWidth = _ref4.themeItemWidth;
|
|
12895
|
+
variant = _ref4$variant === void 0 ? 'default' : _ref4$variant;
|
|
12888
12896
|
return {
|
|
12889
12897
|
borderColor: theme.__hd__.calendar.colors.border,
|
|
12890
12898
|
borderWidth: variant === 'current' ? 1 : 0,
|
|
12891
|
-
borderRadius: theme.__hd__.calendar.radii["default"],
|
|
12899
|
+
borderRadius: variant === 'highlighted' ? undefined : theme.__hd__.calendar.radii["default"],
|
|
12892
12900
|
alignItems: 'center',
|
|
12893
12901
|
justifyContent: 'center',
|
|
12894
|
-
backgroundColor: variant === 'selected' ? theme.__hd__.calendar.colors.
|
|
12895
|
-
width:
|
|
12896
|
-
height:
|
|
12902
|
+
backgroundColor: variant === 'selected' ? theme.__hd__.calendar.colors.rowItem.selected : 'transparent',
|
|
12903
|
+
width: '100%',
|
|
12904
|
+
height: '100%',
|
|
12905
|
+
maxWidth: theme.__hd__.calendar.sizes.cellWidth,
|
|
12906
|
+
maxHeight: theme.__hd__.calendar.sizes.cellHeight
|
|
12897
12907
|
};
|
|
12898
12908
|
});
|
|
12899
12909
|
var StyledCalendarRow = index$a(reactNative.View)(function (_ref5) {
|
|
@@ -12901,18 +12911,24 @@ var StyledCalendarRow = index$a(reactNative.View)(function (_ref5) {
|
|
|
12901
12911
|
return {
|
|
12902
12912
|
flexDirection: 'row',
|
|
12903
12913
|
paddingHorizontal: theme.__hd__.calendar.space.rowVerticalPadding,
|
|
12904
|
-
flexWrap: 'wrap'
|
|
12914
|
+
flexWrap: 'wrap',
|
|
12915
|
+
justifyContent: 'center',
|
|
12916
|
+
alignItems: 'center'
|
|
12905
12917
|
};
|
|
12906
12918
|
});
|
|
12907
12919
|
var StyledCalendarRowItem = index$a(reactNative.View)(function (_ref6) {
|
|
12908
12920
|
var theme = _ref6.theme,
|
|
12909
|
-
themeItemWidth = _ref6.themeItemWidth
|
|
12921
|
+
themeItemWidth = _ref6.themeItemWidth,
|
|
12922
|
+
isHighlighted = _ref6.isHighlighted;
|
|
12910
12923
|
return {
|
|
12911
12924
|
flexBasis: "".concat(Math.floor(100.0 / 7.0), "%"),
|
|
12925
|
+
lineHeight: 0,
|
|
12912
12926
|
alignItems: 'center',
|
|
12913
12927
|
width: themeItemWidth || theme.__hd__.calendar.sizes.cellWidth,
|
|
12914
|
-
height: theme.__hd__.calendar.sizes.cellHeight,
|
|
12915
|
-
|
|
12928
|
+
height: themeItemWidth || theme.__hd__.calendar.sizes.cellHeight,
|
|
12929
|
+
maxHeight: theme.__hd__.calendar.sizes.cellHeight,
|
|
12930
|
+
justifyContent: 'center',
|
|
12931
|
+
backgroundColor: isHighlighted ? theme.__hd__.calendar.colors.rowItem.highlighted : undefined
|
|
12916
12932
|
};
|
|
12917
12933
|
});
|
|
12918
12934
|
var StyledDisabledCalendarRowItem = index$a(reactNative.View)(function (_ref7) {
|
|
@@ -12922,7 +12938,8 @@ var StyledDisabledCalendarRowItem = index$a(reactNative.View)(function (_ref7) {
|
|
|
12922
12938
|
flexBasis: "".concat(Math.floor(100.0 / 7.0), "%"),
|
|
12923
12939
|
alignItems: 'center',
|
|
12924
12940
|
width: themeItemWidth || theme.__hd__.calendar.sizes.cellWidth,
|
|
12925
|
-
height: theme.__hd__.calendar.sizes.cellHeight
|
|
12941
|
+
height: themeItemWidth || theme.__hd__.calendar.sizes.cellHeight,
|
|
12942
|
+
maxHeight: theme.__hd__.calendar.sizes.cellHeight
|
|
12926
12943
|
};
|
|
12927
12944
|
});
|
|
12928
12945
|
var StyledMark = index$a(reactNative.View)(function (_ref8) {
|
|
@@ -12942,8 +12959,10 @@ var StyledMark = index$a(reactNative.View)(function (_ref8) {
|
|
|
12942
12959
|
var getCellVariant = function getCellVariant() {
|
|
12943
12960
|
var isSelected = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
12944
12961
|
var isCurrent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
12962
|
+
var isHighlighted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
12945
12963
|
if (isSelected) return 'selected';
|
|
12946
12964
|
if (isCurrent) return 'current';
|
|
12965
|
+
if (isHighlighted) return 'highlighted';
|
|
12947
12966
|
return 'default';
|
|
12948
12967
|
};
|
|
12949
12968
|
var CalendarRowItem = function CalendarRowItem(_ref) {
|
|
@@ -12955,12 +12974,14 @@ var CalendarRowItem = function CalendarRowItem(_ref) {
|
|
|
12955
12974
|
textIntent = _ref$textIntent === void 0 ? 'body' : _ref$textIntent,
|
|
12956
12975
|
_ref$marked = _ref.marked,
|
|
12957
12976
|
marked = _ref$marked === void 0 ? false : _ref$marked,
|
|
12958
|
-
itemWidth = _ref.itemWidth
|
|
12977
|
+
itemWidth = _ref.itemWidth,
|
|
12978
|
+
isHighlighted = _ref.isHighlighted;
|
|
12959
12979
|
return /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRowItem, {
|
|
12960
12980
|
testID: "calendar-date-cell",
|
|
12961
|
-
themeItemWidth: itemWidth
|
|
12981
|
+
themeItemWidth: itemWidth,
|
|
12982
|
+
isHighlighted: isHighlighted
|
|
12962
12983
|
}, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarCell, {
|
|
12963
|
-
variant: getCellVariant(isSelected, isCurrent),
|
|
12984
|
+
variant: getCellVariant(isSelected, isCurrent, isHighlighted),
|
|
12964
12985
|
onPress: onPress
|
|
12965
12986
|
}, /*#__PURE__*/React__namespace.default.createElement(Typography.Body, {
|
|
12966
12987
|
variant: "small",
|
|
@@ -12979,6 +13000,14 @@ var initArray = function initArray(length, func) {
|
|
|
12979
13000
|
var isEqDate = function isEqDate(dateA, dateB) {
|
|
12980
13001
|
return (dateA === null || dateA === void 0 ? void 0 : dateA.toDateString()) === (dateB === null || dateB === void 0 ? void 0 : dateB.toDateString());
|
|
12981
13002
|
};
|
|
13003
|
+
var isDateInRange = function isDateInRange(_ref) {
|
|
13004
|
+
var date = _ref.date,
|
|
13005
|
+
range = _ref.range;
|
|
13006
|
+
if (!range || range.startDate === undefined || range.endDate === undefined) {
|
|
13007
|
+
return false;
|
|
13008
|
+
}
|
|
13009
|
+
return date >= range.startDate && date <= range.endDate;
|
|
13010
|
+
};
|
|
12982
13011
|
var getValidDate = function getValidDate(date, minDate, maxDate) {
|
|
12983
13012
|
if (minDate === undefined && maxDate === undefined) {
|
|
12984
13013
|
return date;
|
|
@@ -12994,6 +13023,297 @@ var getValidDate = function getValidDate(date, minDate, maxDate) {
|
|
|
12994
13023
|
}
|
|
12995
13024
|
return undefined;
|
|
12996
13025
|
};
|
|
13026
|
+
var setStartOrEndDate = function setStartOrEndDate(_ref2) {
|
|
13027
|
+
var date = _ref2.date,
|
|
13028
|
+
startDate = _ref2.startDate,
|
|
13029
|
+
endDate = _ref2.endDate;
|
|
13030
|
+
// Prevent selecting same date
|
|
13031
|
+
if (isEqDate(date, startDate) || isEqDate(date, endDate)) {
|
|
13032
|
+
return {
|
|
13033
|
+
startDate: startDate,
|
|
13034
|
+
endDate: endDate
|
|
13035
|
+
};
|
|
13036
|
+
}
|
|
13037
|
+
// No start date yet - set as start
|
|
13038
|
+
if (!startDate) {
|
|
13039
|
+
return {
|
|
13040
|
+
startDate: date,
|
|
13041
|
+
endDate: undefined
|
|
13042
|
+
};
|
|
13043
|
+
}
|
|
13044
|
+
// Have start but no end - set as end and reorder if needed
|
|
13045
|
+
if (!endDate) {
|
|
13046
|
+
return date < startDate ? {
|
|
13047
|
+
startDate: date,
|
|
13048
|
+
endDate: startDate
|
|
13049
|
+
} : {
|
|
13050
|
+
startDate: startDate,
|
|
13051
|
+
endDate: date
|
|
13052
|
+
};
|
|
13053
|
+
}
|
|
13054
|
+
// Clicking within range - start new selection
|
|
13055
|
+
if (date >= startDate && date <= endDate) {
|
|
13056
|
+
return {
|
|
13057
|
+
startDate: date,
|
|
13058
|
+
endDate: undefined
|
|
13059
|
+
};
|
|
13060
|
+
}
|
|
13061
|
+
// Clicking outside range - extend range
|
|
13062
|
+
return date < startDate ? {
|
|
13063
|
+
startDate: date,
|
|
13064
|
+
endDate: endDate
|
|
13065
|
+
} : {
|
|
13066
|
+
startDate: startDate,
|
|
13067
|
+
endDate: date
|
|
13068
|
+
};
|
|
13069
|
+
};
|
|
13070
|
+
|
|
13071
|
+
var SelectedDate = function SelectedDate(_ref) {
|
|
13072
|
+
var date = _ref.date,
|
|
13073
|
+
onPress = _ref.onPress,
|
|
13074
|
+
marked = _ref.marked,
|
|
13075
|
+
isStart = _ref.isStart,
|
|
13076
|
+
showConnector = _ref.showConnector,
|
|
13077
|
+
itemWidth = _ref.itemWidth;
|
|
13078
|
+
return /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRowItem, {
|
|
13079
|
+
themeItemWidth: itemWidth,
|
|
13080
|
+
testID: "calendar-date-cell"
|
|
13081
|
+
}, showConnector ? /*#__PURE__*/React__namespace.default.createElement(Box, {
|
|
13082
|
+
testID: "range-connector",
|
|
13083
|
+
style: _objectSpread2(_objectSpread2({
|
|
13084
|
+
width: '50%',
|
|
13085
|
+
height: '100%'
|
|
13086
|
+
}, reactNative.StyleSheet.absoluteFillObject), {}, {
|
|
13087
|
+
transform: isStart ? [{
|
|
13088
|
+
translateX: itemWidth ? itemWidth / 2 : 0
|
|
13089
|
+
}] : undefined
|
|
13090
|
+
}),
|
|
13091
|
+
bgColor: "highlightedSurface"
|
|
13092
|
+
}) : null, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarCell, {
|
|
13093
|
+
testID: "selected-date-cell",
|
|
13094
|
+
variant: "selected",
|
|
13095
|
+
onPress: onPress
|
|
13096
|
+
}, /*#__PURE__*/React__namespace.default.createElement(Typography.Body, {
|
|
13097
|
+
variant: "small",
|
|
13098
|
+
intent: "inverted"
|
|
13099
|
+
}, date ? date.getDate() : ''), marked ? /*#__PURE__*/React__namespace.default.createElement(StyledMark, {
|
|
13100
|
+
testID: "calendar-date-mark",
|
|
13101
|
+
variant: "inverted"
|
|
13102
|
+
}) : null));
|
|
13103
|
+
};
|
|
13104
|
+
|
|
13105
|
+
var DAYS_OF_WEEK$1 = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
|
|
13106
|
+
// Sunday first column => 0
|
|
13107
|
+
// Sunday last column => 1
|
|
13108
|
+
var WEEK_INDEX_OFFSET$1 = 1;
|
|
13109
|
+
var SUNDAY_INDEX$1 = 6;
|
|
13110
|
+
// Always render 7 rows x 6 items for consistent layout
|
|
13111
|
+
var TOTAL_DATES_ITEMS$1 = 7 * 6;
|
|
13112
|
+
var CalendarRange = function CalendarRange(_ref) {
|
|
13113
|
+
var value = _ref.value,
|
|
13114
|
+
visibleDate = _ref.visibleDate,
|
|
13115
|
+
onChange = _ref.onChange,
|
|
13116
|
+
_ref$onPreviousPress = _ref.onPreviousPress,
|
|
13117
|
+
onPreviousPress = _ref$onPreviousPress === void 0 ? noop$1 : _ref$onPreviousPress,
|
|
13118
|
+
_ref$onNextPress = _ref.onNextPress,
|
|
13119
|
+
onNextPress = _ref$onNextPress === void 0 ? noop$1 : _ref$onNextPress,
|
|
13120
|
+
_ref$onTitlePress = _ref.onTitlePress,
|
|
13121
|
+
onTitlePress = _ref$onTitlePress === void 0 ? noop$1 : _ref$onTitlePress,
|
|
13122
|
+
minDate = _ref.minDate,
|
|
13123
|
+
maxDate = _ref.maxDate,
|
|
13124
|
+
_ref$markedDates = _ref.markedDates,
|
|
13125
|
+
markedDates = _ref$markedDates === void 0 ? [] : _ref$markedDates,
|
|
13126
|
+
testID = _ref.testID,
|
|
13127
|
+
_ref$onMonthChange = _ref.onMonthChange,
|
|
13128
|
+
onMonthChange = _ref$onMonthChange === void 0 ? noop$1 : _ref$onMonthChange,
|
|
13129
|
+
_ref$onToggleMonthPic = _ref.onToggleMonthPicker,
|
|
13130
|
+
onToggleMonthPicker = _ref$onToggleMonthPic === void 0 ? noop$1 : _ref$onToggleMonthPic,
|
|
13131
|
+
monthPickerConfirmLabel = _ref.monthPickerConfirmLabel,
|
|
13132
|
+
monthPickerCancelLabel = _ref.monthPickerCancelLabel;
|
|
13133
|
+
var theme = useTheme();
|
|
13134
|
+
var currentMonth = visibleDate.getMonth();
|
|
13135
|
+
var currentYear = visibleDate.getFullYear();
|
|
13136
|
+
var now = new Date();
|
|
13137
|
+
var parsedMaskedDate = markedDates.reduce(function (current, markedDate) {
|
|
13138
|
+
return _objectSpread2(_objectSpread2({}, current), {}, _defineProperty({}, markedDate.toDateString(), true));
|
|
13139
|
+
}, {});
|
|
13140
|
+
var _useState = React.useState(false),
|
|
13141
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13142
|
+
monthPickerVisible = _useState2[0],
|
|
13143
|
+
setMonthPickerVisible = _useState2[1];
|
|
13144
|
+
var _useState3 = React.useState(0),
|
|
13145
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
13146
|
+
contentHeight = _useState4[0],
|
|
13147
|
+
setContentHeight = _useState4[1];
|
|
13148
|
+
var _useState5 = React.useState(0),
|
|
13149
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
13150
|
+
contentWidth = _useState6[0],
|
|
13151
|
+
setContentWidth = _useState6[1];
|
|
13152
|
+
var calendarItemWidth = React.useMemo(function () {
|
|
13153
|
+
return contentWidth > 0 ? Math.floor((contentWidth - theme.__hd__.calendar.space.cellPadding) / 7) : undefined;
|
|
13154
|
+
}, [contentWidth, theme]);
|
|
13155
|
+
var useMonthPicker = onMonthChange !== noop$1;
|
|
13156
|
+
var firstDateOfMonth = new Date(currentYear, currentMonth, 1);
|
|
13157
|
+
var lastDateOfMonth = new Date(currentYear, currentMonth + 1, 0);
|
|
13158
|
+
var lastDateOfPreviousMonth = new Date(currentYear, currentMonth, 0);
|
|
13159
|
+
// Index of day in week is shifted by 1 due to Sunday is the last column
|
|
13160
|
+
var firstDayWeekIndexOfMonth = firstDateOfMonth.getDay() === 0 ? SUNDAY_INDEX$1 : firstDateOfMonth.getDay() - WEEK_INDEX_OFFSET$1;
|
|
13161
|
+
var lastDayIndexOfCurrentMonth = lastDateOfMonth.getDate();
|
|
13162
|
+
var lastDayIndexOfPreviousMonth = lastDateOfPreviousMonth.getDate();
|
|
13163
|
+
var daysOfPreviousMonth = initArray(firstDayWeekIndexOfMonth, function (index) {
|
|
13164
|
+
var reversedIndex = firstDayWeekIndexOfMonth - index - 1;
|
|
13165
|
+
var count = lastDayIndexOfPreviousMonth - reversedIndex;
|
|
13166
|
+
return getValidDate(new Date(currentYear, currentMonth - 1, count), minDate, maxDate);
|
|
13167
|
+
});
|
|
13168
|
+
var daysOfCurrentMonth = initArray(lastDayIndexOfCurrentMonth, function (index) {
|
|
13169
|
+
return getValidDate(new Date(currentYear, currentMonth, index + 1), minDate, maxDate);
|
|
13170
|
+
});
|
|
13171
|
+
var daysOfNextMonth = initArray(TOTAL_DATES_ITEMS$1 - (daysOfPreviousMonth.length + daysOfCurrentMonth.length), function (index) {
|
|
13172
|
+
return getValidDate(new Date(currentYear, currentMonth + 1, index + 1), minDate, maxDate);
|
|
13173
|
+
});
|
|
13174
|
+
var disablePrevButton = minDate === undefined ? false : !daysOfPreviousMonth.some(function (date) {
|
|
13175
|
+
return date !== undefined;
|
|
13176
|
+
}) && minDate >= firstDateOfMonth;
|
|
13177
|
+
var disableNextButton = maxDate === undefined ? false : !daysOfNextMonth.some(function (date) {
|
|
13178
|
+
return date !== undefined;
|
|
13179
|
+
}) || maxDate <= lastDateOfMonth;
|
|
13180
|
+
var onDateChange = function onDateChange(date) {
|
|
13181
|
+
var newDateRange = setStartOrEndDate({
|
|
13182
|
+
date: date,
|
|
13183
|
+
startDate: value === null || value === void 0 ? void 0 : value.startDate,
|
|
13184
|
+
endDate: value === null || value === void 0 ? void 0 : value.endDate
|
|
13185
|
+
});
|
|
13186
|
+
onChange === null || onChange === void 0 || onChange(newDateRange);
|
|
13187
|
+
};
|
|
13188
|
+
var renderDateCell = function renderDateCell(_ref2) {
|
|
13189
|
+
var date = _ref2.date,
|
|
13190
|
+
isCurrentMonth = _ref2.isCurrentMonth;
|
|
13191
|
+
if (!date) {
|
|
13192
|
+
return /*#__PURE__*/React__namespace.default.createElement(StyledDisabledCalendarRowItem, {
|
|
13193
|
+
themeItemWidth: calendarItemWidth,
|
|
13194
|
+
testID: "calendar-disabled-cell"
|
|
13195
|
+
});
|
|
13196
|
+
}
|
|
13197
|
+
if (isEqDate(value === null || value === void 0 ? void 0 : value.startDate, date) || isEqDate(value === null || value === void 0 ? void 0 : value.endDate, date)) {
|
|
13198
|
+
return /*#__PURE__*/React__namespace.default.createElement(SelectedDate, {
|
|
13199
|
+
isStart: isEqDate(date, value === null || value === void 0 ? void 0 : value.startDate),
|
|
13200
|
+
showConnector: !!(value !== null && value !== void 0 && value.startDate) && !!(value !== null && value !== void 0 && value.endDate),
|
|
13201
|
+
key: date.toDateString(),
|
|
13202
|
+
date: date,
|
|
13203
|
+
onPress: function onPress() {
|
|
13204
|
+
return onDateChange(date);
|
|
13205
|
+
},
|
|
13206
|
+
marked: parsedMaskedDate[date.toDateString()],
|
|
13207
|
+
itemWidth: calendarItemWidth
|
|
13208
|
+
});
|
|
13209
|
+
}
|
|
13210
|
+
return /*#__PURE__*/React__namespace.default.createElement(CalendarRowItem, {
|
|
13211
|
+
itemWidth: calendarItemWidth,
|
|
13212
|
+
key: date.toDateString(),
|
|
13213
|
+
date: date,
|
|
13214
|
+
isCurrent: isEqDate(now, date),
|
|
13215
|
+
isSelected: isEqDate(value === null || value === void 0 ? void 0 : value.startDate, date) || isEqDate(value === null || value === void 0 ? void 0 : value.endDate, date),
|
|
13216
|
+
isHighlighted: isDateInRange({
|
|
13217
|
+
date: date,
|
|
13218
|
+
range: value
|
|
13219
|
+
}),
|
|
13220
|
+
onPress: function onPress() {
|
|
13221
|
+
return onDateChange(date);
|
|
13222
|
+
},
|
|
13223
|
+
marked: parsedMaskedDate[date.toDateString()],
|
|
13224
|
+
textIntent: isCurrentMonth ? undefined : 'subdued'
|
|
13225
|
+
});
|
|
13226
|
+
};
|
|
13227
|
+
var onLayout = function onLayout(e) {
|
|
13228
|
+
var _e$nativeEvent$layout = e.nativeEvent.layout,
|
|
13229
|
+
width = _e$nativeEvent$layout.width,
|
|
13230
|
+
height = _e$nativeEvent$layout.height;
|
|
13231
|
+
setContentHeight(height);
|
|
13232
|
+
setContentWidth(width);
|
|
13233
|
+
};
|
|
13234
|
+
return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$7, {
|
|
13235
|
+
testID: testID
|
|
13236
|
+
}, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__namespace.default.createElement(ContentNavigator, {
|
|
13237
|
+
value: !useMonthPicker ? format('MMMM yyyy', visibleDate) : /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
|
|
13238
|
+
testID: "calendar-month-picker",
|
|
13239
|
+
onPress: function onPress() {
|
|
13240
|
+
onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(!monthPickerVisible);
|
|
13241
|
+
setMonthPickerVisible(!monthPickerVisible);
|
|
13242
|
+
}
|
|
13243
|
+
}, /*#__PURE__*/React__namespace.default.createElement(Box, {
|
|
13244
|
+
flexDirection: "row",
|
|
13245
|
+
justifyContent: "center",
|
|
13246
|
+
alignItems: "center"
|
|
13247
|
+
}, /*#__PURE__*/React__namespace.default.createElement(Typography.Title, {
|
|
13248
|
+
level: "h5",
|
|
13249
|
+
style: {
|
|
13250
|
+
textAlign: 'center',
|
|
13251
|
+
marginRight: theme.__hd__.calendar.space.headerMarginRight
|
|
13252
|
+
}
|
|
13253
|
+
}, format('MMMM yyyy', visibleDate)), /*#__PURE__*/React__namespace.default.createElement(Icon, {
|
|
13254
|
+
icon: monthPickerVisible ? 'arrow-up' : 'arrow-down',
|
|
13255
|
+
size: "small"
|
|
13256
|
+
}))),
|
|
13257
|
+
onPreviousPress: onPreviousPress,
|
|
13258
|
+
onNextPress: onNextPress,
|
|
13259
|
+
onPress: useMonthPicker ? undefined : onTitlePress,
|
|
13260
|
+
previousDisabled: disablePrevButton,
|
|
13261
|
+
nextDisabled: disableNextButton,
|
|
13262
|
+
fontSize: "large"
|
|
13263
|
+
})), reactNative.Platform.OS === 'ios' && monthPickerVisible ? /*#__PURE__*/React__namespace.default.createElement(Box, {
|
|
13264
|
+
style: {
|
|
13265
|
+
overflow: 'hidden'
|
|
13266
|
+
}
|
|
13267
|
+
}, /*#__PURE__*/React__namespace.default.createElement(reactNativeMonthYearPicker.MonthYearPickerViewIOS, {
|
|
13268
|
+
value: value === null || value === void 0 ? void 0 : value.startDate,
|
|
13269
|
+
minimumDate: minDate,
|
|
13270
|
+
maximumDate: maxDate,
|
|
13271
|
+
onChange: onMonthChange,
|
|
13272
|
+
style: {
|
|
13273
|
+
height: contentHeight + theme.__hd__.calendar.space.iosPickerMarginVertical * 2,
|
|
13274
|
+
marginVertical: -theme.__hd__.calendar.space.iosPickerMarginVertical,
|
|
13275
|
+
width: contentWidth
|
|
13276
|
+
}
|
|
13277
|
+
})) : /*#__PURE__*/React__namespace.default.createElement(Box, {
|
|
13278
|
+
onLayout: onLayout
|
|
13279
|
+
}, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRow, null, DAYS_OF_WEEK$1.map(function (day) {
|
|
13280
|
+
return /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRowItem, {
|
|
13281
|
+
key: day
|
|
13282
|
+
}, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarDayNameCell, {
|
|
13283
|
+
themeItemWidth: calendarItemWidth
|
|
13284
|
+
}, /*#__PURE__*/React__namespace.default.createElement(Typography.Body, {
|
|
13285
|
+
variant: "small"
|
|
13286
|
+
}, day)));
|
|
13287
|
+
})), /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRow, null, daysOfPreviousMonth.map(function (date) {
|
|
13288
|
+
return renderDateCell({
|
|
13289
|
+
date: date,
|
|
13290
|
+
isCurrentMonth: false
|
|
13291
|
+
});
|
|
13292
|
+
}), daysOfCurrentMonth.map(function (date) {
|
|
13293
|
+
return renderDateCell({
|
|
13294
|
+
date: date,
|
|
13295
|
+
isCurrentMonth: true
|
|
13296
|
+
});
|
|
13297
|
+
}), daysOfNextMonth.map(function (date) {
|
|
13298
|
+
return renderDateCell({
|
|
13299
|
+
date: date,
|
|
13300
|
+
isCurrentMonth: false
|
|
13301
|
+
});
|
|
13302
|
+
})), reactNative.Platform.OS === 'android' && monthPickerVisible && /*#__PURE__*/React__namespace.default.createElement(reactNativeMonthYearPicker.MonthYearPickerDialogueAndroid, {
|
|
13303
|
+
doneButtonLabel: monthPickerConfirmLabel,
|
|
13304
|
+
cancelButtonLabel: monthPickerCancelLabel,
|
|
13305
|
+
value: value === null || value === void 0 ? void 0 : value.startDate,
|
|
13306
|
+
minimumDate: minDate,
|
|
13307
|
+
maximumDate: maxDate,
|
|
13308
|
+
onChange: function onChange(action, date) {
|
|
13309
|
+
setMonthPickerVisible(false);
|
|
13310
|
+
onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(false);
|
|
13311
|
+
if (action === 'dateSetAction' && !!date) {
|
|
13312
|
+
onMonthChange(date);
|
|
13313
|
+
}
|
|
13314
|
+
}
|
|
13315
|
+
})));
|
|
13316
|
+
};
|
|
12997
13317
|
|
|
12998
13318
|
var DAYS_OF_WEEK = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
|
|
12999
13319
|
// Sunday first column => 0
|
|
@@ -13043,8 +13363,8 @@ var Calendar = function Calendar(_ref) {
|
|
|
13043
13363
|
contentWidth = _useState6[0],
|
|
13044
13364
|
setContentWidth = _useState6[1];
|
|
13045
13365
|
var calendarItemWidth = React.useMemo(function () {
|
|
13046
|
-
return contentWidth > 0 ? contentWidth / 7 : undefined;
|
|
13047
|
-
}, [contentWidth]);
|
|
13366
|
+
return contentWidth > 0 ? Math.floor((contentWidth - theme.__hd__.calendar.space.cellPadding) / 7) : undefined;
|
|
13367
|
+
}, [contentWidth, theme]);
|
|
13048
13368
|
var useMonthPicker = onMonthChange !== noop$1;
|
|
13049
13369
|
var firstDateOfMonth = new Date(currentYear, currentMonth, 1);
|
|
13050
13370
|
var lastDateOfMonth = new Date(currentYear, currentMonth + 1, 0);
|
|
@@ -13070,10 +13390,17 @@ var Calendar = function Calendar(_ref) {
|
|
|
13070
13390
|
var disableNextButton = maxDate === undefined ? false : !daysOfNextMonth.some(function (date) {
|
|
13071
13391
|
return date !== undefined;
|
|
13072
13392
|
}) || maxDate <= lastDateOfMonth;
|
|
13393
|
+
var onLayout = function onLayout(e) {
|
|
13394
|
+
var _e$nativeEvent$layout = e.nativeEvent.layout,
|
|
13395
|
+
width = _e$nativeEvent$layout.width,
|
|
13396
|
+
height = _e$nativeEvent$layout.height;
|
|
13397
|
+
setContentHeight(height);
|
|
13398
|
+
setContentWidth(width);
|
|
13399
|
+
};
|
|
13073
13400
|
return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$7, {
|
|
13074
13401
|
testID: testID
|
|
13075
13402
|
}, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__namespace.default.createElement(ContentNavigator, {
|
|
13076
|
-
value: !useMonthPicker ?
|
|
13403
|
+
value: !useMonthPicker ? format('MMMM yyyy', visibleDate) : /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
|
|
13077
13404
|
testID: "calendar-month-picker",
|
|
13078
13405
|
onPress: function onPress() {
|
|
13079
13406
|
onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(!monthPickerVisible);
|
|
@@ -13089,7 +13416,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
13089
13416
|
textAlign: 'center',
|
|
13090
13417
|
marginRight: theme.__hd__.calendar.space.headerMarginRight
|
|
13091
13418
|
}
|
|
13092
|
-
},
|
|
13419
|
+
}, format('MMMM yyyy', visibleDate)), /*#__PURE__*/React__namespace.default.createElement(Icon, {
|
|
13093
13420
|
icon: monthPickerVisible ? 'arrow-up' : 'arrow-down',
|
|
13094
13421
|
size: "small"
|
|
13095
13422
|
}))),
|
|
@@ -13114,13 +13441,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
13114
13441
|
width: contentWidth
|
|
13115
13442
|
}
|
|
13116
13443
|
})) : /*#__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
|
|
13444
|
+
onLayout: onLayout
|
|
13124
13445
|
}, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRow, null, DAYS_OF_WEEK.map(function (day) {
|
|
13125
13446
|
return /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRowItem, {
|
|
13126
13447
|
key: day
|
|
@@ -13191,6 +13512,9 @@ var Calendar = function Calendar(_ref) {
|
|
|
13191
13512
|
}
|
|
13192
13513
|
})));
|
|
13193
13514
|
};
|
|
13515
|
+
var Calendar$1 = Object.assign(Calendar, {
|
|
13516
|
+
Range: CalendarRange
|
|
13517
|
+
});
|
|
13194
13518
|
|
|
13195
13519
|
var StyledDataCard = index$a(reactNative.View)(function (_ref) {
|
|
13196
13520
|
var theme = _ref.theme;
|
|
@@ -13602,7 +13926,7 @@ var StyledPageControlWrapper = index$a(reactNative.View)(function (_ref7) {
|
|
|
13602
13926
|
});
|
|
13603
13927
|
|
|
13604
13928
|
function isCarouselImageProps(image) {
|
|
13605
|
-
return _typeof
|
|
13929
|
+
return _typeof(image) === 'object';
|
|
13606
13930
|
}
|
|
13607
13931
|
var CarouselItem = function CarouselItem(_ref) {
|
|
13608
13932
|
var width = _ref.width,
|
|
@@ -14537,7 +14861,7 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
|
|
|
14537
14861
|
_useState2 = _slicedToArray(_useState, 2),
|
|
14538
14862
|
open = _useState2[0],
|
|
14539
14863
|
setOpen = _useState2[1];
|
|
14540
|
-
var displayValue = value ?
|
|
14864
|
+
var displayValue = value ? format(displayFormat, value) : '';
|
|
14541
14865
|
var pickerInitValue = value || new Date();
|
|
14542
14866
|
useCalculateDate({
|
|
14543
14867
|
minDate: minDate,
|
|
@@ -14606,7 +14930,7 @@ var InternalCalendar = function InternalCalendar(_ref) {
|
|
|
14606
14930
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
14607
14931
|
selectingDate = _useState4[0],
|
|
14608
14932
|
setSelectingDate = _useState4[1];
|
|
14609
|
-
return /*#__PURE__*/React__namespace.default.createElement(Calendar, {
|
|
14933
|
+
return /*#__PURE__*/React__namespace.default.createElement(Calendar$1, {
|
|
14610
14934
|
testID: "calendar",
|
|
14611
14935
|
value: selectingDate,
|
|
14612
14936
|
visibleDate: visibleDate,
|
|
@@ -14668,7 +14992,7 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
|
|
|
14668
14992
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
14669
14993
|
selectingDate = _useState10[0],
|
|
14670
14994
|
setSelectingDate = _useState10[1];
|
|
14671
|
-
var displayValue = value ?
|
|
14995
|
+
var displayValue = value ? format(displayFormat, value) : '';
|
|
14672
14996
|
useCalculateDate({
|
|
14673
14997
|
minDate: minDate,
|
|
14674
14998
|
maxDate: maxDate,
|
|
@@ -14761,7 +15085,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
|
|
|
14761
15085
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
14762
15086
|
open = _useState4[0],
|
|
14763
15087
|
setOpen = _useState4[1];
|
|
14764
|
-
var displayValue = value ?
|
|
15088
|
+
var displayValue = value ? format(displayFormat, value) : '';
|
|
14765
15089
|
var theme = useTheme();
|
|
14766
15090
|
useCalculateDate({
|
|
14767
15091
|
minDate: minDate,
|
|
@@ -19933,7 +20257,7 @@ var TimePickerAndroid = function TimePickerAndroid(_ref) {
|
|
|
19933
20257
|
open = _useState2[0],
|
|
19934
20258
|
setOpen = _useState2[1];
|
|
19935
20259
|
var is12Hour = displayFormat.includes('hh');
|
|
19936
|
-
var displayValue = value ?
|
|
20260
|
+
var displayValue = value ? format(displayFormat, value) : '';
|
|
19937
20261
|
var pickerInitValue = value || new Date();
|
|
19938
20262
|
return /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
|
|
19939
20263
|
onPress: function onPress() {
|
|
@@ -20004,7 +20328,7 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
|
|
|
20004
20328
|
open = _useState4[0],
|
|
20005
20329
|
setOpen = _useState4[1];
|
|
20006
20330
|
var is12Hour = displayFormat.includes('hh');
|
|
20007
|
-
var displayValue = value ?
|
|
20331
|
+
var displayValue = value ? format(displayFormat, value) : '';
|
|
20008
20332
|
var theme = useTheme();
|
|
20009
20333
|
React.useEffect(function () {
|
|
20010
20334
|
setSelectingDate(value || new Date());
|
|
@@ -20743,7 +21067,7 @@ function requireScheduler_production_min() {
|
|
|
20743
21067
|
var c = a.sortIndex - b.sortIndex;
|
|
20744
21068
|
return 0 !== c ? c : a.id - b.id;
|
|
20745
21069
|
}
|
|
20746
|
-
if ("object" === (typeof performance === "undefined" ? "undefined" : _typeof
|
|
21070
|
+
if ("object" === (typeof performance === "undefined" ? "undefined" : _typeof(performance)) && "function" === typeof performance.now) {
|
|
20747
21071
|
var l = performance;
|
|
20748
21072
|
exports.unstable_now = function () {
|
|
20749
21073
|
return l.now();
|
|
@@ -20914,7 +21238,7 @@ function requireScheduler_production_min() {
|
|
|
20914
21238
|
};
|
|
20915
21239
|
exports.unstable_scheduleCallback = function (a, b, c) {
|
|
20916
21240
|
var d = exports.unstable_now();
|
|
20917
|
-
"object" === _typeof
|
|
21241
|
+
"object" === _typeof(c) && null !== c ? (c = c.delay, c = "number" === typeof c && 0 < c ? d + c : d) : c = d;
|
|
20918
21242
|
switch (a) {
|
|
20919
21243
|
case 1:
|
|
20920
21244
|
var e = -1;
|
|
@@ -21004,7 +21328,7 @@ function requireReactDom_production_min() {
|
|
|
21004
21328
|
}
|
|
21005
21329
|
function pa(a, b, c, d) {
|
|
21006
21330
|
if (null !== c && 0 === c.type) return !1;
|
|
21007
|
-
switch (_typeof
|
|
21331
|
+
switch (_typeof(b)) {
|
|
21008
21332
|
case "function":
|
|
21009
21333
|
case "symbol":
|
|
21010
21334
|
return !0;
|
|
@@ -21114,7 +21438,7 @@ function requireReactDom_production_min() {
|
|
|
21114
21438
|
var Ia = Symbol["for"]("react.offscreen");
|
|
21115
21439
|
var Ja = Symbol.iterator;
|
|
21116
21440
|
function Ka(a) {
|
|
21117
|
-
if (null === a || "object" !== _typeof
|
|
21441
|
+
if (null === a || "object" !== _typeof(a)) return null;
|
|
21118
21442
|
a = Ja && a[Ja] || a["@@iterator"];
|
|
21119
21443
|
return "function" === typeof a ? a : null;
|
|
21120
21444
|
}
|
|
@@ -21143,7 +21467,7 @@ function requireReactDom_production_min() {
|
|
|
21143
21467
|
set: function set() {
|
|
21144
21468
|
throw Error();
|
|
21145
21469
|
}
|
|
21146
|
-
}), "object" === (typeof Reflect === "undefined" ? "undefined" : _typeof
|
|
21470
|
+
}), "object" === (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && Reflect.construct) {
|
|
21147
21471
|
try {
|
|
21148
21472
|
Reflect.construct(b, []);
|
|
21149
21473
|
} catch (l) {
|
|
@@ -21225,7 +21549,7 @@ function requireReactDom_production_min() {
|
|
|
21225
21549
|
case Fa:
|
|
21226
21550
|
return "SuspenseList";
|
|
21227
21551
|
}
|
|
21228
|
-
if ("object" === _typeof
|
|
21552
|
+
if ("object" === _typeof(a)) switch (a.$$typeof) {
|
|
21229
21553
|
case Ca:
|
|
21230
21554
|
return (a.displayName || "Context") + ".Consumer";
|
|
21231
21555
|
case Ba:
|
|
@@ -21297,7 +21621,7 @@ function requireReactDom_production_min() {
|
|
|
21297
21621
|
return null;
|
|
21298
21622
|
}
|
|
21299
21623
|
function Sa(a) {
|
|
21300
|
-
switch (_typeof
|
|
21624
|
+
switch (_typeof(a)) {
|
|
21301
21625
|
case "boolean":
|
|
21302
21626
|
case "number":
|
|
21303
21627
|
case "string":
|
|
@@ -21608,9 +21932,9 @@ function requireReactDom_production_min() {
|
|
|
21608
21932
|
if (tb[a] && (null != b.children || null != b.dangerouslySetInnerHTML)) throw Error(p(137, a));
|
|
21609
21933
|
if (null != b.dangerouslySetInnerHTML) {
|
|
21610
21934
|
if (null != b.children) throw Error(p(60));
|
|
21611
|
-
if ("object" !== _typeof
|
|
21935
|
+
if ("object" !== _typeof(b.dangerouslySetInnerHTML) || !("__html" in b.dangerouslySetInnerHTML)) throw Error(p(61));
|
|
21612
21936
|
}
|
|
21613
|
-
if (null != b.style && "object" !== _typeof
|
|
21937
|
+
if (null != b.style && "object" !== _typeof(b.style)) throw Error(p(62));
|
|
21614
21938
|
}
|
|
21615
21939
|
}
|
|
21616
21940
|
function vb(a, b) {
|
|
@@ -21696,7 +22020,7 @@ function requireReactDom_production_min() {
|
|
|
21696
22020
|
a = !1;
|
|
21697
22021
|
}
|
|
21698
22022
|
if (a) return null;
|
|
21699
|
-
if (c && "function" !== typeof c) throw Error(p(231, b, _typeof
|
|
22023
|
+
if (c && "function" !== typeof c) throw Error(p(231, b, _typeof(c)));
|
|
21700
22024
|
return c;
|
|
21701
22025
|
}
|
|
21702
22026
|
var Lb = !1;
|
|
@@ -22610,7 +22934,7 @@ function requireReactDom_production_min() {
|
|
|
22610
22934
|
}
|
|
22611
22935
|
function he(a) {
|
|
22612
22936
|
a = a.detail;
|
|
22613
|
-
return "object" === _typeof
|
|
22937
|
+
return "object" === _typeof(a) && "data" in a ? a.data : null;
|
|
22614
22938
|
}
|
|
22615
22939
|
var ie = !1;
|
|
22616
22940
|
function je(a, b) {
|
|
@@ -22727,7 +23051,7 @@ function requireReactDom_production_min() {
|
|
|
22727
23051
|
var He = "function" === typeof Object.is ? Object.is : Ge;
|
|
22728
23052
|
function Ie(a, b) {
|
|
22729
23053
|
if (He(a, b)) return !0;
|
|
22730
|
-
if ("object" !== _typeof
|
|
23054
|
+
if ("object" !== _typeof(a) || null === a || "object" !== _typeof(b) || null === b) return !1;
|
|
22731
23055
|
var c = Object.keys(a),
|
|
22732
23056
|
d = Object.keys(b);
|
|
22733
23057
|
if (c.length !== d.length) return !1;
|
|
@@ -23254,7 +23578,7 @@ function requireReactDom_production_min() {
|
|
|
23254
23578
|
var Cf = null,
|
|
23255
23579
|
Df = null;
|
|
23256
23580
|
function Ef(a, b) {
|
|
23257
|
-
return "textarea" === a || "noscript" === a || "string" === typeof b.children || "number" === typeof b.children || "object" === _typeof
|
|
23581
|
+
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
23582
|
}
|
|
23259
23583
|
var Ff = "function" === typeof setTimeout ? setTimeout : void 0,
|
|
23260
23584
|
Gf = "function" === typeof clearTimeout ? clearTimeout : void 0,
|
|
@@ -23902,7 +24226,7 @@ function requireReactDom_production_min() {
|
|
|
23902
24226
|
var d = !1,
|
|
23903
24227
|
e = Vf;
|
|
23904
24228
|
var f = b.contextType;
|
|
23905
|
-
"object" === _typeof
|
|
24229
|
+
"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
24230
|
b = new b(c, f);
|
|
23907
24231
|
a.memoizedState = null !== b.state && void 0 !== b.state ? b.state : null;
|
|
23908
24232
|
b.updater = nh;
|
|
@@ -23924,7 +24248,7 @@ function requireReactDom_production_min() {
|
|
|
23924
24248
|
e.refs = jh;
|
|
23925
24249
|
ah(a);
|
|
23926
24250
|
var f = b.contextType;
|
|
23927
|
-
"object" === _typeof
|
|
24251
|
+
"object" === _typeof(f) && null !== f ? e.context = Vg(f) : (f = Zf(b) ? Xf : H.current, e.context = Yf(a, f));
|
|
23928
24252
|
e.state = a.memoizedState;
|
|
23929
24253
|
f = b.getDerivedStateFromProps;
|
|
23930
24254
|
"function" === typeof f && (kh(a, b, f, c), e.state = a.memoizedState);
|
|
@@ -23933,7 +24257,7 @@ function requireReactDom_production_min() {
|
|
|
23933
24257
|
}
|
|
23934
24258
|
function sh(a, b, c) {
|
|
23935
24259
|
a = c.ref;
|
|
23936
|
-
if (null !== a && "function" !== typeof a && "object" !== _typeof
|
|
24260
|
+
if (null !== a && "function" !== typeof a && "object" !== _typeof(a)) {
|
|
23937
24261
|
if (c._owner) {
|
|
23938
24262
|
c = c._owner;
|
|
23939
24263
|
if (c) {
|
|
@@ -24008,7 +24332,7 @@ function requireReactDom_production_min() {
|
|
|
24008
24332
|
function k(a, b, c, d) {
|
|
24009
24333
|
var f = c.type;
|
|
24010
24334
|
if (f === ya) return m(a, b, c.props.children, d, c.key);
|
|
24011
|
-
if (null !== b && (b.elementType === f || "object" === _typeof
|
|
24335
|
+
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
24336
|
d = yh(c.type, c.key, c.props, null, a.mode, d);
|
|
24013
24337
|
d.ref = sh(a, b, c);
|
|
24014
24338
|
d["return"] = a;
|
|
@@ -24028,7 +24352,7 @@ function requireReactDom_production_min() {
|
|
|
24028
24352
|
}
|
|
24029
24353
|
function q(a, b, c) {
|
|
24030
24354
|
if ("string" === typeof b && "" !== b || "number" === typeof b) return b = xh("" + b, a.mode, c), b["return"] = a, b;
|
|
24031
|
-
if ("object" === _typeof
|
|
24355
|
+
if ("object" === _typeof(b) && null !== b) {
|
|
24032
24356
|
switch (b.$$typeof) {
|
|
24033
24357
|
case va:
|
|
24034
24358
|
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 +24370,7 @@ function requireReactDom_production_min() {
|
|
|
24046
24370
|
function r(a, b, c, d) {
|
|
24047
24371
|
var e = null !== b ? b.key : null;
|
|
24048
24372
|
if ("string" === typeof c && "" !== c || "number" === typeof c) return null !== e ? null : h(a, b, "" + c, d);
|
|
24049
|
-
if ("object" === _typeof
|
|
24373
|
+
if ("object" === _typeof(c) && null !== c) {
|
|
24050
24374
|
switch (c.$$typeof) {
|
|
24051
24375
|
case va:
|
|
24052
24376
|
return c.key === e ? k(a, b, c, d) : null;
|
|
@@ -24062,7 +24386,7 @@ function requireReactDom_production_min() {
|
|
|
24062
24386
|
}
|
|
24063
24387
|
function y(a, b, c, d, e) {
|
|
24064
24388
|
if ("string" === typeof d && "" !== d || "number" === typeof d) return a = a.get(c) || null, h(b, a, "" + d, e);
|
|
24065
|
-
if ("object" === _typeof
|
|
24389
|
+
if ("object" === _typeof(d) && null !== d) {
|
|
24066
24390
|
switch (d.$$typeof) {
|
|
24067
24391
|
case va:
|
|
24068
24392
|
return a = a.get(null === d.key ? c : d.key) || null, k(b, a, d, e);
|
|
@@ -24136,8 +24460,8 @@ function requireReactDom_production_min() {
|
|
|
24136
24460
|
return l;
|
|
24137
24461
|
}
|
|
24138
24462
|
function J(a, d, f, h) {
|
|
24139
|
-
"object" === _typeof
|
|
24140
|
-
if ("object" === _typeof
|
|
24463
|
+
"object" === _typeof(f) && null !== f && f.type === ya && null === f.key && (f = f.props.children);
|
|
24464
|
+
if ("object" === _typeof(f) && null !== f) {
|
|
24141
24465
|
switch (f.$$typeof) {
|
|
24142
24466
|
case va:
|
|
24143
24467
|
a: {
|
|
@@ -24152,7 +24476,7 @@ function requireReactDom_production_min() {
|
|
|
24152
24476
|
a = d;
|
|
24153
24477
|
break a;
|
|
24154
24478
|
}
|
|
24155
|
-
} else if (l.elementType === k || "object" === _typeof
|
|
24479
|
+
} else if (l.elementType === k || "object" === _typeof(k) && null !== k && k.$$typeof === Ha && uh(k) === l.type) {
|
|
24156
24480
|
c(a, l.sibling);
|
|
24157
24481
|
d = e(l, f.props);
|
|
24158
24482
|
d.ref = sh(a, l, f);
|
|
@@ -25037,7 +25361,7 @@ function requireReactDom_production_min() {
|
|
|
25037
25361
|
g.props = h;
|
|
25038
25362
|
var k = g.context,
|
|
25039
25363
|
l = c.contextType;
|
|
25040
|
-
"object" === _typeof
|
|
25364
|
+
"object" === _typeof(l) && null !== l ? l = Vg(l) : (l = Zf(c) ? Xf : H.current, l = Yf(b, l));
|
|
25041
25365
|
var m = c.getDerivedStateFromProps,
|
|
25042
25366
|
q = "function" === typeof m || "function" === typeof g.getSnapshotBeforeUpdate;
|
|
25043
25367
|
q || "function" !== typeof g.UNSAFE_componentWillReceiveProps && "function" !== typeof g.componentWillReceiveProps || (h !== d || k !== l) && qh(b, g, d, l);
|
|
@@ -25056,7 +25380,7 @@ function requireReactDom_production_min() {
|
|
|
25056
25380
|
q = b.pendingProps;
|
|
25057
25381
|
r = g.context;
|
|
25058
25382
|
k = c.contextType;
|
|
25059
|
-
"object" === _typeof
|
|
25383
|
+
"object" === _typeof(k) && null !== k ? k = Vg(k) : (k = Zf(c) ? Xf : H.current, k = Yf(b, k));
|
|
25060
25384
|
var y = c.getDerivedStateFromProps;
|
|
25061
25385
|
(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
25386
|
$g = !1;
|
|
@@ -26969,7 +27293,7 @@ function requireReactDom_production_min() {
|
|
|
26969
27293
|
k = b;
|
|
26970
27294
|
b = Z;
|
|
26971
27295
|
h.flags |= 32768;
|
|
26972
|
-
if (null !== k && "object" === _typeof
|
|
27296
|
+
if (null !== k && "object" === _typeof(k) && "function" === typeof k.then) {
|
|
26973
27297
|
var l = k,
|
|
26974
27298
|
m = h,
|
|
26975
27299
|
q = m.tag;
|
|
@@ -27390,7 +27714,7 @@ function requireReactDom_production_min() {
|
|
|
27390
27714
|
e = Xh(null, b, d, a, e, c);
|
|
27391
27715
|
var f = bi();
|
|
27392
27716
|
b.flags |= 1;
|
|
27393
|
-
"object" === _typeof
|
|
27717
|
+
"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
27718
|
return b;
|
|
27395
27719
|
case 16:
|
|
27396
27720
|
d = b.elementType;
|
|
@@ -27631,7 +27955,7 @@ function requireReactDom_production_min() {
|
|
|
27631
27955
|
case Ia:
|
|
27632
27956
|
return qj(c, e, f, b);
|
|
27633
27957
|
default:
|
|
27634
|
-
if ("object" === _typeof
|
|
27958
|
+
if ("object" === _typeof(a) && null !== a) switch (a.$$typeof) {
|
|
27635
27959
|
case Ba:
|
|
27636
27960
|
g = 10;
|
|
27637
27961
|
break a;
|
|
@@ -27649,7 +27973,7 @@ function requireReactDom_production_min() {
|
|
|
27649
27973
|
d = null;
|
|
27650
27974
|
break a;
|
|
27651
27975
|
}
|
|
27652
|
-
throw Error(p(130, null == a ? a : _typeof
|
|
27976
|
+
throw Error(p(130, null == a ? a : _typeof(a), ""));
|
|
27653
27977
|
}
|
|
27654
27978
|
b = Bg(g, c, b, e);
|
|
27655
27979
|
b.elementType = a;
|
|
@@ -28297,7 +28621,7 @@ function requireLib() {
|
|
|
28297
28621
|
};
|
|
28298
28622
|
},
|
|
28299
28623
|
380: function _(e, t, r) {
|
|
28300
|
-
var n = "object" == _typeof
|
|
28624
|
+
var n = "object" == _typeof(r.g) && r.g && r.g.Object === Object && r.g;
|
|
28301
28625
|
e.exports = n;
|
|
28302
28626
|
},
|
|
28303
28627
|
903: function _(e, t, r) {
|
|
@@ -28325,7 +28649,7 @@ function requireLib() {
|
|
|
28325
28649
|
},
|
|
28326
28650
|
433: function _(e, t, r) {
|
|
28327
28651
|
var n = r(380),
|
|
28328
|
-
u = "object" == (typeof self === "undefined" ? "undefined" : _typeof
|
|
28652
|
+
u = "object" == (typeof self === "undefined" ? "undefined" : _typeof(self)) && self && self.Object === Object && self,
|
|
28329
28653
|
o = n || u || Function("return this")();
|
|
28330
28654
|
e.exports = o;
|
|
28331
28655
|
},
|
|
@@ -28394,20 +28718,20 @@ function requireLib() {
|
|
|
28394
28718
|
},
|
|
28395
28719
|
953: function _(e) {
|
|
28396
28720
|
e.exports = function (e) {
|
|
28397
|
-
var t = _typeof
|
|
28721
|
+
var t = _typeof(e);
|
|
28398
28722
|
return null != e && ("object" == t || "function" == t);
|
|
28399
28723
|
};
|
|
28400
28724
|
},
|
|
28401
28725
|
934: function _(e) {
|
|
28402
28726
|
e.exports = function (e) {
|
|
28403
|
-
return null != e && "object" == _typeof
|
|
28727
|
+
return null != e && "object" == _typeof(e);
|
|
28404
28728
|
};
|
|
28405
28729
|
},
|
|
28406
28730
|
414: function _(e, t, r) {
|
|
28407
28731
|
var n = r(148),
|
|
28408
28732
|
u = r(934);
|
|
28409
28733
|
e.exports = function (e) {
|
|
28410
|
-
return "symbol" == _typeof
|
|
28734
|
+
return "symbol" == _typeof(e) || u(e) && "[object Symbol]" == n(e);
|
|
28411
28735
|
};
|
|
28412
28736
|
},
|
|
28413
28737
|
664: function _(e, t, r) {
|
|
@@ -28484,11 +28808,11 @@ function requireLib() {
|
|
|
28484
28808
|
get: t[r]
|
|
28485
28809
|
});
|
|
28486
28810
|
}, u.g = function () {
|
|
28487
|
-
if ("object" == (typeof globalThis === "undefined" ? "undefined" : _typeof
|
|
28811
|
+
if ("object" == (typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis))) return globalThis;
|
|
28488
28812
|
try {
|
|
28489
28813
|
return this || new Function("return this")();
|
|
28490
28814
|
} catch (e) {
|
|
28491
|
-
if ("object" == (typeof window === "undefined" ? "undefined" : _typeof
|
|
28815
|
+
if ("object" == (typeof window === "undefined" ? "undefined" : _typeof(window))) return window;
|
|
28492
28816
|
}
|
|
28493
28817
|
}(), u.o = function (e, t) {
|
|
28494
28818
|
return Object.prototype.hasOwnProperty.call(e, t);
|
|
@@ -28610,7 +28934,7 @@ function requireLib() {
|
|
|
28610
28934
|
}
|
|
28611
28935
|
var h = Object.prototype.constructor.toString();
|
|
28612
28936
|
function p(e) {
|
|
28613
|
-
if (!e || "object" != _typeof
|
|
28937
|
+
if (!e || "object" != _typeof(e)) return !1;
|
|
28614
28938
|
var t = c(e);
|
|
28615
28939
|
if (null === t) return !0;
|
|
28616
28940
|
var r = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
|
|
@@ -28907,7 +29231,7 @@ function requireLib() {
|
|
|
28907
29231
|
}
|
|
28908
29232
|
return k(_u4, r), R(n, _u4);
|
|
28909
29233
|
}
|
|
28910
|
-
if (!e || "object" != _typeof
|
|
29234
|
+
if (!e || "object" != _typeof(e)) {
|
|
28911
29235
|
if (n = t(e), void 0 === n && (n = e), n === a && (n = void 0), _this.autoFreeze_ && E(n, !0), r) {
|
|
28912
29236
|
var _t6 = [],
|
|
28913
29237
|
_u5 = [];
|
|
@@ -29185,10 +29509,10 @@ function requireLib() {
|
|
|
29185
29509
|
}
|
|
29186
29510
|
};
|
|
29187
29511
|
function se(e) {
|
|
29188
|
-
return se = "function" == typeof Symbol && "symbol" == _typeof
|
|
29189
|
-
return _typeof
|
|
29512
|
+
return se = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
29513
|
+
return _typeof(e);
|
|
29190
29514
|
} : function (e) {
|
|
29191
|
-
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof
|
|
29515
|
+
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
29192
29516
|
}, se(e);
|
|
29193
29517
|
}
|
|
29194
29518
|
function le(e, t, r) {
|
|
@@ -33872,7 +34196,7 @@ function requireLib() {
|
|
|
33872
34196
|
Jt = u(858),
|
|
33873
34197
|
Yt = u.n(Jt);
|
|
33874
34198
|
var Zt = function Zt(e) {
|
|
33875
|
-
return "object" == _typeof
|
|
34199
|
+
return "object" == _typeof(e) && null != e && 1 === e.nodeType;
|
|
33876
34200
|
},
|
|
33877
34201
|
Gt = function Gt(e, t) {
|
|
33878
34202
|
return (!t || "hidden" !== e) && "visible" !== e && "clip" !== e;
|
|
@@ -34092,10 +34416,10 @@ function requireLib() {
|
|
|
34092
34416
|
"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
34417
|
var Tr = (!Or || !xr) && !Ar && "undefined" != typeof globalThis && globalThis.InputEvent && "function" == typeof globalThis.InputEvent.prototype.getTargetRanges;
|
|
34094
34418
|
function Mr(e) {
|
|
34095
|
-
return Mr = "function" == typeof Symbol && "symbol" == _typeof
|
|
34096
|
-
return _typeof
|
|
34419
|
+
return Mr = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
34420
|
+
return _typeof(e);
|
|
34097
34421
|
} : function (e) {
|
|
34098
|
-
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof
|
|
34422
|
+
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
34099
34423
|
}, Mr(e);
|
|
34100
34424
|
}
|
|
34101
34425
|
function Rr(e, t, r) {
|
|
@@ -35168,10 +35492,10 @@ function requireLib() {
|
|
|
35168
35492
|
return u;
|
|
35169
35493
|
}
|
|
35170
35494
|
function mu(e) {
|
|
35171
|
-
return mu = "function" == typeof Symbol && "symbol" == _typeof
|
|
35172
|
-
return _typeof
|
|
35495
|
+
return mu = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
35496
|
+
return _typeof(e);
|
|
35173
35497
|
} : function (e) {
|
|
35174
|
-
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof
|
|
35498
|
+
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
35175
35499
|
}, mu(e);
|
|
35176
35500
|
}
|
|
35177
35501
|
function yu(e, t, r) {
|
|
@@ -36923,7 +37247,7 @@ function requireLib() {
|
|
|
36923
37247
|
};
|
|
36924
37248
|
}(e);
|
|
36925
37249
|
if (function (e) {
|
|
36926
|
-
return "object" == _typeof
|
|
37250
|
+
return "object" == _typeof(e) && "function" == typeof e.behavior;
|
|
36927
37251
|
}(t)) return t.behavior(rr(e, t));
|
|
36928
37252
|
var n = "boolean" == typeof t || null == t ? void 0 : t.behavior;
|
|
36929
37253
|
var _iterator47 = _createForOfIteratorHelper(rr(e, function (e) {
|
|
@@ -39268,10 +39592,6 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
39268
39592
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
39269
39593
|
inputSize = _React$useState2[0],
|
|
39270
39594
|
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
39595
|
var focusAnimation = React.useRef(new reactNative.Animated.Value(0)).current;
|
|
39276
39596
|
React.useEffect(function () {
|
|
39277
39597
|
reactNative.Animated.timing(focusAnimation, {
|
|
@@ -39292,10 +39612,6 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
39292
39612
|
});
|
|
39293
39613
|
});
|
|
39294
39614
|
}, []);
|
|
39295
|
-
var onLabelLayout = React.useCallback(function (event) {
|
|
39296
|
-
var width = event.nativeEvent.layout.width;
|
|
39297
|
-
setLabelWidth(width);
|
|
39298
|
-
}, []);
|
|
39299
39615
|
React.useEffect(function () {
|
|
39300
39616
|
var removeFocusListener = on(emitter, normalizeEventName('editor-focus'), function () {
|
|
39301
39617
|
return setIsFocused(true);
|
|
@@ -39422,12 +39738,12 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
39422
39738
|
transform: [{
|
|
39423
39739
|
translateY: focusAnimation.interpolate({
|
|
39424
39740
|
inputRange: [0, 1],
|
|
39425
|
-
outputRange: [inputSize.height / 2,
|
|
39741
|
+
outputRange: [inputSize.height / 2, theme.space.xsmall]
|
|
39426
39742
|
})
|
|
39427
39743
|
}, {
|
|
39428
39744
|
translateX: focusAnimation.interpolate({
|
|
39429
39745
|
inputRange: [0, 1],
|
|
39430
|
-
outputRange: [
|
|
39746
|
+
outputRange: [theme.space.medium, -theme.space.xlarge + theme.space.xsmall]
|
|
39431
39747
|
})
|
|
39432
39748
|
}, {
|
|
39433
39749
|
scale: focusAnimation.interpolate({
|
|
@@ -39436,19 +39752,18 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
39436
39752
|
})
|
|
39437
39753
|
}]
|
|
39438
39754
|
}]
|
|
39439
|
-
},
|
|
39755
|
+
}, !!label && /*#__PURE__*/React__namespace.default.createElement(StyledLabelInsideTextInput, {
|
|
39440
39756
|
style: {
|
|
39441
39757
|
backgroundColor: theme.__hd__.textInput.colors.labelBackground
|
|
39442
39758
|
},
|
|
39759
|
+
testID: "input-label",
|
|
39443
39760
|
themeState: state
|
|
39444
|
-
},
|
|
39761
|
+
}, required && /*#__PURE__*/React__namespace.default.createElement(StyledAsteriskLabelInsideTextInput, {
|
|
39445
39762
|
style: {
|
|
39446
39763
|
backgroundColor: theme.__hd__.textInput.colors.labelBackground
|
|
39447
39764
|
},
|
|
39448
|
-
|
|
39449
|
-
|
|
39450
|
-
onLayout: onLabelLayout
|
|
39451
|
-
}, label)), /*#__PURE__*/React__namespace.default.createElement(StyledTextInputContainer, {
|
|
39765
|
+
themeState: state
|
|
39766
|
+
}, "*"), label)), /*#__PURE__*/React__namespace.default.createElement(StyledTextInputContainer, {
|
|
39452
39767
|
onLayout: onLayout
|
|
39453
39768
|
}, /*#__PURE__*/React__namespace.default.createElement(StyledBorderBackDrop, {
|
|
39454
39769
|
themeState: state,
|
|
@@ -40067,7 +40382,7 @@ exports.BottomNavigation = BottomNavigation;
|
|
|
40067
40382
|
exports.BottomSheet = BottomSheet$1;
|
|
40068
40383
|
exports.Box = Box;
|
|
40069
40384
|
exports.Button = CompoundButton;
|
|
40070
|
-
exports.Calendar = Calendar;
|
|
40385
|
+
exports.Calendar = Calendar$1;
|
|
40071
40386
|
exports.Card = Card$1;
|
|
40072
40387
|
exports.Carousel = index$8;
|
|
40073
40388
|
exports.Checkbox = Checkbox;
|
|
@@ -40116,7 +40431,6 @@ exports.Toast = Toast;
|
|
|
40116
40431
|
exports.Toolbar = index$1;
|
|
40117
40432
|
exports.Typography = Typography;
|
|
40118
40433
|
exports.eBensSystemPalette = eBensSystemPalette;
|
|
40119
|
-
exports.ehWorkDarkPalette = ehWorkDarkPalette;
|
|
40120
40434
|
exports.getTheme = getTheme$1;
|
|
40121
40435
|
exports.jobsSystemPalette = jobsSystemPalette;
|
|
40122
40436
|
exports.scale = scale;
|