@coopdigital/react 0.55.0 → 0.57.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/README.md +2 -2
- package/dist/components/Button/Button.js +2 -2
- package/dist/components/Card/Card.js +4 -4
- package/dist/components/DatePicker/DatePicker.js +3 -2
- package/dist/components/DatePicker/datepicker-utils.js +1 -5
- package/dist/components/Field/Field.d.ts +7 -24
- package/dist/components/Field/Field.js +11 -18
- package/dist/components/Field/index.js +0 -1
- package/dist/components/Fieldset/Fieldset.d.ts +12 -17
- package/dist/components/Fieldset/Fieldset.js +6 -8
- package/dist/components/Pill/Pill.js +2 -2
- package/dist/components/Popover/Popover.js +6 -6
- package/dist/components/Searchbox/Searchbox.js +4 -4
- package/dist/components/Signpost/Signpost.js +2 -2
- package/dist/components/Tag/Tag.js +2 -2
- package/dist/components/Textarea/Textarea.js +2 -0
- package/dist/hooks/useSlots.js +3 -3
- package/dist/index.js +2 -2
- package/package.json +11 -11
- package/src/components/DatePicker/DatePicker.tsx +10 -3
- package/src/components/Field/Field.tsx +5 -29
- package/src/components/Fieldset/Fieldset.tsx +6 -8
- package/src/components/Textarea/Textarea.tsx +2 -0
- package/dist/node_modules/@date-fns/tz/date/index.js +0 -83
- package/dist/node_modules/@date-fns/tz/date/mini.js +0 -235
- package/dist/node_modules/@date-fns/tz/tzName/index.js +0 -39
- package/dist/node_modules/@date-fns/tz/tzOffset/index.js +0 -44
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -814
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -751
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -350
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -161
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -137
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +0 -11
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +0 -25
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -39
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +0 -63
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +0 -213
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +0 -31
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +0 -209
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +0 -15
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +0 -303
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +0 -285
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +0 -19
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +0 -132
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +0 -43
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +0 -89
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +0 -12
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -70
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -18
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -7
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +0 -40
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +0 -137
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +0 -7
- package/dist/node_modules/date-fns/_lib/defaultOptions.js +0 -7
- package/dist/node_modules/date-fns/_lib/format/formatters.js +0 -775
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +0 -94
- package/dist/node_modules/date-fns/_lib/format/longFormatters.js +0 -66
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +0 -31
- package/dist/node_modules/date-fns/_lib/normalizeDates.js +0 -11
- package/dist/node_modules/date-fns/_lib/normalizeInterval.js +0 -8
- package/dist/node_modules/date-fns/_lib/protectedTokens.js +0 -25
- package/dist/node_modules/date-fns/addDays.js +0 -41
- package/dist/node_modules/date-fns/addMonths.js +0 -75
- package/dist/node_modules/date-fns/addWeeks.js +0 -33
- package/dist/node_modules/date-fns/addYears.js +0 -33
- package/dist/node_modules/date-fns/constants.js +0 -67
- package/dist/node_modules/date-fns/constructFrom.js +0 -49
- package/dist/node_modules/date-fns/differenceInCalendarDays.js +0 -62
- package/dist/node_modules/date-fns/differenceInCalendarMonths.js +0 -42
- package/dist/node_modules/date-fns/eachMonthOfInterval.js +0 -65
- package/dist/node_modules/date-fns/eachYearOfInterval.js +0 -65
- package/dist/node_modules/date-fns/endOfISOWeek.js +0 -35
- package/dist/node_modules/date-fns/endOfMonth.js +0 -37
- package/dist/node_modules/date-fns/endOfWeek.js +0 -53
- package/dist/node_modules/date-fns/endOfYear.js +0 -37
- package/dist/node_modules/date-fns/format.js +0 -423
- package/dist/node_modules/date-fns/getDayOfYear.js +0 -34
- package/dist/node_modules/date-fns/getDaysInMonth.js +0 -36
- package/dist/node_modules/date-fns/getDefaultOptions.js +0 -31
- package/dist/node_modules/date-fns/getISODay.js +0 -33
- package/dist/node_modules/date-fns/getISOWeek.js +0 -40
- package/dist/node_modules/date-fns/getISOWeekYear.js +0 -52
- package/dist/node_modules/date-fns/getMonth.js +0 -29
- package/dist/node_modules/date-fns/getWeek.js +0 -54
- package/dist/node_modules/date-fns/getWeekYear.js +0 -75
- package/dist/node_modules/date-fns/getYear.js +0 -29
- package/dist/node_modules/date-fns/isAfter.js +0 -25
- package/dist/node_modules/date-fns/isBefore.js +0 -25
- package/dist/node_modules/date-fns/isDate.js +0 -41
- package/dist/node_modules/date-fns/isSameDay.js +0 -46
- package/dist/node_modules/date-fns/isSameMonth.js +0 -43
- package/dist/node_modules/date-fns/isSameYear.js +0 -35
- package/dist/node_modules/date-fns/isValid.js +0 -39
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +0 -10
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +0 -64
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +0 -59
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +0 -22
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +0 -103
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +0 -41
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +0 -13
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +0 -189
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +0 -134
- package/dist/node_modules/date-fns/locale/en-US.js +0 -28
- package/dist/node_modules/date-fns/max.js +0 -49
- package/dist/node_modules/date-fns/min.js +0 -49
- package/dist/node_modules/date-fns/parse/_lib/Parser.js +0 -27
- package/dist/node_modules/date-fns/parse/_lib/Setter.js +0 -59
- package/dist/node_modules/date-fns/parse/_lib/constants.js +0 -33
- package/dist/node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.js +0 -55
- package/dist/node_modules/date-fns/parse/_lib/parsers/AMPMParser.js +0 -55
- package/dist/node_modules/date-fns/parse/_lib/parsers/DateParser.js +0 -59
- package/dist/node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js +0 -57
- package/dist/node_modules/date-fns/parse/_lib/parsers/DayParser.js +0 -64
- package/dist/node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.js +0 -56
- package/dist/node_modules/date-fns/parse/_lib/parsers/EraParser.js +0 -41
- package/dist/node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js +0 -24
- package/dist/node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.js +0 -21
- package/dist/node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.js +0 -36
- package/dist/node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.js +0 -31
- package/dist/node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.js +0 -32
- package/dist/node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.js +0 -38
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISODayParser.js +0 -118
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.js +0 -47
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js +0 -47
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js +0 -48
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js +0 -44
- package/dist/node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js +0 -96
- package/dist/node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js +0 -47
- package/dist/node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js +0 -76
- package/dist/node_modules/date-fns/parse/_lib/parsers/MinuteParser.js +0 -31
- package/dist/node_modules/date-fns/parse/_lib/parsers/MonthParser.js +0 -86
- package/dist/node_modules/date-fns/parse/_lib/parsers/QuarterParser.js +0 -83
- package/dist/node_modules/date-fns/parse/_lib/parsers/SecondParser.js +0 -31
- package/dist/node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js +0 -97
- package/dist/node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js +0 -86
- package/dist/node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js +0 -83
- package/dist/node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js +0 -19
- package/dist/node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.js +0 -19
- package/dist/node_modules/date-fns/parse/_lib/parsers/YearParser.js +0 -62
- package/dist/node_modules/date-fns/parse/_lib/parsers.js +0 -110
- package/dist/node_modules/date-fns/parse/_lib/utils.js +0 -135
- package/dist/node_modules/date-fns/parse.js +0 -497
- package/dist/node_modules/date-fns/setDay.js +0 -59
- package/dist/node_modules/date-fns/setISODay.js +0 -40
- package/dist/node_modules/date-fns/setISOWeek.js +0 -39
- package/dist/node_modules/date-fns/setMonth.js +0 -46
- package/dist/node_modules/date-fns/setWeek.js +0 -53
- package/dist/node_modules/date-fns/setYear.js +0 -40
- package/dist/node_modules/date-fns/startOfDay.js +0 -35
- package/dist/node_modules/date-fns/startOfISOWeek.js +0 -35
- package/dist/node_modules/date-fns/startOfISOWeekYear.js +0 -42
- package/dist/node_modules/date-fns/startOfMonth.js +0 -37
- package/dist/node_modules/date-fns/startOfWeek.js +0 -53
- package/dist/node_modules/date-fns/startOfWeekYear.js +0 -64
- package/dist/node_modules/date-fns/startOfYear.js +0 -36
- package/dist/node_modules/date-fns/toDate.js +0 -46
- package/dist/node_modules/date-fns/transpose.js +0 -52
- package/dist/node_modules/get-nonce/dist/es2015/index.js +0 -8
- package/dist/node_modules/react-day-picker/dist/esm/DayPicker.js +0 -320
- package/dist/node_modules/react-day-picker/dist/esm/UI.js +0 -122
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarDay.js +0 -33
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarMonth.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarWeek.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/classes/DateLib.js +0 -604
- package/dist/node_modules/react-day-picker/dist/esm/components/Button.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/CaptionLabel.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Chevron.js +0 -20
- package/dist/node_modules/react-day-picker/dist/esm/components/Day.js +0 -18
- package/dist/node_modules/react-day-picker/dist/esm/components/DayButton.js +0 -19
- package/dist/node_modules/react-day-picker/dist/esm/components/Dropdown.js +0 -21
- package/dist/node_modules/react-day-picker/dist/esm/components/DropdownNav.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Footer.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Month.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthCaption.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthGrid.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Months.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthsDropdown.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/Nav.js +0 -31
- package/dist/node_modules/react-day-picker/dist/esm/components/NextMonthButton.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/Option.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/PreviousMonthButton.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/Root.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/Select.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Week.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/WeekNumber.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/WeekNumberHeader.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Weekday.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Weekdays.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/Weeks.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/YearsDropdown.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/custom-components.js +0 -26
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js +0 -26
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatDay.js +0 -19
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatMonthDropdown.js +0 -18
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumber.js +0 -21
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumberHeader.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekdayName.js +0 -19
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatYearDropdown.js +0 -23
- package/dist/node_modules/react-day-picker/dist/esm/formatters/index.js +0 -7
- package/dist/node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js +0 -73
- package/dist/node_modules/react-day-picker/dist/esm/helpers/createGetModifiers.js +0 -95
- package/dist/node_modules/react-day-picker/dist/esm/helpers/endOfBroadcastWeek.js +0 -22
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getBroadcastWeeksInMonth.js +0 -28
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getClassNamesForModifiers.js +0 -33
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getComponents.js +0 -20
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDataAttributes.js +0 -27
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDates.js +0 -59
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDays.js +0 -19
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js +0 -33
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDisplayMonths.js +0 -24
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getFocusableDate.js +0 -46
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getFormatters.js +0 -24
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getInitialMonth.js +0 -27
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getLabels.js +0 -53
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getMonthOptions.js +0 -33
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getMonths.js +0 -69
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNavMonth.js +0 -51
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNextFocus.js +0 -40
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNextMonth.js +0 -36
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getPreviousMonth.js +0 -37
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getStyleForModifiers.js +0 -27
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getWeekdays.js +0 -26
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getWeeks.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getYearOptions.js +0 -36
- package/dist/node_modules/react-day-picker/dist/esm/helpers/startOfBroadcastWeek.js +0 -27
- package/dist/node_modules/react-day-picker/dist/esm/helpers/useControlledValue.js +0 -31
- package/dist/node_modules/react-day-picker/dist/esm/labels/index.js +0 -11
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelDayButton.js +0 -32
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelGrid.js +0 -25
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelGridcell.js +0 -22
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelMonthDropdown.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelNav.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelNext.js +0 -16
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelPrevious.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekNumber.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekNumberHeader.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekday.js +0 -18
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelYearDropdown.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/locale/en-US.js +0 -67
- package/dist/node_modules/react-day-picker/dist/esm/selection/useMulti.js +0 -57
- package/dist/node_modules/react-day-picker/dist/esm/selection/useRange.js +0 -45
- package/dist/node_modules/react-day-picker/dist/esm/selection/useSingle.js +0 -44
- package/dist/node_modules/react-day-picker/dist/esm/useAnimation.js +0 -174
- package/dist/node_modules/react-day-picker/dist/esm/useCalendar.js +0 -113
- package/dist/node_modules/react-day-picker/dist/esm/useDayPicker.js +0 -25
- package/dist/node_modules/react-day-picker/dist/esm/useFocus.js +0 -56
- package/dist/node_modules/react-day-picker/dist/esm/useSelection.js +0 -31
- package/dist/node_modules/react-day-picker/dist/esm/utils/addToRange.js +0 -95
- package/dist/node_modules/react-day-picker/dist/esm/utils/convertMatchersToTimeZone.js +0 -57
- package/dist/node_modules/react-day-picker/dist/esm/utils/dateMatchModifiers.js +0 -62
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeContainsDayOfWeek.js +0 -30
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeContainsModifiers.js +0 -74
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeIncludesDate.js +0 -35
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeOverlaps.js +0 -21
- package/dist/node_modules/react-day-picker/dist/esm/utils/toTimeZone.js +0 -16
- package/dist/node_modules/react-day-picker/dist/esm/utils/typeguards.js +0 -66
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +0 -9
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +0 -167
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +0 -38
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +0 -21
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +0 -110
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +0 -5
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +0 -7
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +0 -56
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +0 -10
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +0 -31
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +0 -19
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +0 -25
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +0 -51
- package/dist/node_modules/tslib/tslib.es6.js +0 -56
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +0 -24
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +0 -48
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +0 -42
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +0 -21
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +0 -77
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const numericPatterns = {
|
|
2
|
-
month: /^(1[0-2]|0?\d)/, // 0 to 12
|
|
3
|
-
date: /^(3[0-1]|[0-2]?\d)/, // 0 to 31
|
|
4
|
-
dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/, // 0 to 366
|
|
5
|
-
week: /^(5[0-3]|[0-4]?\d)/, // 0 to 53
|
|
6
|
-
hour23h: /^(2[0-3]|[0-1]?\d)/, // 0 to 23
|
|
7
|
-
hour24h: /^(2[0-4]|[0-1]?\d)/, // 0 to 24
|
|
8
|
-
hour11h: /^(1[0-1]|0?\d)/, // 0 to 11
|
|
9
|
-
hour12h: /^(1[0-2]|0?\d)/, // 0 to 12
|
|
10
|
-
minute: /^[0-5]?\d/, // 0 to 59
|
|
11
|
-
second: /^[0-5]?\d/, // 0 to 59
|
|
12
|
-
|
|
13
|
-
singleDigit: /^\d/, // 0 to 9
|
|
14
|
-
twoDigits: /^\d{1,2}/, // 0 to 99
|
|
15
|
-
threeDigits: /^\d{1,3}/, // 0 to 999
|
|
16
|
-
fourDigits: /^\d{1,4}/, // 0 to 9999
|
|
17
|
-
|
|
18
|
-
anyDigitsSigned: /^-?\d+/,
|
|
19
|
-
singleDigitSigned: /^-?\d/, // 0 to 9, -0 to -9
|
|
20
|
-
twoDigitsSigned: /^-?\d{1,2}/, // 0 to 99, -0 to -99
|
|
21
|
-
threeDigitsSigned: /^-?\d{1,3}/, // 0 to 999, -0 to -999
|
|
22
|
-
fourDigitsSigned: /^-?\d{1,4}/, // 0 to 9999, -0 to -9999
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const timezonePatterns = {
|
|
26
|
-
basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
|
|
27
|
-
basic: /^([+-])(\d{2})(\d{2})|Z/,
|
|
28
|
-
basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
|
|
29
|
-
extended: /^([+-])(\d{2}):(\d{2})|Z/,
|
|
30
|
-
extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export { numericPatterns, timezonePatterns };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { dayPeriodEnumToHours } from '../utils.js';
|
|
3
|
-
|
|
4
|
-
class AMPMMidnightParser extends Parser {
|
|
5
|
-
priority = 80;
|
|
6
|
-
|
|
7
|
-
parse(dateString, token, match) {
|
|
8
|
-
switch (token) {
|
|
9
|
-
case "b":
|
|
10
|
-
case "bb":
|
|
11
|
-
case "bbb":
|
|
12
|
-
return (
|
|
13
|
-
match.dayPeriod(dateString, {
|
|
14
|
-
width: "abbreviated",
|
|
15
|
-
context: "formatting",
|
|
16
|
-
}) ||
|
|
17
|
-
match.dayPeriod(dateString, {
|
|
18
|
-
width: "narrow",
|
|
19
|
-
context: "formatting",
|
|
20
|
-
})
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
case "bbbbb":
|
|
24
|
-
return match.dayPeriod(dateString, {
|
|
25
|
-
width: "narrow",
|
|
26
|
-
context: "formatting",
|
|
27
|
-
});
|
|
28
|
-
case "bbbb":
|
|
29
|
-
default:
|
|
30
|
-
return (
|
|
31
|
-
match.dayPeriod(dateString, {
|
|
32
|
-
width: "wide",
|
|
33
|
-
context: "formatting",
|
|
34
|
-
}) ||
|
|
35
|
-
match.dayPeriod(dateString, {
|
|
36
|
-
width: "abbreviated",
|
|
37
|
-
context: "formatting",
|
|
38
|
-
}) ||
|
|
39
|
-
match.dayPeriod(dateString, {
|
|
40
|
-
width: "narrow",
|
|
41
|
-
context: "formatting",
|
|
42
|
-
})
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
set(date, _flags, value) {
|
|
48
|
-
date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
|
49
|
-
return date;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
incompatibleTokens = ["a", "B", "H", "k", "t", "T"];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export { AMPMMidnightParser };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { dayPeriodEnumToHours } from '../utils.js';
|
|
3
|
-
|
|
4
|
-
class AMPMParser extends Parser {
|
|
5
|
-
priority = 80;
|
|
6
|
-
|
|
7
|
-
parse(dateString, token, match) {
|
|
8
|
-
switch (token) {
|
|
9
|
-
case "a":
|
|
10
|
-
case "aa":
|
|
11
|
-
case "aaa":
|
|
12
|
-
return (
|
|
13
|
-
match.dayPeriod(dateString, {
|
|
14
|
-
width: "abbreviated",
|
|
15
|
-
context: "formatting",
|
|
16
|
-
}) ||
|
|
17
|
-
match.dayPeriod(dateString, {
|
|
18
|
-
width: "narrow",
|
|
19
|
-
context: "formatting",
|
|
20
|
-
})
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
case "aaaaa":
|
|
24
|
-
return match.dayPeriod(dateString, {
|
|
25
|
-
width: "narrow",
|
|
26
|
-
context: "formatting",
|
|
27
|
-
});
|
|
28
|
-
case "aaaa":
|
|
29
|
-
default:
|
|
30
|
-
return (
|
|
31
|
-
match.dayPeriod(dateString, {
|
|
32
|
-
width: "wide",
|
|
33
|
-
context: "formatting",
|
|
34
|
-
}) ||
|
|
35
|
-
match.dayPeriod(dateString, {
|
|
36
|
-
width: "abbreviated",
|
|
37
|
-
context: "formatting",
|
|
38
|
-
}) ||
|
|
39
|
-
match.dayPeriod(dateString, {
|
|
40
|
-
width: "narrow",
|
|
41
|
-
context: "formatting",
|
|
42
|
-
})
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
set(date, _flags, value) {
|
|
48
|
-
date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
|
49
|
-
return date;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
incompatibleTokens = ["b", "B", "H", "k", "t", "T"];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export { AMPMParser };
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { numericPatterns } from '../constants.js';
|
|
2
|
-
import { Parser } from '../Parser.js';
|
|
3
|
-
import { parseNDigits, parseNumericPattern, isLeapYearIndex } from '../utils.js';
|
|
4
|
-
|
|
5
|
-
const DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
6
|
-
const DAYS_IN_MONTH_LEAP_YEAR = [
|
|
7
|
-
31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
|
|
8
|
-
];
|
|
9
|
-
|
|
10
|
-
// Day of the month
|
|
11
|
-
class DateParser extends Parser {
|
|
12
|
-
priority = 90;
|
|
13
|
-
subPriority = 1;
|
|
14
|
-
|
|
15
|
-
parse(dateString, token, match) {
|
|
16
|
-
switch (token) {
|
|
17
|
-
case "d":
|
|
18
|
-
return parseNumericPattern(numericPatterns.date, dateString);
|
|
19
|
-
case "do":
|
|
20
|
-
return match.ordinalNumber(dateString, { unit: "date" });
|
|
21
|
-
default:
|
|
22
|
-
return parseNDigits(token.length, dateString);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
validate(date, value) {
|
|
27
|
-
const year = date.getFullYear();
|
|
28
|
-
const isLeapYear = isLeapYearIndex(year);
|
|
29
|
-
const month = date.getMonth();
|
|
30
|
-
if (isLeapYear) {
|
|
31
|
-
return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];
|
|
32
|
-
} else {
|
|
33
|
-
return value >= 1 && value <= DAYS_IN_MONTH[month];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
set(date, _flags, value) {
|
|
38
|
-
date.setDate(value);
|
|
39
|
-
date.setHours(0, 0, 0, 0);
|
|
40
|
-
return date;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
incompatibleTokens = [
|
|
44
|
-
"Y",
|
|
45
|
-
"R",
|
|
46
|
-
"q",
|
|
47
|
-
"Q",
|
|
48
|
-
"w",
|
|
49
|
-
"I",
|
|
50
|
-
"D",
|
|
51
|
-
"i",
|
|
52
|
-
"e",
|
|
53
|
-
"c",
|
|
54
|
-
"t",
|
|
55
|
-
"T",
|
|
56
|
-
];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export { DateParser };
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { numericPatterns } from '../constants.js';
|
|
2
|
-
import { Parser } from '../Parser.js';
|
|
3
|
-
import { parseNDigits, parseNumericPattern, isLeapYearIndex } from '../utils.js';
|
|
4
|
-
|
|
5
|
-
class DayOfYearParser extends Parser {
|
|
6
|
-
priority = 90;
|
|
7
|
-
|
|
8
|
-
subpriority = 1;
|
|
9
|
-
|
|
10
|
-
parse(dateString, token, match) {
|
|
11
|
-
switch (token) {
|
|
12
|
-
case "D":
|
|
13
|
-
case "DD":
|
|
14
|
-
return parseNumericPattern(numericPatterns.dayOfYear, dateString);
|
|
15
|
-
case "Do":
|
|
16
|
-
return match.ordinalNumber(dateString, { unit: "date" });
|
|
17
|
-
default:
|
|
18
|
-
return parseNDigits(token.length, dateString);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
validate(date, value) {
|
|
23
|
-
const year = date.getFullYear();
|
|
24
|
-
const isLeapYear = isLeapYearIndex(year);
|
|
25
|
-
if (isLeapYear) {
|
|
26
|
-
return value >= 1 && value <= 366;
|
|
27
|
-
} else {
|
|
28
|
-
return value >= 1 && value <= 365;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
set(date, _flags, value) {
|
|
33
|
-
date.setMonth(0, value);
|
|
34
|
-
date.setHours(0, 0, 0, 0);
|
|
35
|
-
return date;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
incompatibleTokens = [
|
|
39
|
-
"Y",
|
|
40
|
-
"R",
|
|
41
|
-
"q",
|
|
42
|
-
"Q",
|
|
43
|
-
"M",
|
|
44
|
-
"L",
|
|
45
|
-
"w",
|
|
46
|
-
"I",
|
|
47
|
-
"d",
|
|
48
|
-
"E",
|
|
49
|
-
"i",
|
|
50
|
-
"e",
|
|
51
|
-
"c",
|
|
52
|
-
"t",
|
|
53
|
-
"T",
|
|
54
|
-
];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export { DayOfYearParser };
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { setDay } from '../../../setDay.js';
|
|
2
|
-
import { Parser } from '../Parser.js';
|
|
3
|
-
|
|
4
|
-
// Day of week
|
|
5
|
-
class DayParser extends Parser {
|
|
6
|
-
priority = 90;
|
|
7
|
-
|
|
8
|
-
parse(dateString, token, match) {
|
|
9
|
-
switch (token) {
|
|
10
|
-
// Tue
|
|
11
|
-
case "E":
|
|
12
|
-
case "EE":
|
|
13
|
-
case "EEE":
|
|
14
|
-
return (
|
|
15
|
-
match.day(dateString, {
|
|
16
|
-
width: "abbreviated",
|
|
17
|
-
context: "formatting",
|
|
18
|
-
}) ||
|
|
19
|
-
match.day(dateString, { width: "short", context: "formatting" }) ||
|
|
20
|
-
match.day(dateString, { width: "narrow", context: "formatting" })
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
// T
|
|
24
|
-
case "EEEEE":
|
|
25
|
-
return match.day(dateString, {
|
|
26
|
-
width: "narrow",
|
|
27
|
-
context: "formatting",
|
|
28
|
-
});
|
|
29
|
-
// Tu
|
|
30
|
-
case "EEEEEE":
|
|
31
|
-
return (
|
|
32
|
-
match.day(dateString, { width: "short", context: "formatting" }) ||
|
|
33
|
-
match.day(dateString, { width: "narrow", context: "formatting" })
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
// Tuesday
|
|
37
|
-
case "EEEE":
|
|
38
|
-
default:
|
|
39
|
-
return (
|
|
40
|
-
match.day(dateString, { width: "wide", context: "formatting" }) ||
|
|
41
|
-
match.day(dateString, {
|
|
42
|
-
width: "abbreviated",
|
|
43
|
-
context: "formatting",
|
|
44
|
-
}) ||
|
|
45
|
-
match.day(dateString, { width: "short", context: "formatting" }) ||
|
|
46
|
-
match.day(dateString, { width: "narrow", context: "formatting" })
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
validate(_date, value) {
|
|
52
|
-
return value >= 0 && value <= 6;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
set(date, _flags, value, options) {
|
|
56
|
-
date = setDay(date, value, options);
|
|
57
|
-
date.setHours(0, 0, 0, 0);
|
|
58
|
-
return date;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
incompatibleTokens = ["D", "i", "e", "c", "t", "T"];
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export { DayParser };
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { dayPeriodEnumToHours } from '../utils.js';
|
|
3
|
-
|
|
4
|
-
// in the morning, in the afternoon, in the evening, at night
|
|
5
|
-
class DayPeriodParser extends Parser {
|
|
6
|
-
priority = 80;
|
|
7
|
-
|
|
8
|
-
parse(dateString, token, match) {
|
|
9
|
-
switch (token) {
|
|
10
|
-
case "B":
|
|
11
|
-
case "BB":
|
|
12
|
-
case "BBB":
|
|
13
|
-
return (
|
|
14
|
-
match.dayPeriod(dateString, {
|
|
15
|
-
width: "abbreviated",
|
|
16
|
-
context: "formatting",
|
|
17
|
-
}) ||
|
|
18
|
-
match.dayPeriod(dateString, {
|
|
19
|
-
width: "narrow",
|
|
20
|
-
context: "formatting",
|
|
21
|
-
})
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
case "BBBBB":
|
|
25
|
-
return match.dayPeriod(dateString, {
|
|
26
|
-
width: "narrow",
|
|
27
|
-
context: "formatting",
|
|
28
|
-
});
|
|
29
|
-
case "BBBB":
|
|
30
|
-
default:
|
|
31
|
-
return (
|
|
32
|
-
match.dayPeriod(dateString, {
|
|
33
|
-
width: "wide",
|
|
34
|
-
context: "formatting",
|
|
35
|
-
}) ||
|
|
36
|
-
match.dayPeriod(dateString, {
|
|
37
|
-
width: "abbreviated",
|
|
38
|
-
context: "formatting",
|
|
39
|
-
}) ||
|
|
40
|
-
match.dayPeriod(dateString, {
|
|
41
|
-
width: "narrow",
|
|
42
|
-
context: "formatting",
|
|
43
|
-
})
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
set(date, _flags, value) {
|
|
49
|
-
date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
|
50
|
-
return date;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
incompatibleTokens = ["a", "b", "t", "T"];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export { DayPeriodParser };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
|
|
3
|
-
class EraParser extends Parser {
|
|
4
|
-
priority = 140;
|
|
5
|
-
|
|
6
|
-
parse(dateString, token, match) {
|
|
7
|
-
switch (token) {
|
|
8
|
-
// AD, BC
|
|
9
|
-
case "G":
|
|
10
|
-
case "GG":
|
|
11
|
-
case "GGG":
|
|
12
|
-
return (
|
|
13
|
-
match.era(dateString, { width: "abbreviated" }) ||
|
|
14
|
-
match.era(dateString, { width: "narrow" })
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
// A, B
|
|
18
|
-
case "GGGGG":
|
|
19
|
-
return match.era(dateString, { width: "narrow" });
|
|
20
|
-
// Anno Domini, Before Christ
|
|
21
|
-
case "GGGG":
|
|
22
|
-
default:
|
|
23
|
-
return (
|
|
24
|
-
match.era(dateString, { width: "wide" }) ||
|
|
25
|
-
match.era(dateString, { width: "abbreviated" }) ||
|
|
26
|
-
match.era(dateString, { width: "narrow" })
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
set(date, flags, value) {
|
|
32
|
-
flags.era = value;
|
|
33
|
-
date.setFullYear(value, 0, 1);
|
|
34
|
-
date.setHours(0, 0, 0, 0);
|
|
35
|
-
return date;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
incompatibleTokens = ["R", "u", "t", "T"];
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export { EraParser };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { parseNDigitsSigned } from '../utils.js';
|
|
3
|
-
|
|
4
|
-
class ExtendedYearParser extends Parser {
|
|
5
|
-
priority = 130;
|
|
6
|
-
|
|
7
|
-
parse(dateString, token) {
|
|
8
|
-
if (token === "u") {
|
|
9
|
-
return parseNDigitsSigned(4, dateString);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return parseNDigitsSigned(token.length, dateString);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
set(date, _flags, value) {
|
|
16
|
-
date.setFullYear(value, 0, 1);
|
|
17
|
-
date.setHours(0, 0, 0, 0);
|
|
18
|
-
return date;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
incompatibleTokens = ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { ExtendedYearParser };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Parser } from '../Parser.js';
|
|
2
|
-
import { mapValue, parseNDigits } from '../utils.js';
|
|
3
|
-
|
|
4
|
-
class FractionOfSecondParser extends Parser {
|
|
5
|
-
priority = 30;
|
|
6
|
-
|
|
7
|
-
parse(dateString, token) {
|
|
8
|
-
const valueCallback = (value) =>
|
|
9
|
-
Math.trunc(value * Math.pow(10, -token.length + 3));
|
|
10
|
-
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
set(date, _flags, value) {
|
|
14
|
-
date.setMilliseconds(value);
|
|
15
|
-
return date;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
incompatibleTokens = ["t", "T"];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { FractionOfSecondParser };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { numericPatterns } from '../constants.js';
|
|
2
|
-
import { Parser } from '../Parser.js';
|
|
3
|
-
import { parseNDigits, parseNumericPattern } from '../utils.js';
|
|
4
|
-
|
|
5
|
-
class Hour0To11Parser extends Parser {
|
|
6
|
-
priority = 70;
|
|
7
|
-
|
|
8
|
-
parse(dateString, token, match) {
|
|
9
|
-
switch (token) {
|
|
10
|
-
case "K":
|
|
11
|
-
return parseNumericPattern(numericPatterns.hour11h, dateString);
|
|
12
|
-
case "Ko":
|
|
13
|
-
return match.ordinalNumber(dateString, { unit: "hour" });
|
|
14
|
-
default:
|
|
15
|
-
return parseNDigits(token.length, dateString);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
validate(_date, value) {
|
|
20
|
-
return value >= 0 && value <= 11;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
set(date, _flags, value) {
|
|
24
|
-
const isPM = date.getHours() >= 12;
|
|
25
|
-
if (isPM && value < 12) {
|
|
26
|
-
date.setHours(value + 12, 0, 0, 0);
|
|
27
|
-
} else {
|
|
28
|
-
date.setHours(value, 0, 0, 0);
|
|
29
|
-
}
|
|
30
|
-
return date;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
incompatibleTokens = ["h", "H", "k", "t", "T"];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export { Hour0To11Parser };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { numericPatterns } from '../constants.js';
|
|
2
|
-
import { Parser } from '../Parser.js';
|
|
3
|
-
import { parseNDigits, parseNumericPattern } from '../utils.js';
|
|
4
|
-
|
|
5
|
-
class Hour0to23Parser extends Parser {
|
|
6
|
-
priority = 70;
|
|
7
|
-
|
|
8
|
-
parse(dateString, token, match) {
|
|
9
|
-
switch (token) {
|
|
10
|
-
case "H":
|
|
11
|
-
return parseNumericPattern(numericPatterns.hour23h, dateString);
|
|
12
|
-
case "Ho":
|
|
13
|
-
return match.ordinalNumber(dateString, { unit: "hour" });
|
|
14
|
-
default:
|
|
15
|
-
return parseNDigits(token.length, dateString);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
validate(_date, value) {
|
|
20
|
-
return value >= 0 && value <= 23;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
set(date, _flags, value) {
|
|
24
|
-
date.setHours(value, 0, 0, 0);
|
|
25
|
-
return date;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
incompatibleTokens = ["a", "b", "h", "K", "k", "t", "T"];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { Hour0to23Parser };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { numericPatterns } from '../constants.js';
|
|
2
|
-
import { Parser } from '../Parser.js';
|
|
3
|
-
import { parseNDigits, parseNumericPattern } from '../utils.js';
|
|
4
|
-
|
|
5
|
-
class Hour1To24Parser extends Parser {
|
|
6
|
-
priority = 70;
|
|
7
|
-
|
|
8
|
-
parse(dateString, token, match) {
|
|
9
|
-
switch (token) {
|
|
10
|
-
case "k":
|
|
11
|
-
return parseNumericPattern(numericPatterns.hour24h, dateString);
|
|
12
|
-
case "ko":
|
|
13
|
-
return match.ordinalNumber(dateString, { unit: "hour" });
|
|
14
|
-
default:
|
|
15
|
-
return parseNDigits(token.length, dateString);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
validate(_date, value) {
|
|
20
|
-
return value >= 1 && value <= 24;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
set(date, _flags, value) {
|
|
24
|
-
const hours = value <= 24 ? value % 24 : value;
|
|
25
|
-
date.setHours(hours, 0, 0, 0);
|
|
26
|
-
return date;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
incompatibleTokens = ["a", "b", "h", "H", "K", "t", "T"];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { Hour1To24Parser };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { numericPatterns } from '../constants.js';
|
|
2
|
-
import { Parser } from '../Parser.js';
|
|
3
|
-
import { parseNDigits, parseNumericPattern } from '../utils.js';
|
|
4
|
-
|
|
5
|
-
class Hour1to12Parser extends Parser {
|
|
6
|
-
priority = 70;
|
|
7
|
-
|
|
8
|
-
parse(dateString, token, match) {
|
|
9
|
-
switch (token) {
|
|
10
|
-
case "h":
|
|
11
|
-
return parseNumericPattern(numericPatterns.hour12h, dateString);
|
|
12
|
-
case "ho":
|
|
13
|
-
return match.ordinalNumber(dateString, { unit: "hour" });
|
|
14
|
-
default:
|
|
15
|
-
return parseNDigits(token.length, dateString);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
validate(_date, value) {
|
|
20
|
-
return value >= 1 && value <= 12;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
set(date, _flags, value) {
|
|
24
|
-
const isPM = date.getHours() >= 12;
|
|
25
|
-
if (isPM && value < 12) {
|
|
26
|
-
date.setHours(value + 12, 0, 0, 0);
|
|
27
|
-
} else if (!isPM && value === 12) {
|
|
28
|
-
date.setHours(0, 0, 0, 0);
|
|
29
|
-
} else {
|
|
30
|
-
date.setHours(value, 0, 0, 0);
|
|
31
|
-
}
|
|
32
|
-
return date;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
incompatibleTokens = ["H", "K", "k", "t", "T"];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export { Hour1to12Parser };
|