cnhis-design-vue 3.1.15-beta.1 → 3.1.15-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/packages/annotation-edit/src/AnnotationEdit.js +2 -1
- package/es/packages/big-table/index.d.ts +8 -11
- package/es/packages/big-table/src/BigTable.vue.d.ts +24 -19
- package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +17 -11
- package/es/packages/big-table/src/bigTableProps.d.ts +4 -3
- package/es/packages/big-table/src/bigTableProps.js +1 -1
- package/es/packages/big-table/src/components/edit-form/edit-date.js +2 -1
- package/es/packages/big-table/src/components/edit-form/edit-select.js +2 -1
- package/es/packages/big-table/src/components/edit-form/edit-separate.js +8 -1
- package/es/packages/big-table/src/components/edit-form/edit-separate.vue.d.ts +2 -1
- package/es/packages/big-table/src/hooks/useAnnotation.d.ts +4 -0
- package/es/packages/big-table/src/hooks/useAnnotation.js +21 -0
- package/es/packages/big-table/src/hooks/useColumnConfigAdaptor.js +7 -2
- package/es/packages/big-table/src/hooks/useEdit.d.ts +2 -1
- package/es/packages/big-table/style/index.css +27 -1
- package/es/packages/bpmn-workflow/src/BpmnWorkflow.js +2 -2
- package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/BpmnRenderer.js +8 -8
- package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomContextPadProvider.js +2 -2
- package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomPalette.js +1 -1
- package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomRenderer.js +4 -3
- package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomRules.js +2 -2
- package/es/packages/bpmn-workflow/src/custom/customModeler/index.js +1 -1
- package/es/packages/bpmn-workflow/src/custom/customOtherModule/CustomPopupMenu.js +2 -2
- package/es/packages/bpmn-workflow/src/custom/customOtherModule/zoomScroll.js +3 -3
- package/es/packages/button-print/src/utils/print.d.ts +1 -1
- package/es/packages/button-print/src/utils/print.js +1 -1
- package/es/packages/fabric-chart/index.d.ts +1 -0
- package/es/packages/fabric-chart/src/FabricChart.js +17 -17
- package/es/packages/fabric-chart/src/FabricChart.vue.d.ts +12 -10
- package/es/packages/fabric-chart/src/hooks/useCenter.js +7 -5
- package/es/packages/fabric-chart/src/hooks/useCumputedPoint.js +4 -2
- package/es/packages/fabric-chart/src/hooks/useDraw.js +1 -0
- package/es/packages/fabric-chart/src/hooks/useLeft.js +5 -4
- package/es/packages/field-set/index.d.ts +4365 -0
- package/es/packages/field-set/src/FieldSet.js +53 -54
- package/es/packages/field-set/src/FieldSet.vue.d.ts +4365 -0
- package/es/packages/field-set/style/index.css +0 -9
- package/es/packages/form-config/index.d.ts +12111 -0
- package/es/packages/form-config/index.js +10 -0
- package/es/packages/form-config/src/FormConfig.js +113 -0
- package/es/packages/form-config/src/FormConfig.vue.d.ts +12113 -0
- package/es/packages/form-config/src/components/FormConfigCreator.js +97 -0
- package/es/packages/form-config/src/components/FormConfigCreator.vue.d.ts +5094 -0
- package/es/packages/form-config/src/components/FormConfigEdit.js +81 -0
- package/es/packages/form-config/src/components/FormConfigEdit.vue.d.ts +3591 -0
- package/es/packages/form-config/src/constants/index.d.ts +28 -0
- package/es/packages/form-config/src/constants/index.js +28 -0
- package/es/packages/form-config/src/hooks/index.d.ts +2 -0
- package/es/packages/form-config/src/hooks/index.js +2 -0
- package/es/packages/form-config/src/hooks/useConfigurationField.d.ts +6 -0
- package/es/packages/form-config/src/hooks/useConfigurationField.js +103 -0
- package/es/packages/form-config/src/hooks/usePresetRenderer.d.ts +5 -0
- package/es/packages/form-config/src/hooks/usePresetRenderer.js +117 -0
- package/es/packages/form-config/src/hooks/useSortable.d.ts +11 -0
- package/es/packages/form-config/src/hooks/useSortable.js +31 -0
- package/es/packages/form-config/src/types/index.d.ts +18 -0
- package/es/packages/form-config/src/types/index.js +1 -0
- package/es/packages/form-config/style/index.css +108 -0
- package/es/packages/form-render/index.d.ts +24 -3
- package/es/packages/form-render/src/FormRender.js +10 -6
- package/es/packages/form-render/src/FormRender.vue.d.ts +24 -3
- package/es/packages/form-render/src/components/renderer/cascader.js +7 -7
- package/es/packages/form-render/src/components/renderer/combination/hooks/useDeepValidate.d.ts +5 -0
- package/es/packages/form-render/src/components/renderer/combination/hooks/useDeepValidate.js +32 -0
- package/es/packages/form-render/src/components/renderer/{combination.d.ts → combination/index.d.ts} +7 -1
- package/es/packages/form-render/src/components/renderer/combination/index.js +157 -0
- package/es/packages/form-render/src/components/renderer/complex.d.ts +2 -0
- package/es/packages/form-render/src/components/renderer/complex.js +2 -5
- package/es/packages/form-render/src/components/renderer/date.d.ts +29 -0
- package/es/packages/form-render/src/components/renderer/date.js +63 -56
- package/es/packages/form-render/src/components/renderer/formItem.js +3 -3
- package/es/packages/form-render/src/components/renderer/index.js +1 -1
- package/es/packages/form-render/src/components/renderer/radio.js +4 -1
- package/es/packages/form-render/src/components/renderer/select.d.ts +9 -0
- package/es/packages/form-render/src/components/renderer/select.js +28 -17
- package/es/packages/form-render/src/constants/index.d.ts +2 -1
- package/es/packages/form-render/src/hooks/useAnchor.d.ts +7 -6
- package/es/packages/form-render/src/hooks/useAnchor.js +1 -2
- package/es/packages/form-render/src/hooks/useAsyncQueue.d.ts +6 -1
- package/es/packages/form-render/src/hooks/useAsyncQueue.js +12 -7
- package/es/packages/form-render/src/hooks/useCommonInjection.d.ts +6 -0
- package/es/packages/form-render/src/hooks/useCommonInjection.js +19 -0
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +4 -5
- package/es/packages/form-render/src/hooks/useFormContext.d.ts +3 -3
- package/es/packages/form-render/src/hooks/useFormContext.js +21 -3
- package/es/packages/form-render/src/hooks/useFormRenderLifeCycle.d.ts +13 -0
- package/es/packages/form-render/src/hooks/useFormRenderLifeCycle.js +10 -0
- package/es/packages/form-render/src/types/fieldItem.d.ts +16 -0
- package/es/packages/form-render/src/types/index.d.ts +30 -2
- package/es/packages/form-render/src/utils/index.d.ts +7 -5
- package/es/packages/form-render/src/utils/index.js +59 -11
- package/es/packages/form-render/style/index.css +11 -10
- package/es/packages/form-table/src/hooks/useNuiThemeOverrides.js +1 -1
- package/es/packages/index.css +147 -21
- package/es/packages/index.d.ts +3 -1
- package/es/packages/index.js +4 -1
- package/es/packages/info-header/index.d.ts +1 -3
- package/es/packages/info-header/src/HiddenContent.js +1 -1
- package/es/packages/info-header/src/HiddenContent.vue.d.ts +1 -3
- package/es/packages/info-header/src/InfoHeader.vue.d.ts +1 -3
- package/es/packages/info-header/style/index.css +1 -1
- package/es/packages/shortcut-provider/index.d.ts +2 -11
- package/es/packages/shortcut-provider/src/ShortcutProvider.js +1 -5
- package/es/packages/shortcut-provider/src/ShortcutProvider.vue.d.ts +2 -11
- package/es/packages/shortcut-provider/src/hooks/useShortcuts.d.ts +11 -8
- package/es/packages/shortcut-provider/src/hooks/useShortcuts.js +44 -28
- package/es/packages/shortcut-provider/src/types/index.d.ts +32 -4
- package/es/packages/shortcut-provider/src/utils/index.d.ts +3 -0
- package/es/packages/shortcut-provider/src/utils/index.js +15 -5
- package/es/packages/shortcut-setter/index.d.ts +32 -9
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +32 -9
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +8 -6
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +8 -6
- package/es/src/utils/state.d.ts +29 -0
- package/es/src/utils/state.js +44 -0
- package/package.json +10 -1
- package/es/_virtual/_commonjsHelpers.js +0 -7
- package/es/_virtual/css.escape.js +0 -3
- package/es/_virtual/inherits.js +0 -3
- package/es/_virtual/inherits_browser.js +0 -3
- package/es/node_modules/@formily/path/esm/contexts.js +0 -22
- package/es/node_modules/@formily/path/esm/destructor.js +0 -124
- package/es/node_modules/@formily/path/esm/index.js +0 -579
- package/es/node_modules/@formily/path/esm/matcher.js +0 -199
- package/es/node_modules/@formily/path/esm/parser.js +0 -402
- package/es/node_modules/@formily/path/esm/shared.js +0 -73
- package/es/node_modules/@formily/path/esm/tokenizer.js +0 -287
- package/es/node_modules/@formily/path/esm/tokens.js +0 -240
- package/es/node_modules/@formily/path/esm/types.js +0 -17
- package/es/node_modules/css.escape/css.escape.js +0 -110
- package/es/node_modules/date-fns/esm/_lib/defaultOptions/index.js +0 -6
- package/es/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js +0 -18
- package/es/node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js +0 -17
- package/es/node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js +0 -27
- package/es/node_modules/date-fns/esm/_lib/getUTCWeek/index.js +0 -17
- package/es/node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js +0 -38
- package/es/node_modules/date-fns/esm/_lib/requiredArgs/index.js +0 -7
- package/es/node_modules/date-fns/esm/_lib/setUTCDay/index.js +0 -27
- package/es/node_modules/date-fns/esm/_lib/setUTCISODay/index.js +0 -23
- package/es/node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js +0 -15
- package/es/node_modules/date-fns/esm/_lib/setUTCWeek/index.js +0 -15
- package/es/node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js +0 -15
- package/es/node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js +0 -15
- package/es/node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js +0 -25
- package/es/node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js +0 -21
- package/es/node_modules/date-fns/esm/_lib/toInteger/index.js +0 -15
- package/es/node_modules/date-fns/esm/compareAsc/index.js +0 -52
- package/es/node_modules/date-fns/esm/constants/index.js +0 -40
- package/es/node_modules/date-fns/esm/differenceInCalendarDays/index.js +0 -49
- package/es/node_modules/date-fns/esm/differenceInCalendarMonths/index.js +0 -35
- package/es/node_modules/date-fns/esm/differenceInCalendarYears/index.js +0 -33
- package/es/node_modules/date-fns/esm/differenceInDays/index.js +0 -86
- package/es/node_modules/date-fns/esm/differenceInMonths/index.js +0 -59
- package/es/node_modules/date-fns/esm/differenceInYears/index.js +0 -43
- package/es/node_modules/date-fns/esm/endOfDay/index.js +0 -30
- package/es/node_modules/date-fns/esm/endOfMonth/index.js +0 -32
- package/es/node_modules/date-fns/esm/isLastDayOfMonth/index.js +0 -30
- package/es/node_modules/date-fns/esm/parse/_lib/Parser.js +0 -32
- package/es/node_modules/date-fns/esm/parse/_lib/Setter.js +0 -37
- package/es/node_modules/date-fns/esm/parse/_lib/constants.js +0 -48
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/AMPMMidnightParser.js +0 -55
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/AMPMParser.js +0 -55
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/DateParser.js +0 -55
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/DayOfYearParser.js +0 -52
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/DayParser.js +0 -80
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/DayPeriodParser.js +0 -56
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/EraParser.js +0 -53
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/ExtendedYearParser.js +0 -30
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/FractionOfSecondParser.js +0 -29
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour0To11Parser.js +0 -48
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour0to23Parser.js +0 -41
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour1To24Parser.js +0 -42
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour1to12Parser.js +0 -50
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISODayParser.js +0 -99
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneParser.js +0 -46
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneWithZParser.js +0 -46
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekParser.js +0 -43
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekYearParser.js +0 -33
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/LocalDayParser.js +0 -96
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekParser.js +0 -43
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekYearParser.js +0 -61
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/MinuteParser.js +0 -41
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/MonthParser.js +0 -80
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/QuarterParser.js +0 -73
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/SecondParser.js +0 -41
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/StandAloneLocalDayParser.js +0 -96
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/StandAloneMonthParser.js +0 -80
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/StandAloneQuarterParser.js +0 -73
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/TimestampMillisecondsParser.js +0 -26
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/TimestampSecondsParser.js +0 -26
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/YearParser.js +0 -66
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/index.js +0 -109
- package/es/node_modules/date-fns/esm/parse/_lib/utils.js +0 -133
- package/es/node_modules/date-fns/esm/startOfDay/index.js +0 -30
- package/es/node_modules/date-fns/esm/toDate/index.js +0 -55
- package/es/node_modules/diagram-js/lib/command/CommandInterceptor.js +0 -139
- package/es/node_modules/diagram-js/lib/draw/BaseRenderer.js +0 -88
- package/es/node_modules/diagram-js/lib/features/popup-menu/PopupMenu.js +0 -591
- package/es/node_modules/diagram-js/lib/features/rules/RuleProvider.js +0 -88
- package/es/node_modules/diagram-js/lib/navigation/movecanvas/MoveCanvas.js +0 -120
- package/es/node_modules/diagram-js/lib/navigation/movecanvas/index.js +0 -8
- package/es/node_modules/diagram-js/lib/navigation/zoomscroll/ZoomScroll.js +0 -227
- package/es/node_modules/diagram-js/lib/navigation/zoomscroll/ZoomUtil.js +0 -24
- package/es/node_modules/diagram-js/lib/util/ClickTrap.js +0 -23
- package/es/node_modules/diagram-js/lib/util/Cursor.js +0 -20
- package/es/node_modules/diagram-js/lib/util/Event.js +0 -22
- package/es/node_modules/diagram-js/lib/util/Math.js +0 -9
- package/es/node_modules/diagram-js/lib/util/Mouse.js +0 -30
- package/es/node_modules/diagram-js/lib/util/Platform.js +0 -5
- package/es/node_modules/diagram-js/lib/util/PositionUtil.js +0 -8
- package/es/node_modules/diagram-js/lib/util/RenderUtil.js +0 -25
- package/es/node_modules/diagram-js/lib/util/SvgTransformUtil.js +0 -48
- package/es/node_modules/ids/dist/index.esm.js +0 -164
- package/es/node_modules/inherits/inherits.js +0 -19
- package/es/node_modules/inherits/inherits_browser.js +0 -38
- package/es/node_modules/inherits-browser/dist/index.es.js +0 -3
- package/es/node_modules/min-dash/dist/index.esm.js +0 -169
- package/es/node_modules/min-dom/dist/index.esm.js +0 -588
- package/es/node_modules/tiny-svg/dist/index.esm.js +0 -525
- package/es/packages/form-render/src/components/renderer/combination.js +0 -168
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { mapValue, parseNDigits, normalizeTwoDigitYear } from '../utils.js';
|
|
3
|
-
import getUTCWeekYear from '../../../_lib/getUTCWeekYear/index.js';
|
|
4
|
-
import startOfUTCWeek from '../../../_lib/startOfUTCWeek/index.js';
|
|
5
|
-
|
|
6
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
-
// Local week-numbering year
|
|
8
|
-
class LocalWeekYearParser extends Parser {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
|
|
12
|
-
_defineProperty(this, "priority", 130);
|
|
13
|
-
|
|
14
|
-
_defineProperty(this, "incompatibleTokens", ['y', 'R', 'u', 'Q', 'q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
parse(dateString, token, match) {
|
|
18
|
-
var valueCallback = function (year) {
|
|
19
|
-
return {
|
|
20
|
-
year: year,
|
|
21
|
-
isTwoDigitYear: token === 'YY'
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
switch (token) {
|
|
26
|
-
case 'Y':
|
|
27
|
-
return mapValue(parseNDigits(4, dateString), valueCallback);
|
|
28
|
-
|
|
29
|
-
case 'Yo':
|
|
30
|
-
return mapValue(match.ordinalNumber(dateString, {
|
|
31
|
-
unit: 'year'
|
|
32
|
-
}), valueCallback);
|
|
33
|
-
|
|
34
|
-
default:
|
|
35
|
-
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
validate(_date, value) {
|
|
40
|
-
return value.isTwoDigitYear || value.year > 0;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
set(date, flags, value, options) {
|
|
44
|
-
var currentYear = getUTCWeekYear(date, options);
|
|
45
|
-
|
|
46
|
-
if (value.isTwoDigitYear) {
|
|
47
|
-
var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
|
|
48
|
-
date.setUTCFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate);
|
|
49
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
50
|
-
return startOfUTCWeek(date, options);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;
|
|
54
|
-
date.setUTCFullYear(year, 0, options.firstWeekContainsDate);
|
|
55
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
56
|
-
return startOfUTCWeek(date, options);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export { LocalWeekYearParser };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { numericPatterns } from '../constants.js';
|
|
3
|
-
import { parseNDigits, parseNumericPattern } from '../utils.js';
|
|
4
|
-
|
|
5
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
class MinuteParser extends Parser {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
|
|
10
|
-
_defineProperty(this, "priority", 60);
|
|
11
|
-
|
|
12
|
-
_defineProperty(this, "incompatibleTokens", ['t', 'T']);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
parse(dateString, token, match) {
|
|
16
|
-
switch (token) {
|
|
17
|
-
case 'm':
|
|
18
|
-
return parseNumericPattern(numericPatterns.minute, dateString);
|
|
19
|
-
|
|
20
|
-
case 'mo':
|
|
21
|
-
return match.ordinalNumber(dateString, {
|
|
22
|
-
unit: 'minute'
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
default:
|
|
26
|
-
return parseNDigits(token.length, dateString);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
validate(_date, value) {
|
|
31
|
-
return value >= 0 && value <= 59;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
set(date, _flags, value) {
|
|
35
|
-
date.setUTCMinutes(value, 0, 0);
|
|
36
|
-
return date;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export { MinuteParser };
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { mapValue, parseNDigits, parseNumericPattern } from '../utils.js';
|
|
2
|
-
import { Parser } from '../Parser.js';
|
|
3
|
-
import { numericPatterns } from '../constants.js';
|
|
4
|
-
|
|
5
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
class MonthParser extends Parser {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
|
|
10
|
-
_defineProperty(this, "incompatibleTokens", ['Y', 'R', 'q', 'Q', 'L', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);
|
|
11
|
-
|
|
12
|
-
_defineProperty(this, "priority", 110);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
parse(dateString, token, match) {
|
|
16
|
-
var valueCallback = function (value) {
|
|
17
|
-
return value - 1;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
switch (token) {
|
|
21
|
-
// 1, 2, ..., 12
|
|
22
|
-
case 'M':
|
|
23
|
-
return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);
|
|
24
|
-
// 01, 02, ..., 12
|
|
25
|
-
|
|
26
|
-
case 'MM':
|
|
27
|
-
return mapValue(parseNDigits(2, dateString), valueCallback);
|
|
28
|
-
// 1st, 2nd, ..., 12th
|
|
29
|
-
|
|
30
|
-
case 'Mo':
|
|
31
|
-
return mapValue(match.ordinalNumber(dateString, {
|
|
32
|
-
unit: 'month'
|
|
33
|
-
}), valueCallback);
|
|
34
|
-
// Jan, Feb, ..., Dec
|
|
35
|
-
|
|
36
|
-
case 'MMM':
|
|
37
|
-
return match.month(dateString, {
|
|
38
|
-
width: 'abbreviated',
|
|
39
|
-
context: 'formatting'
|
|
40
|
-
}) || match.month(dateString, {
|
|
41
|
-
width: 'narrow',
|
|
42
|
-
context: 'formatting'
|
|
43
|
-
});
|
|
44
|
-
// J, F, ..., D
|
|
45
|
-
|
|
46
|
-
case 'MMMMM':
|
|
47
|
-
return match.month(dateString, {
|
|
48
|
-
width: 'narrow',
|
|
49
|
-
context: 'formatting'
|
|
50
|
-
});
|
|
51
|
-
// January, February, ..., December
|
|
52
|
-
|
|
53
|
-
case 'MMMM':
|
|
54
|
-
default:
|
|
55
|
-
return match.month(dateString, {
|
|
56
|
-
width: 'wide',
|
|
57
|
-
context: 'formatting'
|
|
58
|
-
}) || match.month(dateString, {
|
|
59
|
-
width: 'abbreviated',
|
|
60
|
-
context: 'formatting'
|
|
61
|
-
}) || match.month(dateString, {
|
|
62
|
-
width: 'narrow',
|
|
63
|
-
context: 'formatting'
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
validate(_date, value) {
|
|
69
|
-
return value >= 0 && value <= 11;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
set(date, _flags, value) {
|
|
73
|
-
date.setUTCMonth(value, 1);
|
|
74
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
75
|
-
return date;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export { MonthParser };
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { parseNDigits } from '../utils.js';
|
|
3
|
-
|
|
4
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
class QuarterParser extends Parser {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
|
|
9
|
-
_defineProperty(this, "priority", 120);
|
|
10
|
-
|
|
11
|
-
_defineProperty(this, "incompatibleTokens", ['Y', 'R', 'q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
parse(dateString, token, match) {
|
|
15
|
-
switch (token) {
|
|
16
|
-
// 1, 2, 3, 4
|
|
17
|
-
case 'Q':
|
|
18
|
-
case 'QQ':
|
|
19
|
-
// 01, 02, 03, 04
|
|
20
|
-
return parseNDigits(token.length, dateString);
|
|
21
|
-
// 1st, 2nd, 3rd, 4th
|
|
22
|
-
|
|
23
|
-
case 'Qo':
|
|
24
|
-
return match.ordinalNumber(dateString, {
|
|
25
|
-
unit: 'quarter'
|
|
26
|
-
});
|
|
27
|
-
// Q1, Q2, Q3, Q4
|
|
28
|
-
|
|
29
|
-
case 'QQQ':
|
|
30
|
-
return match.quarter(dateString, {
|
|
31
|
-
width: 'abbreviated',
|
|
32
|
-
context: 'formatting'
|
|
33
|
-
}) || match.quarter(dateString, {
|
|
34
|
-
width: 'narrow',
|
|
35
|
-
context: 'formatting'
|
|
36
|
-
});
|
|
37
|
-
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
38
|
-
|
|
39
|
-
case 'QQQQQ':
|
|
40
|
-
return match.quarter(dateString, {
|
|
41
|
-
width: 'narrow',
|
|
42
|
-
context: 'formatting'
|
|
43
|
-
});
|
|
44
|
-
// 1st quarter, 2nd quarter, ...
|
|
45
|
-
|
|
46
|
-
case 'QQQQ':
|
|
47
|
-
default:
|
|
48
|
-
return match.quarter(dateString, {
|
|
49
|
-
width: 'wide',
|
|
50
|
-
context: 'formatting'
|
|
51
|
-
}) || match.quarter(dateString, {
|
|
52
|
-
width: 'abbreviated',
|
|
53
|
-
context: 'formatting'
|
|
54
|
-
}) || match.quarter(dateString, {
|
|
55
|
-
width: 'narrow',
|
|
56
|
-
context: 'formatting'
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
validate(_date, value) {
|
|
62
|
-
return value >= 1 && value <= 4;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
set(date, _flags, value) {
|
|
66
|
-
date.setUTCMonth((value - 1) * 3, 1);
|
|
67
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
68
|
-
return date;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export { QuarterParser };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { numericPatterns } from '../constants.js';
|
|
3
|
-
import { parseNDigits, parseNumericPattern } from '../utils.js';
|
|
4
|
-
|
|
5
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
class SecondParser extends Parser {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
|
|
10
|
-
_defineProperty(this, "priority", 50);
|
|
11
|
-
|
|
12
|
-
_defineProperty(this, "incompatibleTokens", ['t', 'T']);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
parse(dateString, token, match) {
|
|
16
|
-
switch (token) {
|
|
17
|
-
case 's':
|
|
18
|
-
return parseNumericPattern(numericPatterns.second, dateString);
|
|
19
|
-
|
|
20
|
-
case 'so':
|
|
21
|
-
return match.ordinalNumber(dateString, {
|
|
22
|
-
unit: 'second'
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
default:
|
|
26
|
-
return parseNDigits(token.length, dateString);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
validate(_date, value) {
|
|
31
|
-
return value >= 0 && value <= 59;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
set(date, _flags, value) {
|
|
35
|
-
date.setUTCSeconds(value, 0);
|
|
36
|
-
return date;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export { SecondParser };
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { mapValue, parseNDigits } from '../utils.js';
|
|
3
|
-
import setUTCDay from '../../../_lib/setUTCDay/index.js';
|
|
4
|
-
|
|
5
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
|
|
7
|
-
class StandAloneLocalDayParser extends Parser {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
|
|
11
|
-
_defineProperty(this, "priority", 90);
|
|
12
|
-
|
|
13
|
-
_defineProperty(this, "incompatibleTokens", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'e', 't', 'T']);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
parse(dateString, token, match, options) {
|
|
17
|
-
var valueCallback = function (value) {
|
|
18
|
-
var wholeWeekDays = Math.floor((value - 1) / 7) * 7;
|
|
19
|
-
return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
switch (token) {
|
|
23
|
-
// 3
|
|
24
|
-
case 'c':
|
|
25
|
-
case 'cc':
|
|
26
|
-
// 03
|
|
27
|
-
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
|
28
|
-
// 3rd
|
|
29
|
-
|
|
30
|
-
case 'co':
|
|
31
|
-
return mapValue(match.ordinalNumber(dateString, {
|
|
32
|
-
unit: 'day'
|
|
33
|
-
}), valueCallback);
|
|
34
|
-
// Tue
|
|
35
|
-
|
|
36
|
-
case 'ccc':
|
|
37
|
-
return match.day(dateString, {
|
|
38
|
-
width: 'abbreviated',
|
|
39
|
-
context: 'standalone'
|
|
40
|
-
}) || match.day(dateString, {
|
|
41
|
-
width: 'short',
|
|
42
|
-
context: 'standalone'
|
|
43
|
-
}) || match.day(dateString, {
|
|
44
|
-
width: 'narrow',
|
|
45
|
-
context: 'standalone'
|
|
46
|
-
});
|
|
47
|
-
// T
|
|
48
|
-
|
|
49
|
-
case 'ccccc':
|
|
50
|
-
return match.day(dateString, {
|
|
51
|
-
width: 'narrow',
|
|
52
|
-
context: 'standalone'
|
|
53
|
-
});
|
|
54
|
-
// Tu
|
|
55
|
-
|
|
56
|
-
case 'cccccc':
|
|
57
|
-
return match.day(dateString, {
|
|
58
|
-
width: 'short',
|
|
59
|
-
context: 'standalone'
|
|
60
|
-
}) || match.day(dateString, {
|
|
61
|
-
width: 'narrow',
|
|
62
|
-
context: 'standalone'
|
|
63
|
-
});
|
|
64
|
-
// Tuesday
|
|
65
|
-
|
|
66
|
-
case 'cccc':
|
|
67
|
-
default:
|
|
68
|
-
return match.day(dateString, {
|
|
69
|
-
width: 'wide',
|
|
70
|
-
context: 'standalone'
|
|
71
|
-
}) || match.day(dateString, {
|
|
72
|
-
width: 'abbreviated',
|
|
73
|
-
context: 'standalone'
|
|
74
|
-
}) || match.day(dateString, {
|
|
75
|
-
width: 'short',
|
|
76
|
-
context: 'standalone'
|
|
77
|
-
}) || match.day(dateString, {
|
|
78
|
-
width: 'narrow',
|
|
79
|
-
context: 'standalone'
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
validate(_date, value) {
|
|
85
|
-
return value >= 0 && value <= 6;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
set(date, _flags, value, options) {
|
|
89
|
-
date = setUTCDay(date, value, options);
|
|
90
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
91
|
-
return date;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export { StandAloneLocalDayParser };
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { numericPatterns } from '../constants.js';
|
|
3
|
-
import { mapValue, parseNDigits, parseNumericPattern } from '../utils.js';
|
|
4
|
-
|
|
5
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
class StandAloneMonthParser extends Parser {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
|
|
10
|
-
_defineProperty(this, "priority", 110);
|
|
11
|
-
|
|
12
|
-
_defineProperty(this, "incompatibleTokens", ['Y', 'R', 'q', 'Q', 'M', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
parse(dateString, token, match) {
|
|
16
|
-
var valueCallback = function (value) {
|
|
17
|
-
return value - 1;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
switch (token) {
|
|
21
|
-
// 1, 2, ..., 12
|
|
22
|
-
case 'L':
|
|
23
|
-
return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);
|
|
24
|
-
// 01, 02, ..., 12
|
|
25
|
-
|
|
26
|
-
case 'LL':
|
|
27
|
-
return mapValue(parseNDigits(2, dateString), valueCallback);
|
|
28
|
-
// 1st, 2nd, ..., 12th
|
|
29
|
-
|
|
30
|
-
case 'Lo':
|
|
31
|
-
return mapValue(match.ordinalNumber(dateString, {
|
|
32
|
-
unit: 'month'
|
|
33
|
-
}), valueCallback);
|
|
34
|
-
// Jan, Feb, ..., Dec
|
|
35
|
-
|
|
36
|
-
case 'LLL':
|
|
37
|
-
return match.month(dateString, {
|
|
38
|
-
width: 'abbreviated',
|
|
39
|
-
context: 'standalone'
|
|
40
|
-
}) || match.month(dateString, {
|
|
41
|
-
width: 'narrow',
|
|
42
|
-
context: 'standalone'
|
|
43
|
-
});
|
|
44
|
-
// J, F, ..., D
|
|
45
|
-
|
|
46
|
-
case 'LLLLL':
|
|
47
|
-
return match.month(dateString, {
|
|
48
|
-
width: 'narrow',
|
|
49
|
-
context: 'standalone'
|
|
50
|
-
});
|
|
51
|
-
// January, February, ..., December
|
|
52
|
-
|
|
53
|
-
case 'LLLL':
|
|
54
|
-
default:
|
|
55
|
-
return match.month(dateString, {
|
|
56
|
-
width: 'wide',
|
|
57
|
-
context: 'standalone'
|
|
58
|
-
}) || match.month(dateString, {
|
|
59
|
-
width: 'abbreviated',
|
|
60
|
-
context: 'standalone'
|
|
61
|
-
}) || match.month(dateString, {
|
|
62
|
-
width: 'narrow',
|
|
63
|
-
context: 'standalone'
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
validate(_date, value) {
|
|
69
|
-
return value >= 0 && value <= 11;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
set(date, _flags, value) {
|
|
73
|
-
date.setUTCMonth(value, 1);
|
|
74
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
75
|
-
return date;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export { StandAloneMonthParser };
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { parseNDigits } from '../utils.js';
|
|
3
|
-
|
|
4
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
class StandAloneQuarterParser extends Parser {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
|
|
9
|
-
_defineProperty(this, "priority", 120);
|
|
10
|
-
|
|
11
|
-
_defineProperty(this, "incompatibleTokens", ['Y', 'R', 'Q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
parse(dateString, token, match) {
|
|
15
|
-
switch (token) {
|
|
16
|
-
// 1, 2, 3, 4
|
|
17
|
-
case 'q':
|
|
18
|
-
case 'qq':
|
|
19
|
-
// 01, 02, 03, 04
|
|
20
|
-
return parseNDigits(token.length, dateString);
|
|
21
|
-
// 1st, 2nd, 3rd, 4th
|
|
22
|
-
|
|
23
|
-
case 'qo':
|
|
24
|
-
return match.ordinalNumber(dateString, {
|
|
25
|
-
unit: 'quarter'
|
|
26
|
-
});
|
|
27
|
-
// Q1, Q2, Q3, Q4
|
|
28
|
-
|
|
29
|
-
case 'qqq':
|
|
30
|
-
return match.quarter(dateString, {
|
|
31
|
-
width: 'abbreviated',
|
|
32
|
-
context: 'standalone'
|
|
33
|
-
}) || match.quarter(dateString, {
|
|
34
|
-
width: 'narrow',
|
|
35
|
-
context: 'standalone'
|
|
36
|
-
});
|
|
37
|
-
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
38
|
-
|
|
39
|
-
case 'qqqqq':
|
|
40
|
-
return match.quarter(dateString, {
|
|
41
|
-
width: 'narrow',
|
|
42
|
-
context: 'standalone'
|
|
43
|
-
});
|
|
44
|
-
// 1st quarter, 2nd quarter, ...
|
|
45
|
-
|
|
46
|
-
case 'qqqq':
|
|
47
|
-
default:
|
|
48
|
-
return match.quarter(dateString, {
|
|
49
|
-
width: 'wide',
|
|
50
|
-
context: 'standalone'
|
|
51
|
-
}) || match.quarter(dateString, {
|
|
52
|
-
width: 'abbreviated',
|
|
53
|
-
context: 'standalone'
|
|
54
|
-
}) || match.quarter(dateString, {
|
|
55
|
-
width: 'narrow',
|
|
56
|
-
context: 'standalone'
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
validate(_date, value) {
|
|
62
|
-
return value >= 1 && value <= 4;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
set(date, _flags, value) {
|
|
66
|
-
date.setUTCMonth((value - 1) * 3, 1);
|
|
67
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
68
|
-
return date;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export { StandAloneQuarterParser };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { parseAnyDigitsSigned } from '../utils.js';
|
|
3
|
-
|
|
4
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
class TimestampMillisecondsParser extends Parser {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
|
|
9
|
-
_defineProperty(this, "priority", 20);
|
|
10
|
-
|
|
11
|
-
_defineProperty(this, "incompatibleTokens", '*');
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
parse(dateString) {
|
|
15
|
-
return parseAnyDigitsSigned(dateString);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
set(_date, _flags, value) {
|
|
19
|
-
return [new Date(value), {
|
|
20
|
-
timestampIsSet: true
|
|
21
|
-
}];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { TimestampMillisecondsParser };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { parseAnyDigitsSigned } from '../utils.js';
|
|
3
|
-
|
|
4
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
class TimestampSecondsParser extends Parser {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
|
|
9
|
-
_defineProperty(this, "priority", 40);
|
|
10
|
-
|
|
11
|
-
_defineProperty(this, "incompatibleTokens", '*');
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
parse(dateString) {
|
|
15
|
-
return parseAnyDigitsSigned(dateString);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
set(_date, _flags, value) {
|
|
19
|
-
return [new Date(value * 1000), {
|
|
20
|
-
timestampIsSet: true
|
|
21
|
-
}];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { TimestampSecondsParser };
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { mapValue, parseNDigits, normalizeTwoDigitYear } from '../utils.js';
|
|
3
|
-
|
|
4
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns
|
|
6
|
-
// | Year | y | yy | yyy | yyyy | yyyyy |
|
|
7
|
-
// |----------|-------|----|-------|-------|-------|
|
|
8
|
-
// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
|
|
9
|
-
// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
|
|
10
|
-
// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
|
|
11
|
-
// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
|
|
12
|
-
// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
|
|
13
|
-
class YearParser extends Parser {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
|
|
17
|
-
_defineProperty(this, "priority", 130);
|
|
18
|
-
|
|
19
|
-
_defineProperty(this, "incompatibleTokens", ['Y', 'R', 'u', 'w', 'I', 'i', 'e', 'c', 't', 'T']);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
parse(dateString, token, match) {
|
|
23
|
-
var valueCallback = function (year) {
|
|
24
|
-
return {
|
|
25
|
-
year: year,
|
|
26
|
-
isTwoDigitYear: token === 'yy'
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
switch (token) {
|
|
31
|
-
case 'y':
|
|
32
|
-
return mapValue(parseNDigits(4, dateString), valueCallback);
|
|
33
|
-
|
|
34
|
-
case 'yo':
|
|
35
|
-
return mapValue(match.ordinalNumber(dateString, {
|
|
36
|
-
unit: 'year'
|
|
37
|
-
}), valueCallback);
|
|
38
|
-
|
|
39
|
-
default:
|
|
40
|
-
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
validate(_date, value) {
|
|
45
|
-
return value.isTwoDigitYear || value.year > 0;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
set(date, flags, value) {
|
|
49
|
-
var currentYear = date.getUTCFullYear();
|
|
50
|
-
|
|
51
|
-
if (value.isTwoDigitYear) {
|
|
52
|
-
var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
|
|
53
|
-
date.setUTCFullYear(normalizedTwoDigitYear, 0, 1);
|
|
54
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
55
|
-
return date;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;
|
|
59
|
-
date.setUTCFullYear(year, 0, 1);
|
|
60
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
61
|
-
return date;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export { YearParser };
|