cnhis-design-vue 3.1.14 → 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 +13 -4
- 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 +18 -9
- package/es/packages/big-table/src/components/edit-form/edit-separate.vue.d.ts +3 -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 +51 -36
- package/es/packages/big-table/src/hooks/useEdit.d.ts +3 -1
- package/es/packages/big-table/src/hooks/useFormat.js +8 -1
- package/es/packages/big-table/style/index.css +38 -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 +35 -73
- 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 +25 -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 +9 -7
- 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 +33 -4
- package/es/packages/form-render/src/types/index.d.ts +30 -2
- package/es/packages/form-render/src/utils/index.d.ts +8 -5
- package/es/packages/form-render/src/utils/index.js +64 -13
- 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 +158 -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 -148
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import toDate from '../toDate/index.js';
|
|
2
|
-
import differenceInCalendarYears from '../differenceInCalendarYears/index.js';
|
|
3
|
-
import compareAsc from '../compareAsc/index.js';
|
|
4
|
-
import requiredArgs from '../_lib/requiredArgs/index.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @name differenceInYears
|
|
8
|
-
* @category Year Helpers
|
|
9
|
-
* @summary Get the number of full years between the given dates.
|
|
10
|
-
*
|
|
11
|
-
* @description
|
|
12
|
-
* Get the number of full years between the given dates.
|
|
13
|
-
*
|
|
14
|
-
* @param {Date|Number} dateLeft - the later date
|
|
15
|
-
* @param {Date|Number} dateRight - the earlier date
|
|
16
|
-
* @returns {Number} the number of full years
|
|
17
|
-
* @throws {TypeError} 2 arguments required
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* // How many full years are between 31 December 2013 and 11 February 2015?
|
|
21
|
-
* const result = differenceInYears(new Date(2015, 1, 11), new Date(2013, 11, 31))
|
|
22
|
-
* //=> 1
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
function differenceInYears(dirtyDateLeft, dirtyDateRight) {
|
|
26
|
-
requiredArgs(2, arguments);
|
|
27
|
-
var dateLeft = toDate(dirtyDateLeft);
|
|
28
|
-
var dateRight = toDate(dirtyDateRight);
|
|
29
|
-
var sign = compareAsc(dateLeft, dateRight);
|
|
30
|
-
var difference = Math.abs(differenceInCalendarYears(dateLeft, dateRight)); // Set both dates to a valid leap year for accurate comparison when dealing
|
|
31
|
-
// with leap days
|
|
32
|
-
|
|
33
|
-
dateLeft.setFullYear(1584);
|
|
34
|
-
dateRight.setFullYear(1584); // Math.abs(diff in full years - diff in calendar years) === 1 if last calendar year is not full
|
|
35
|
-
// If so, result must be decreased by 1 in absolute value
|
|
36
|
-
|
|
37
|
-
var isLastYearNotFull = compareAsc(dateLeft, dateRight) === -sign;
|
|
38
|
-
var result = sign * (difference - Number(isLastYearNotFull)); // Prevent negative zero
|
|
39
|
-
|
|
40
|
-
return result === 0 ? 0 : result;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export { differenceInYears as default };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import toDate from '../toDate/index.js';
|
|
2
|
-
import requiredArgs from '../_lib/requiredArgs/index.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @name endOfDay
|
|
6
|
-
* @category Day Helpers
|
|
7
|
-
* @summary Return the end of a day for the given date.
|
|
8
|
-
*
|
|
9
|
-
* @description
|
|
10
|
-
* Return the end of a day for the given date.
|
|
11
|
-
* The result will be in the local timezone.
|
|
12
|
-
*
|
|
13
|
-
* @param {Date|Number} date - the original date
|
|
14
|
-
* @returns {Date} the end of a day
|
|
15
|
-
* @throws {TypeError} 1 argument required
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* // The end of a day for 2 September 2014 11:55:00:
|
|
19
|
-
* const result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))
|
|
20
|
-
* //=> Tue Sep 02 2014 23:59:59.999
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
function endOfDay(dirtyDate) {
|
|
24
|
-
requiredArgs(1, arguments);
|
|
25
|
-
var date = toDate(dirtyDate);
|
|
26
|
-
date.setHours(23, 59, 59, 999);
|
|
27
|
-
return date;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { endOfDay as default };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import toDate from '../toDate/index.js';
|
|
2
|
-
import requiredArgs from '../_lib/requiredArgs/index.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @name endOfMonth
|
|
6
|
-
* @category Month Helpers
|
|
7
|
-
* @summary Return the end of a month for the given date.
|
|
8
|
-
*
|
|
9
|
-
* @description
|
|
10
|
-
* Return the end of a month for the given date.
|
|
11
|
-
* The result will be in the local timezone.
|
|
12
|
-
*
|
|
13
|
-
* @param {Date|Number} date - the original date
|
|
14
|
-
* @returns {Date} the end of a month
|
|
15
|
-
* @throws {TypeError} 1 argument required
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* // The end of a month for 2 September 2014 11:55:00:
|
|
19
|
-
* const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
|
|
20
|
-
* //=> Tue Sep 30 2014 23:59:59.999
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
function endOfMonth(dirtyDate) {
|
|
24
|
-
requiredArgs(1, arguments);
|
|
25
|
-
var date = toDate(dirtyDate);
|
|
26
|
-
var month = date.getMonth();
|
|
27
|
-
date.setFullYear(date.getFullYear(), month + 1, 0);
|
|
28
|
-
date.setHours(23, 59, 59, 999);
|
|
29
|
-
return date;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { endOfMonth as default };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import toDate from '../toDate/index.js';
|
|
2
|
-
import endOfDay from '../endOfDay/index.js';
|
|
3
|
-
import endOfMonth from '../endOfMonth/index.js';
|
|
4
|
-
import requiredArgs from '../_lib/requiredArgs/index.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @name isLastDayOfMonth
|
|
8
|
-
* @category Month Helpers
|
|
9
|
-
* @summary Is the given date the last day of a month?
|
|
10
|
-
*
|
|
11
|
-
* @description
|
|
12
|
-
* Is the given date the last day of a month?
|
|
13
|
-
*
|
|
14
|
-
* @param {Date|Number} date - the date to check
|
|
15
|
-
* @returns {Boolean} the date is the last day of a month
|
|
16
|
-
* @throws {TypeError} 1 argument required
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* // Is 28 February 2014 the last day of a month?
|
|
20
|
-
* const result = isLastDayOfMonth(new Date(2014, 1, 28))
|
|
21
|
-
* //=> true
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
function isLastDayOfMonth(dirtyDate) {
|
|
25
|
-
requiredArgs(1, arguments);
|
|
26
|
-
var date = toDate(dirtyDate);
|
|
27
|
-
return endOfDay(date).getTime() === endOfMonth(date).getTime();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { isLastDayOfMonth as default };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ValueSetter } from './Setter.js';
|
|
2
|
-
|
|
3
|
-
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; }
|
|
4
|
-
class Parser {
|
|
5
|
-
constructor() {
|
|
6
|
-
_defineProperty(this, "incompatibleTokens", void 0);
|
|
7
|
-
|
|
8
|
-
_defineProperty(this, "priority", void 0);
|
|
9
|
-
|
|
10
|
-
_defineProperty(this, "subPriority", void 0);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
run(dateString, token, match, options) {
|
|
14
|
-
var result = this.parse(dateString, token, match, options);
|
|
15
|
-
|
|
16
|
-
if (!result) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
setter: new ValueSetter(result.value, this.validate, this.set, this.priority, this.subPriority),
|
|
22
|
-
rest: result.rest
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
validate(_utcDate, _value, _options) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { Parser };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
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; }
|
|
2
|
-
class Setter {
|
|
3
|
-
constructor() {
|
|
4
|
-
_defineProperty(this, "priority", void 0);
|
|
5
|
-
|
|
6
|
-
_defineProperty(this, "subPriority", 0);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
validate(_utcDate, _options) {
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
class ValueSetter extends Setter {
|
|
15
|
-
constructor(value, validateValue, setValue, priority, subPriority) {
|
|
16
|
-
super();
|
|
17
|
-
this.value = value;
|
|
18
|
-
this.validateValue = validateValue;
|
|
19
|
-
this.setValue = setValue;
|
|
20
|
-
this.priority = priority;
|
|
21
|
-
|
|
22
|
-
if (subPriority) {
|
|
23
|
-
this.subPriority = subPriority;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
validate(utcDate, options) {
|
|
28
|
-
return this.validateValue(utcDate, this.value, options);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
set(utcDate, flags, options) {
|
|
32
|
-
return this.setValue(utcDate, flags, this.value, options);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export { Setter, ValueSetter };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
var numericPatterns = {
|
|
2
|
-
month: /^(1[0-2]|0?\d)/,
|
|
3
|
-
// 0 to 12
|
|
4
|
-
date: /^(3[0-1]|[0-2]?\d)/,
|
|
5
|
-
// 0 to 31
|
|
6
|
-
dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,
|
|
7
|
-
// 0 to 366
|
|
8
|
-
week: /^(5[0-3]|[0-4]?\d)/,
|
|
9
|
-
// 0 to 53
|
|
10
|
-
hour23h: /^(2[0-3]|[0-1]?\d)/,
|
|
11
|
-
// 0 to 23
|
|
12
|
-
hour24h: /^(2[0-4]|[0-1]?\d)/,
|
|
13
|
-
// 0 to 24
|
|
14
|
-
hour11h: /^(1[0-1]|0?\d)/,
|
|
15
|
-
// 0 to 11
|
|
16
|
-
hour12h: /^(1[0-2]|0?\d)/,
|
|
17
|
-
// 0 to 12
|
|
18
|
-
minute: /^[0-5]?\d/,
|
|
19
|
-
// 0 to 59
|
|
20
|
-
second: /^[0-5]?\d/,
|
|
21
|
-
// 0 to 59
|
|
22
|
-
singleDigit: /^\d/,
|
|
23
|
-
// 0 to 9
|
|
24
|
-
twoDigits: /^\d{1,2}/,
|
|
25
|
-
// 0 to 99
|
|
26
|
-
threeDigits: /^\d{1,3}/,
|
|
27
|
-
// 0 to 999
|
|
28
|
-
fourDigits: /^\d{1,4}/,
|
|
29
|
-
// 0 to 9999
|
|
30
|
-
anyDigitsSigned: /^-?\d+/,
|
|
31
|
-
singleDigitSigned: /^-?\d/,
|
|
32
|
-
// 0 to 9, -0 to -9
|
|
33
|
-
twoDigitsSigned: /^-?\d{1,2}/,
|
|
34
|
-
// 0 to 99, -0 to -99
|
|
35
|
-
threeDigitsSigned: /^-?\d{1,3}/,
|
|
36
|
-
// 0 to 999, -0 to -999
|
|
37
|
-
fourDigitsSigned: /^-?\d{1,4}/ // 0 to 9999, -0 to -9999
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
var timezonePatterns = {
|
|
41
|
-
basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
|
|
42
|
-
basic: /^([+-])(\d{2})(\d{2})|Z/,
|
|
43
|
-
basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
|
|
44
|
-
extended: /^([+-])(\d{2}):(\d{2})|Z/,
|
|
45
|
-
extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export { numericPatterns, timezonePatterns };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { dayPeriodEnumToHours } 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 AMPMMidnightParser extends Parser {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
|
|
9
|
-
_defineProperty(this, "priority", 80);
|
|
10
|
-
|
|
11
|
-
_defineProperty(this, "incompatibleTokens", ['a', 'B', 'H', 'k', 't', 'T']);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
parse(dateString, token, match) {
|
|
15
|
-
switch (token) {
|
|
16
|
-
case 'b':
|
|
17
|
-
case 'bb':
|
|
18
|
-
case 'bbb':
|
|
19
|
-
return match.dayPeriod(dateString, {
|
|
20
|
-
width: 'abbreviated',
|
|
21
|
-
context: 'formatting'
|
|
22
|
-
}) || match.dayPeriod(dateString, {
|
|
23
|
-
width: 'narrow',
|
|
24
|
-
context: 'formatting'
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
case 'bbbbb':
|
|
28
|
-
return match.dayPeriod(dateString, {
|
|
29
|
-
width: 'narrow',
|
|
30
|
-
context: 'formatting'
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
case 'bbbb':
|
|
34
|
-
default:
|
|
35
|
-
return match.dayPeriod(dateString, {
|
|
36
|
-
width: 'wide',
|
|
37
|
-
context: 'formatting'
|
|
38
|
-
}) || match.dayPeriod(dateString, {
|
|
39
|
-
width: 'abbreviated',
|
|
40
|
-
context: 'formatting'
|
|
41
|
-
}) || match.dayPeriod(dateString, {
|
|
42
|
-
width: 'narrow',
|
|
43
|
-
context: 'formatting'
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
set(date, _flags, value) {
|
|
49
|
-
date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
|
50
|
-
return date;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export { AMPMMidnightParser };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { dayPeriodEnumToHours } 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 AMPMParser extends Parser {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
|
|
9
|
-
_defineProperty(this, "priority", 80);
|
|
10
|
-
|
|
11
|
-
_defineProperty(this, "incompatibleTokens", ['b', 'B', 'H', 'k', 't', 'T']);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
parse(dateString, token, match) {
|
|
15
|
-
switch (token) {
|
|
16
|
-
case 'a':
|
|
17
|
-
case 'aa':
|
|
18
|
-
case 'aaa':
|
|
19
|
-
return match.dayPeriod(dateString, {
|
|
20
|
-
width: 'abbreviated',
|
|
21
|
-
context: 'formatting'
|
|
22
|
-
}) || match.dayPeriod(dateString, {
|
|
23
|
-
width: 'narrow',
|
|
24
|
-
context: 'formatting'
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
case 'aaaaa':
|
|
28
|
-
return match.dayPeriod(dateString, {
|
|
29
|
-
width: 'narrow',
|
|
30
|
-
context: 'formatting'
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
case 'aaaa':
|
|
34
|
-
default:
|
|
35
|
-
return match.dayPeriod(dateString, {
|
|
36
|
-
width: 'wide',
|
|
37
|
-
context: 'formatting'
|
|
38
|
-
}) || match.dayPeriod(dateString, {
|
|
39
|
-
width: 'abbreviated',
|
|
40
|
-
context: 'formatting'
|
|
41
|
-
}) || match.dayPeriod(dateString, {
|
|
42
|
-
width: 'narrow',
|
|
43
|
-
context: 'formatting'
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
set(date, _flags, value) {
|
|
49
|
-
date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
|
50
|
-
return date;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export { AMPMParser };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { parseNDigits, parseNumericPattern, isLeapYearIndex } 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
|
-
var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
7
|
-
var DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; // Day of the month
|
|
8
|
-
|
|
9
|
-
class DateParser extends Parser {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
|
|
13
|
-
_defineProperty(this, "priority", 90);
|
|
14
|
-
|
|
15
|
-
_defineProperty(this, "subPriority", 1);
|
|
16
|
-
|
|
17
|
-
_defineProperty(this, "incompatibleTokens", ['Y', 'R', 'q', 'Q', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
parse(dateString, token, match) {
|
|
21
|
-
switch (token) {
|
|
22
|
-
case 'd':
|
|
23
|
-
return parseNumericPattern(numericPatterns.date, dateString);
|
|
24
|
-
|
|
25
|
-
case 'do':
|
|
26
|
-
return match.ordinalNumber(dateString, {
|
|
27
|
-
unit: 'date'
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
default:
|
|
31
|
-
return parseNDigits(token.length, dateString);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
validate(date, value) {
|
|
36
|
-
var year = date.getUTCFullYear();
|
|
37
|
-
var isLeapYear = isLeapYearIndex(year);
|
|
38
|
-
var month = date.getUTCMonth();
|
|
39
|
-
|
|
40
|
-
if (isLeapYear) {
|
|
41
|
-
return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];
|
|
42
|
-
} else {
|
|
43
|
-
return value >= 1 && value <= DAYS_IN_MONTH[month];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
set(date, _flags, value) {
|
|
48
|
-
date.setUTCDate(value);
|
|
49
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
50
|
-
return date;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export { DateParser };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { numericPatterns } from '../constants.js';
|
|
3
|
-
import { parseNDigits, parseNumericPattern, isLeapYearIndex } 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 DayOfYearParser extends Parser {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
|
|
10
|
-
_defineProperty(this, "priority", 90);
|
|
11
|
-
|
|
12
|
-
_defineProperty(this, "subpriority", 1);
|
|
13
|
-
|
|
14
|
-
_defineProperty(this, "incompatibleTokens", ['Y', 'R', 'q', 'Q', 'M', 'L', 'w', 'I', 'd', 'E', 'i', 'e', 'c', 't', 'T']);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
parse(dateString, token, match) {
|
|
18
|
-
switch (token) {
|
|
19
|
-
case 'D':
|
|
20
|
-
case 'DD':
|
|
21
|
-
return parseNumericPattern(numericPatterns.dayOfYear, dateString);
|
|
22
|
-
|
|
23
|
-
case 'Do':
|
|
24
|
-
return match.ordinalNumber(dateString, {
|
|
25
|
-
unit: 'date'
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
default:
|
|
29
|
-
return parseNDigits(token.length, dateString);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
validate(date, value) {
|
|
34
|
-
var year = date.getUTCFullYear();
|
|
35
|
-
var isLeapYear = isLeapYearIndex(year);
|
|
36
|
-
|
|
37
|
-
if (isLeapYear) {
|
|
38
|
-
return value >= 1 && value <= 366;
|
|
39
|
-
} else {
|
|
40
|
-
return value >= 1 && value <= 365;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
set(date, _flags, value) {
|
|
45
|
-
date.setUTCMonth(0, value);
|
|
46
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
47
|
-
return date;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export { DayOfYearParser };
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import setUTCDay from '../../../_lib/setUTCDay/index.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
|
-
|
|
6
|
-
class DayParser extends Parser {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
|
|
10
|
-
_defineProperty(this, "priority", 90);
|
|
11
|
-
|
|
12
|
-
_defineProperty(this, "incompatibleTokens", ['D', 'i', 'e', 'c', 't', 'T']);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
parse(dateString, token, match) {
|
|
16
|
-
switch (token) {
|
|
17
|
-
// Tue
|
|
18
|
-
case 'E':
|
|
19
|
-
case 'EE':
|
|
20
|
-
case 'EEE':
|
|
21
|
-
return match.day(dateString, {
|
|
22
|
-
width: 'abbreviated',
|
|
23
|
-
context: 'formatting'
|
|
24
|
-
}) || match.day(dateString, {
|
|
25
|
-
width: 'short',
|
|
26
|
-
context: 'formatting'
|
|
27
|
-
}) || match.day(dateString, {
|
|
28
|
-
width: 'narrow',
|
|
29
|
-
context: 'formatting'
|
|
30
|
-
});
|
|
31
|
-
// T
|
|
32
|
-
|
|
33
|
-
case 'EEEEE':
|
|
34
|
-
return match.day(dateString, {
|
|
35
|
-
width: 'narrow',
|
|
36
|
-
context: 'formatting'
|
|
37
|
-
});
|
|
38
|
-
// Tu
|
|
39
|
-
|
|
40
|
-
case 'EEEEEE':
|
|
41
|
-
return match.day(dateString, {
|
|
42
|
-
width: 'short',
|
|
43
|
-
context: 'formatting'
|
|
44
|
-
}) || match.day(dateString, {
|
|
45
|
-
width: 'narrow',
|
|
46
|
-
context: 'formatting'
|
|
47
|
-
});
|
|
48
|
-
// Tuesday
|
|
49
|
-
|
|
50
|
-
case 'EEEE':
|
|
51
|
-
default:
|
|
52
|
-
return match.day(dateString, {
|
|
53
|
-
width: 'wide',
|
|
54
|
-
context: 'formatting'
|
|
55
|
-
}) || match.day(dateString, {
|
|
56
|
-
width: 'abbreviated',
|
|
57
|
-
context: 'formatting'
|
|
58
|
-
}) || match.day(dateString, {
|
|
59
|
-
width: 'short',
|
|
60
|
-
context: 'formatting'
|
|
61
|
-
}) || match.day(dateString, {
|
|
62
|
-
width: 'narrow',
|
|
63
|
-
context: 'formatting'
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
validate(_date, value) {
|
|
69
|
-
return value >= 0 && value <= 6;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
set(date, _flags, value, options) {
|
|
73
|
-
date = setUTCDay(date, value, options);
|
|
74
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
75
|
-
return date;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export { DayParser };
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { dayPeriodEnumToHours } 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
|
-
|
|
6
|
-
class DayPeriodParser extends Parser {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
|
|
10
|
-
_defineProperty(this, "priority", 80);
|
|
11
|
-
|
|
12
|
-
_defineProperty(this, "incompatibleTokens", ['a', 'b', 't', 'T']);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
parse(dateString, token, match) {
|
|
16
|
-
switch (token) {
|
|
17
|
-
case 'B':
|
|
18
|
-
case 'BB':
|
|
19
|
-
case 'BBB':
|
|
20
|
-
return match.dayPeriod(dateString, {
|
|
21
|
-
width: 'abbreviated',
|
|
22
|
-
context: 'formatting'
|
|
23
|
-
}) || match.dayPeriod(dateString, {
|
|
24
|
-
width: 'narrow',
|
|
25
|
-
context: 'formatting'
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
case 'BBBBB':
|
|
29
|
-
return match.dayPeriod(dateString, {
|
|
30
|
-
width: 'narrow',
|
|
31
|
-
context: 'formatting'
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
case 'BBBB':
|
|
35
|
-
default:
|
|
36
|
-
return match.dayPeriod(dateString, {
|
|
37
|
-
width: 'wide',
|
|
38
|
-
context: 'formatting'
|
|
39
|
-
}) || match.dayPeriod(dateString, {
|
|
40
|
-
width: 'abbreviated',
|
|
41
|
-
context: 'formatting'
|
|
42
|
-
}) || match.dayPeriod(dateString, {
|
|
43
|
-
width: 'narrow',
|
|
44
|
-
context: 'formatting'
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
set(date, _flags, value) {
|
|
50
|
-
date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
|
51
|
-
return date;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export { DayPeriodParser };
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
|
|
3
|
-
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; }
|
|
4
|
-
class EraParser extends Parser {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
|
|
8
|
-
_defineProperty(this, "priority", 140);
|
|
9
|
-
|
|
10
|
-
_defineProperty(this, "incompatibleTokens", ['R', 'u', 't', 'T']);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
parse(dateString, token, match) {
|
|
14
|
-
switch (token) {
|
|
15
|
-
// AD, BC
|
|
16
|
-
case 'G':
|
|
17
|
-
case 'GG':
|
|
18
|
-
case 'GGG':
|
|
19
|
-
return match.era(dateString, {
|
|
20
|
-
width: 'abbreviated'
|
|
21
|
-
}) || match.era(dateString, {
|
|
22
|
-
width: 'narrow'
|
|
23
|
-
});
|
|
24
|
-
// A, B
|
|
25
|
-
|
|
26
|
-
case 'GGGGG':
|
|
27
|
-
return match.era(dateString, {
|
|
28
|
-
width: 'narrow'
|
|
29
|
-
});
|
|
30
|
-
// Anno Domini, Before Christ
|
|
31
|
-
|
|
32
|
-
case 'GGGG':
|
|
33
|
-
default:
|
|
34
|
-
return match.era(dateString, {
|
|
35
|
-
width: 'wide'
|
|
36
|
-
}) || match.era(dateString, {
|
|
37
|
-
width: 'abbreviated'
|
|
38
|
-
}) || match.era(dateString, {
|
|
39
|
-
width: 'narrow'
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
set(date, flags, value) {
|
|
45
|
-
flags.era = value;
|
|
46
|
-
date.setUTCFullYear(value, 0, 1);
|
|
47
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
48
|
-
return date;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export { EraParser };
|