@vonage/vivid 5.16.0 → 5.18.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/accordion/definition.cjs +6 -6
- package/accordion/definition.js +1 -1
- package/accordion/index.cjs +1 -1
- package/accordion/index.js +2 -2
- package/accordion-item/definition.cjs +5 -5
- package/accordion-item/definition.js +1 -1
- package/accordion-item/index.cjs +1 -1
- package/accordion-item/index.js +2 -2
- package/action-group/index.cjs +3 -3
- package/action-group/index.js +5 -5
- package/alert/definition.cjs +5 -5
- package/alert/definition.js +1 -1
- package/alert/index.cjs +3 -3
- package/alert/index.js +15 -14
- package/audio-player/definition.cjs +5 -5
- package/audio-player/definition.js +1 -1
- package/audio-player/index.cjs +16 -16
- package/audio-player/index.js +29 -28
- package/avatar/definition.cjs +5 -5
- package/avatar/definition.js +1 -1
- package/avatar/index.cjs +4 -4
- package/avatar/index.js +12 -11
- package/badge/definition.cjs +5 -5
- package/badge/definition.js +1 -1
- package/badge/index.cjs +1 -4
- package/badge/index.js +4 -20
- package/banner/definition.cjs +5 -5
- package/banner/definition.js +1 -1
- package/banner/index.cjs +3 -3
- package/banner/index.js +14 -13
- package/breadcrumb-item/definition.cjs +4 -4
- package/breadcrumb-item/definition.js +1 -1
- package/breadcrumb-item/index.cjs +1 -1
- package/breadcrumb-item/index.js +1 -0
- package/bundled/affix.cjs +1 -1
- package/bundled/affix.js +5 -5
- package/bundled/base-color-picker.cjs +2 -2
- package/bundled/base-color-picker.js +5 -5
- package/bundled/button.cjs +1 -1
- package/bundled/button.js +2 -2
- package/bundled/calendar-picker.template.cjs +2 -2
- package/bundled/calendar-picker.template.js +498 -498
- package/bundled/definition10.cjs +18 -30
- package/bundled/definition10.js +53 -155
- package/bundled/definition11.cjs +10 -19
- package/bundled/definition11.js +25 -74
- package/bundled/definition12.cjs +72 -18
- package/bundled/definition12.js +171 -107
- package/bundled/definition13.cjs +18 -17
- package/bundled/definition13.js +46 -66
- package/bundled/definition14.cjs +5 -10
- package/bundled/definition14.js +9 -27
- package/bundled/definition15.cjs +17 -71
- package/bundled/definition15.js +64 -181
- package/bundled/definition16.cjs +12 -4
- package/bundled/definition16.js +79 -14
- package/bundled/definition17.cjs +19 -13
- package/bundled/definition17.js +118 -69
- package/bundled/definition18.cjs +87 -12
- package/bundled/definition18.js +409 -52
- package/bundled/definition19.cjs +5 -87
- package/bundled/definition19.js +14 -422
- package/bundled/definition2.cjs +3 -14
- package/bundled/definition2.js +16 -49
- package/bundled/definition20.cjs +30 -5
- package/bundled/definition20.js +159 -9
- package/bundled/definition21.cjs +28 -19
- package/bundled/definition21.js +164 -47
- package/bundled/definition22.cjs +4 -24
- package/bundled/definition22.js +18 -88
- package/bundled/definition23.cjs +12 -0
- package/bundled/definition23.js +37 -0
- package/bundled/definition24.cjs +39 -0
- package/bundled/definition24.js +72 -0
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +24 -21
- package/bundled/definition4.cjs +23 -38
- package/bundled/definition4.js +81 -63
- package/bundled/definition5.cjs +2 -2
- package/bundled/definition5.js +5 -5
- package/bundled/definition6.cjs +11 -11
- package/bundled/definition6.js +57 -41
- package/bundled/definition9.cjs +12 -30
- package/bundled/definition9.js +55 -148
- package/bundled/divider.cjs +1 -1
- package/bundled/divider.js +5 -5
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +1 -1
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +1 -0
- package/bundled/mixins.cjs +5 -5
- package/bundled/mixins.js +49 -49
- package/bundled/numberConverter.cjs +12 -0
- package/bundled/numberConverter.js +38 -0
- package/bundled/picker-field.template.cjs +8 -7
- package/bundled/picker-field.template.js +16 -15
- package/bundled/slider.template.cjs +7 -7
- package/bundled/slider.template.js +12 -12
- package/bundled/slottable-request.cjs +1 -1
- package/bundled/slottable-request.js +8 -38
- package/bundled/time-selection-picker.template.cjs +4 -4
- package/bundled/time-selection-picker.template.js +35 -35
- package/bundled/utils.cjs +1 -0
- package/bundled/utils.js +1420 -0
- package/bundled/vivid-element.cjs +1 -1
- package/bundled/vivid-element.js +1 -1
- package/button/definition.cjs +5 -5
- package/button/definition.js +1 -1
- package/button/index.cjs +1 -1
- package/button/index.js +1 -1
- package/calendar/index.cjs +11 -11
- package/calendar/index.js +30 -237
- package/calendar-event/index.cjs +3 -3
- package/calendar-event/index.js +4 -4
- package/card/definition.cjs +5 -5
- package/card/definition.js +1 -1
- package/card/index.cjs +15 -12
- package/card/index.js +17 -13
- package/checkbox/definition.cjs +5 -5
- package/checkbox/definition.js +1 -1
- package/checkbox/index.cjs +1 -1
- package/checkbox/index.js +2 -2
- package/color-picker/definition.cjs +5 -5
- package/color-picker/definition.js +2 -2
- package/color-picker/index.cjs +10 -10
- package/color-picker/index.js +58 -57
- package/combobox/definition.cjs +5 -5
- package/combobox/definition.js +2 -2
- package/combobox/index.cjs +9 -8
- package/combobox/index.js +40 -35
- package/contextual-help/definition.cjs +5 -5
- package/contextual-help/definition.js +2 -2
- package/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +2 -2
- package/country/definition.cjs +5 -5
- package/country/definition.js +1 -1
- package/country/index.cjs +1 -12
- package/country/index.js +4 -1216
- package/country-group/definition.cjs +6 -0
- package/country-group/definition.js +3 -0
- package/country-group/index.cjs +43 -0
- package/country-group/index.js +166 -0
- package/custom-elements.json +1274 -200
- package/data-grid/definition.cjs +9 -9
- package/data-grid/definition.js +2 -2
- package/data-grid/index.cjs +18 -18
- package/data-grid/index.js +260 -262
- package/date-picker/definition.cjs +5 -5
- package/date-picker/definition.js +2 -2
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +13 -13
- package/date-range-picker/definition.cjs +5 -5
- package/date-range-picker/definition.js +2 -2
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +8 -8
- package/date-time-picker/definition.cjs +5 -5
- package/date-time-picker/definition.js +2 -2
- package/date-time-picker/index.cjs +4 -4
- package/date-time-picker/index.js +25 -25
- package/dial-pad/definition.cjs +5 -5
- package/dial-pad/definition.js +2 -2
- package/dial-pad/index.cjs +6 -5
- package/dial-pad/index.js +14 -12
- package/dialog/definition.cjs +5 -5
- package/dialog/definition.js +2 -2
- package/dialog/index.cjs +6 -6
- package/dialog/index.js +17 -16
- package/divider/definition.cjs +1 -1
- package/divider/definition.js +1 -1
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/empty-state/definition.cjs +5 -5
- package/empty-state/definition.js +2 -2
- package/empty-state/index.cjs +2 -2
- package/empty-state/index.js +6 -5
- package/fab/definition.cjs +5 -5
- package/fab/definition.js +2 -2
- package/fab/index.cjs +4 -4
- package/fab/index.js +13 -12
- package/file-picker/definition.cjs +5 -5
- package/file-picker/definition.js +2 -2
- package/file-picker/index.cjs +20 -17
- package/file-picker/index.js +40 -36
- package/flag/definition.cjs +6 -0
- package/flag/definition.js +3 -0
- package/flag/index.cjs +10 -0
- package/flag/index.js +61 -0
- package/header/definition.cjs +1 -1
- package/header/definition.js +1 -1
- package/header/index.cjs +4 -4
- package/header/index.js +5 -5
- package/icon/definition.cjs +1 -0
- package/icon/definition.js +1 -0
- package/icon/index.cjs +1 -1
- package/icon/index.js +1 -0
- package/index.cjs +204 -192
- package/index.js +55 -52
- package/layout/definition.cjs +1 -1
- package/layout/definition.js +1 -1
- package/lib/button/button.d.ts +1 -0
- package/lib/combobox/combobox.d.ts +0 -3
- package/lib/components.d.ts +2 -0
- package/lib/country/countries-data.d.ts +1 -0
- package/lib/country/{country-code-to-flag-icon.d.ts → utils.d.ts} +0 -3
- package/lib/country-group/country-group.d.ts +829 -0
- package/lib/country-group/country-group.template.d.ts +3 -0
- package/lib/country-group/definition.d.ts +3 -0
- package/lib/country-group/index.d.ts +1 -0
- package/lib/country-group/locale.d.ts +3 -0
- package/lib/date-picker/date-picker.d.ts +4 -0
- package/lib/date-range-picker/date-range-picker.d.ts +2 -0
- package/lib/date-time-picker/date-time-picker.d.ts +4 -4
- package/lib/dial-pad/dial-pad.d.ts +6 -2
- package/lib/dialog/dialog.d.ts +0 -1
- package/lib/flag/definition.d.ts +3 -0
- package/lib/flag/flag.d.ts +8 -0
- package/lib/flag/flag.template.d.ts +3 -0
- package/lib/flag/index.d.ts +1 -0
- package/lib/icon/icon.d.ts +1 -2
- package/lib/menu/menu.d.ts +0 -1
- package/lib/option/option.d.ts +0 -1
- package/lib/rich-text-editor/rte/exports.d.ts +1 -0
- package/lib/rich-text-editor/rte/features/alignment.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/character-count.d.ts +21 -0
- package/lib/rich-text-editor/rte/features/font-size-picker.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/internal/basic-text-blocks.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/keyboard-shortcuts.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/text-color-picker.d.ts +1 -1
- package/lib/rich-text-editor/rte/public-interface.d.ts +6 -0
- package/lib/searchable-select/option-tag.d.ts +3 -2
- package/lib/searchable-select/searchable-select.d.ts +3 -1
- package/lib/table/definition.d.ts +2 -1
- package/lib/table/table-header-cell.d.ts +3 -0
- package/lib/table/table-sorting-button.d.ts +415 -0
- package/lib/table/table-sorting-button.template.d.ts +3 -0
- package/lib/tag-name-map.d.ts +2 -1
- package/lib/time-picker/time-picker.d.ts +2 -0
- package/locales/de-DE.cjs +5 -178
- package/locales/de-DE.js +3 -179
- package/locales/en-GB.cjs +5 -9
- package/locales/en-GB.js +3 -10
- package/locales/en-US.cjs +269 -2
- package/locales/en-US.js +266 -1
- package/locales/ja-JP.cjs +5 -171
- package/locales/ja-JP.js +3 -172
- package/locales/zh-CN.cjs +5 -172
- package/locales/zh-CN.js +3 -173
- package/menu/definition.cjs +5 -5
- package/menu/definition.js +1 -1
- package/menu/index.cjs +1 -1
- package/menu/index.js +2 -2
- package/menu-item/definition.cjs +6 -6
- package/menu-item/definition.js +1 -1
- package/menu-item/index.cjs +1 -1
- package/menu-item/index.js +2 -2
- package/nav/definition.cjs +1 -1
- package/nav/definition.js +1 -1
- package/nav-disclosure/definition.cjs +5 -5
- package/nav-disclosure/definition.js +2 -2
- package/nav-disclosure/index.cjs +4 -4
- package/nav-disclosure/index.js +13 -12
- package/nav-item/definition.cjs +5 -5
- package/nav-item/definition.js +2 -2
- package/nav-item/index.cjs +2 -2
- package/nav-item/index.js +12 -11
- package/note/definition.cjs +5 -5
- package/note/definition.js +2 -2
- package/note/index.cjs +3 -3
- package/note/index.js +11 -10
- package/number-field/definition.cjs +5 -5
- package/number-field/definition.js +2 -2
- package/number-field/index.cjs +4 -4
- package/number-field/index.js +29 -28
- package/option/definition.cjs +5 -5
- package/option/definition.js +2 -2
- package/option/index.cjs +1 -1
- package/option/index.js +2 -2
- package/package.json +9 -10
- package/pagination/definition.cjs +5 -5
- package/pagination/definition.js +2 -2
- package/pagination/index.cjs +3 -3
- package/pagination/index.js +16 -16
- package/popover/definition.cjs +5 -5
- package/popover/definition.js +2 -2
- package/popover/index.cjs +7 -7
- package/popover/index.js +12 -11
- package/popup/definition.cjs +4 -4
- package/popup/definition.js +1 -1
- package/popup/index.cjs +1 -1
- package/popup/index.js +1 -1
- package/progress/definition.cjs +1 -1
- package/progress/definition.js +1 -1
- package/progress/index.cjs +2 -2
- package/progress/index.js +5 -5
- package/radio/definition.cjs +1 -1
- package/radio/definition.js +1 -1
- package/radio/index.cjs +1 -1
- package/radio/index.js +1 -1
- package/radio-group/definition.cjs +5 -5
- package/radio-group/definition.js +2 -2
- package/radio-group/index.cjs +4 -4
- package/radio-group/index.js +11 -11
- package/range-slider/definition.cjs +5 -5
- package/range-slider/definition.js +2 -2
- package/range-slider/index.cjs +4 -4
- package/range-slider/index.js +39 -36
- package/rich-text-editor/definition.cjs +32 -31
- package/rich-text-editor/definition.js +3 -3
- package/rich-text-editor/index.cjs +13 -13
- package/rich-text-editor/index.js +1887 -1830
- package/rich-text-view/definition.cjs +1 -1
- package/rich-text-view/definition.js +1 -1
- package/rich-text-view/index.cjs +1 -1
- package/rich-text-view/index.js +8 -8
- package/searchable-select/definition.cjs +4 -4
- package/searchable-select/definition.js +2 -2
- package/searchable-select/index.cjs +15 -13
- package/searchable-select/index.js +75 -72
- package/select/definition.cjs +5 -5
- package/select/definition.js +2 -2
- package/select/index.cjs +1 -1
- package/select/index.js +2 -2
- package/selectable-box/definition.cjs +5 -5
- package/selectable-box/definition.js +2 -2
- package/selectable-box/index.cjs +7 -7
- package/selectable-box/index.js +12 -12
- package/shared/foundation/test-utilities/fixture.d.ts +1 -1
- package/shared/icon/utils.d.ts +1 -0
- package/shared/localization/Locale.d.ts +2 -0
- package/shared/patterns/linkable.d.ts +1 -1
- package/shared/picker-field/mixins/calendar-picker.d.ts +1 -0
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +1 -0
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +1 -0
- package/shared/picker-field/mixins/single-date-picker.d.ts +1 -0
- package/shared/picker-field/mixins/single-value-picker.d.ts +1 -0
- package/shared/picker-field/mixins/time-selection-picker.d.ts +1 -0
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +2 -0
- package/shared/picker-field/picker-field.d.ts +2 -0
- package/side-drawer/definition.cjs +1 -1
- package/side-drawer/definition.js +1 -1
- package/simple-color-picker/definition.cjs +5 -5
- package/simple-color-picker/definition.js +2 -2
- package/simple-color-picker/index.cjs +3 -3
- package/simple-color-picker/index.js +15 -14
- package/slider/definition.cjs +5 -5
- package/slider/definition.js +1 -1
- package/slider/index.cjs +1 -1
- package/slider/index.js +1 -1
- package/split-button/definition.cjs +5 -5
- package/split-button/definition.js +2 -2
- package/split-button/index.cjs +6 -6
- package/split-button/index.js +17 -16
- package/status/definition.cjs +5 -5
- package/status/definition.js +2 -2
- package/status/index.cjs +2 -2
- package/status/index.js +11 -10
- package/switch/definition.cjs +5 -5
- package/switch/definition.js +2 -2
- package/switch/index.cjs +4 -4
- package/switch/index.js +11 -10
- package/tab/definition.cjs +5 -5
- package/tab/definition.js +2 -2
- package/tab/index.cjs +1 -1
- package/tab/index.js +2 -2
- package/tab-panel/definition.cjs +1 -1
- package/tab-panel/definition.js +1 -1
- package/tab-panel/index.cjs +1 -1
- package/tab-panel/index.js +1 -1
- package/table/definition.cjs +4 -1
- package/table/definition.js +3 -2
- package/table/index.cjs +19 -10
- package/table/index.js +70 -21
- package/tabs/definition.cjs +6 -6
- package/tabs/definition.js +2 -2
- package/tabs/index.cjs +2 -2
- package/tabs/index.js +5 -5
- package/tag/definition.cjs +5 -5
- package/tag/definition.js +2 -2
- package/tag/index.cjs +8 -8
- package/tag/index.js +14 -13
- package/tag-group/definition.cjs +1 -1
- package/tag-group/definition.js +1 -1
- package/tag-group/index.cjs +3 -3
- package/tag-group/index.js +5 -5
- package/text-area/definition.cjs +5 -5
- package/text-area/definition.js +2 -2
- package/text-area/index.cjs +2 -2
- package/text-area/index.js +13 -13
- package/text-field/definition.cjs +5 -5
- package/text-field/definition.js +2 -2
- package/text-field/index.cjs +1 -1
- package/text-field/index.js +2 -2
- package/time-picker/definition.cjs +4 -4
- package/time-picker/definition.js +2 -2
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +2 -2
- package/toggletip/definition.cjs +5 -5
- package/toggletip/definition.js +2 -2
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +2 -2
- package/tooltip/definition.cjs +5 -5
- package/tooltip/definition.js +2 -2
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +2 -2
- package/tree-item/definition.cjs +5 -5
- package/tree-item/definition.js +2 -2
- package/tree-item/index.cjs +1 -1
- package/tree-item/index.js +2 -2
- package/tree-view/definition.cjs +5 -5
- package/tree-view/definition.js +2 -2
- package/tree-view/index.cjs +3 -3
- package/tree-view/index.js +18 -18
- package/unbundled/button.cjs +2 -2
- package/unbundled/button.js +2 -2
- package/unbundled/calendar-picker.template.cjs +4347 -9
- package/unbundled/calendar-picker.template.js +4345 -7
- package/unbundled/chunk.cjs +0 -22
- package/unbundled/definition11.cjs +6 -0
- package/unbundled/definition11.js +6 -0
- package/unbundled/definition13.cjs +1 -8
- package/unbundled/definition13.js +1 -8
- package/unbundled/definition14.cjs +3 -2
- package/unbundled/definition14.js +3 -2
- package/unbundled/definition2.cjs +5 -75
- package/unbundled/definition2.js +1 -71
- package/unbundled/definition21.cjs +1 -2
- package/unbundled/definition21.js +1 -2
- package/unbundled/definition22.cjs +7 -2
- package/unbundled/definition22.js +7 -2
- package/unbundled/definition24.cjs +98 -979
- package/unbundled/definition24.js +93 -974
- package/unbundled/definition25.cjs +37 -322
- package/unbundled/definition25.js +33 -318
- package/unbundled/definition26.cjs +317 -91
- package/unbundled/definition26.js +313 -87
- package/unbundled/definition27.cjs +94 -192
- package/unbundled/definition27.js +91 -183
- package/unbundled/definition28.cjs +388 -395
- package/unbundled/definition28.js +388 -395
- package/unbundled/definition29.cjs +189 -110
- package/unbundled/definition29.js +180 -107
- package/unbundled/definition30.cjs +520 -36
- package/unbundled/definition30.js +519 -35
- package/unbundled/definition31.cjs +2 -1189
- package/unbundled/definition31.js +1 -1188
- package/unbundled/definition32.cjs +207 -1835
- package/unbundled/definition32.js +203 -1807
- package/unbundled/definition33.cjs +85 -228
- package/unbundled/definition33.js +82 -165
- package/unbundled/definition34.cjs +1887 -25
- package/unbundled/definition34.js +1857 -24
- package/unbundled/definition35.cjs +315 -121
- package/unbundled/definition35.js +236 -114
- package/unbundled/definition36.cjs +25 -405
- package/unbundled/definition36.js +22 -397
- package/unbundled/definition37.cjs +49 -140
- package/unbundled/definition37.js +46 -137
- package/unbundled/definition38.cjs +346 -329
- package/unbundled/definition38.js +343 -326
- package/unbundled/definition39.cjs +183 -234
- package/unbundled/definition39.js +181 -232
- package/unbundled/definition40.cjs +377 -47
- package/unbundled/definition40.js +372 -42
- package/unbundled/definition41.cjs +256 -57
- package/unbundled/definition41.js +255 -56
- package/unbundled/definition42.cjs +45 -421
- package/unbundled/definition42.js +41 -417
- package/unbundled/definition43.cjs +63 -49
- package/unbundled/definition43.js +61 -47
- package/unbundled/definition44.cjs +438 -30
- package/unbundled/definition44.js +434 -25
- package/unbundled/definition45.cjs +46 -84
- package/unbundled/definition45.js +43 -81
- package/unbundled/definition46.cjs +29 -54
- package/unbundled/definition46.js +24 -50
- package/unbundled/definition47.cjs +93 -21
- package/unbundled/definition47.js +91 -16
- package/unbundled/definition48.cjs +49 -33
- package/unbundled/definition48.js +46 -30
- package/unbundled/definition49.cjs +22 -347
- package/unbundled/definition49.js +16 -344
- package/unbundled/definition50.cjs +34 -211
- package/unbundled/definition50.js +30 -207
- package/unbundled/definition51.cjs +282 -242
- package/unbundled/definition51.js +275 -235
- package/unbundled/definition52.cjs +211 -51
- package/unbundled/definition52.js +209 -48
- package/unbundled/definition53.cjs +275 -131
- package/unbundled/definition53.js +272 -127
- package/unbundled/definition54.cjs +50 -261
- package/unbundled/definition54.js +48 -260
- package/unbundled/definition55.cjs +126 -443
- package/unbundled/definition55.js +123 -441
- package/unbundled/definition56.cjs +238 -12669
- package/unbundled/definition56.js +232 -12506
- package/unbundled/definition57.cjs +408 -729
- package/unbundled/definition57.js +406 -727
- package/unbundled/definition58.cjs +3619 -106
- package/unbundled/definition58.js +3449 -99
- package/unbundled/definition59.cjs +625 -868
- package/unbundled/definition59.js +620 -863
- package/unbundled/definition60.cjs +106 -108
- package/unbundled/definition60.js +102 -104
- package/unbundled/definition61.cjs +1040 -71
- package/unbundled/definition61.js +1035 -65
- package/unbundled/definition62.cjs +105 -169
- package/unbundled/definition62.js +101 -165
- package/unbundled/definition63.cjs +70 -113
- package/unbundled/definition63.js +65 -109
- package/unbundled/definition64.cjs +181 -53
- package/unbundled/definition64.js +178 -50
- package/unbundled/definition65.cjs +109 -76
- package/unbundled/definition65.js +109 -75
- package/unbundled/definition66.cjs +58 -21
- package/unbundled/definition66.js +55 -15
- package/unbundled/definition67.cjs +81 -74
- package/unbundled/definition67.js +79 -73
- package/unbundled/definition68.cjs +19 -344
- package/unbundled/definition68.js +14 -335
- package/unbundled/definition69.cjs +88 -26
- package/unbundled/definition69.js +85 -22
- package/unbundled/definition7.cjs +18 -3
- package/unbundled/definition7.js +18 -3
- package/unbundled/definition70.cjs +330 -111
- package/unbundled/definition70.js +320 -108
- package/unbundled/definition71.cjs +26 -271
- package/unbundled/definition71.js +21 -267
- package/unbundled/definition72.cjs +134 -28
- package/unbundled/definition72.js +125 -26
- package/unbundled/definition73.cjs +245 -113
- package/unbundled/definition73.js +242 -104
- package/unbundled/definition74.cjs +28 -212
- package/unbundled/definition74.js +26 -202
- package/unbundled/definition75.cjs +120 -52190
- package/unbundled/definition75.js +112 -52188
- package/unbundled/definition76.cjs +232 -0
- package/unbundled/definition76.js +213 -0
- package/unbundled/definition77.cjs +533 -0
- package/unbundled/definition77.js +513 -0
- package/unbundled/listbox.cjs +1 -1
- package/unbundled/listbox.js +1 -1
- package/unbundled/localized.cjs +2 -2
- package/unbundled/localized.js +1 -1
- package/unbundled/numberConverter.cjs +91 -0
- package/unbundled/numberConverter.js +74 -0
- package/unbundled/picker-field.template.cjs +3 -1
- package/unbundled/picker-field.template.js +3 -1
- package/unbundled/slottable-request.cjs +2 -3168
- package/unbundled/slottable-request.js +3 -3097
- package/unbundled/time-selection-picker.template.cjs +1 -1
- package/unbundled/time-selection-picker.template.js +1 -1
- package/unbundled/utils.cjs +1439 -0
- package/unbundled/utils.js +1428 -0
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/video-player/definition.cjs +1 -1
- package/video-player/definition.js +1 -1
- package/video-player/index.cjs +3 -3
- package/video-player/index.js +9 -9
- package/vivid.api.json +860 -409
- package/unbundled/chunk.js +0 -33
- package/unbundled/en-US.cjs +0 -447
- package/unbundled/en-US.js +0 -443
- /package/{lib/icon/icon.placeholder.d.ts → shared/icon/icon-placeholder.d.ts} +0 -0
|
@@ -4,9 +4,242 @@ import { i as Button } from "./definition7.js";
|
|
|
4
4
|
import { t as Divider } from "./divider.js";
|
|
5
5
|
import { Updates, attr, html, observable, repeat, volatile, when } from "@microsoft/fast-element";
|
|
6
6
|
import { classNames } from "@microsoft/fast-web-utilities";
|
|
7
|
-
import { addDays
|
|
7
|
+
import { addDays } from "date-fns";
|
|
8
8
|
//#region src/shared/picker-field/mixins/calendar-picker.scss?inline
|
|
9
|
-
var calendar_picker_default = ".segments{gap:24px}@media (width>=648px){.segments{display:inline-flex}}.segment{flex-direction:column;gap:12px;display:flex}.segment .header{align-items:center;padding-block:8px;display:flex}.segment .title{flex-grow:1;justify-content:center;display:flex}.segment .title-action{block-size:24px;font:var(--vvd-typography-base-extended);border-radius:8px;padding-inline:8px}.calendar{flex-direction:column;gap:4px;margin-top:8px;display:flex}.calendar .calendar-separator{margin-inline:10px}.calendar .calendar-weekdays{justify-content:center;display:flex}.calendar .calendar-weekday{block-size:16px;font:var(--vvd-typography-base-condensed);justify-content:center;align-items:center;inline-size:40px;display:inline-flex}.calendar .calendar-week{justify-content:center;display:flex}.calendar .calendar-day{aspect-ratio:1;block-size:28px;font:var(--vvd-typography-base);border-radius:50%;justify-content:center;align-items:center;margin-inline:6px;display:inline-flex}.calendar .calendar-day.start,.calendar .calendar-day.end{border:2px solid var(--vvd-color-cta-50);background-color:var(--vvd-color-cta-200)}.calendar:focus-visible .calendar .calendar-day.start,.calendar:focus-visible .calendar .calendar-day.end{border-width:3px}.calendar .calendar-day:before,.calendar .calendar-day:after{z-index:-1;width:20px;height:28px;display:block;position:absolute}.calendar .calendar-day:before{right:50%}.calendar .calendar-day:after{left:50%}.calendar .calendar-day.range:before,.calendar .calendar-day.range:after{background-color:var(--vvd-color-cta-50)}.calendar .calendar-day.range:not(.start):before,.calendar .calendar-day.range:not(.end):after{content:\"\"}.calendar .calendar-day.outside-month,.calendar .calendar-day:disabled{color:var(--vvd-color-neutral-400)}.months-separator{margin-inline:-12px}.month-grid{flex-direction:column;gap:34px;display:flex}.month-grid .months-row{justify-content:center;gap:29px;display:flex}.month-grid .month{aspect-ratio:1;block-size:48px;font:var(--vvd-typography-base-extended);text-transform:uppercase;border-radius:50%;justify-content:center;align-items:center;display:inline-flex}.month-grid .month:disabled{color:var(--vvd-color-neutral-400)}.button{--_connotation-color-primary:var(--vvd-date-picker-accent-primary,var(--vvd-color-canvas-text));--_connotation-color-firm:var(--vvd-date-picker-accent-firm,var(--vvd-color-canvas-text));--_connotation-color-faint:var(--vvd-date-picker-accent-faint,var(--vvd-color-neutral-50));--_connotation-color-soft:var(--vvd-date-picker-accent-soft,var(--vvd-color-neutral-100));--_connotation-color-dim:var(--vvd-date-picker-accent-dim,var(--vvd-color-neutral-200));--_connotation-color-pale:var(--vvd-date-picker-accent-pale,var(--vvd-color-neutral-300));--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}@media (hover:hover){.button:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:var(--_connotation-color-faint);--_appearance-color-outline:transparent}}.button.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:var(--_connotation-color-faint);--_appearance-color-outline:transparent}.button:active:where(:not(.disabled,:disabled)),.button.active:where(:not(.disabled,:disabled)),.button.selected:where(:not(.disabled,:disabled)){--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:var(--_connotation-color-soft);--_appearance-color-outline:transparent}@media (hover:hover){.button.selected:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:var(--_connotation-color-dim);--_appearance-color-outline:transparent}}.button.selected.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:var(--_connotation-color-dim);--_appearance-color-outline:transparent}.button.selected:disabled,.button.selected.disabled{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:var(--vvd-color-neutral-200);--_appearance-color-outline:transparent}.button{background-color:var(--_appearance-color-fill);color:var(--_appearance-color-text);cursor:pointer;border:none;padding:0;position:relative}.button:disabled{cursor:not-allowed}.button:focus
|
|
9
|
+
var calendar_picker_default = ".segments{gap:24px}@media (width>=648px){.segments{display:inline-flex}}.segment{flex-direction:column;gap:12px;display:flex}.segment .header{align-items:center;padding-block:8px;display:flex}.segment .title{flex-grow:1;justify-content:center;display:flex}.segment .title-action{block-size:24px;font:var(--vvd-typography-base-extended);border-radius:8px;padding-inline:8px}.calendar{flex-direction:column;gap:4px;margin-top:8px;display:flex}.calendar .calendar-separator{margin-inline:10px}.calendar .calendar-weekdays{justify-content:center;display:flex}.calendar .calendar-weekday{block-size:16px;font:var(--vvd-typography-base-condensed);justify-content:center;align-items:center;inline-size:40px;display:inline-flex}.calendar .calendar-week{justify-content:center;display:flex}.calendar .calendar-day{aspect-ratio:1;block-size:28px;font:var(--vvd-typography-base);border-radius:50%;justify-content:center;align-items:center;margin-inline:6px;display:inline-flex}.calendar .calendar-day.start,.calendar .calendar-day.end{border:2px solid var(--vvd-color-cta-50);background-color:var(--vvd-color-cta-200)}.calendar:focus-visible .calendar .calendar-day.start,.calendar:focus-visible .calendar .calendar-day.end{border-width:3px}.calendar .calendar-day:before,.calendar .calendar-day:after{z-index:-1;width:20px;height:28px;display:block;position:absolute}.calendar .calendar-day:before{right:50%}.calendar .calendar-day:after{left:50%}.calendar .calendar-day.range:before,.calendar .calendar-day.range:after{background-color:var(--vvd-color-cta-50)}.calendar .calendar-day.range:not(.start):before,.calendar .calendar-day.range:not(.end):after{content:\"\"}.calendar .calendar-day.outside-month,.calendar .calendar-day:disabled{color:var(--vvd-color-neutral-400)}.months-separator{margin-inline:-12px}.month-grid{flex-direction:column;gap:34px;display:flex}.month-grid .months-row{justify-content:center;gap:29px;display:flex}.month-grid .month{aspect-ratio:1;block-size:48px;font:var(--vvd-typography-base-extended);text-transform:uppercase;border-radius:50%;justify-content:center;align-items:center;display:inline-flex}.month-grid .month:disabled{color:var(--vvd-color-neutral-400)}.button{--_connotation-color-primary:var(--vvd-date-picker-accent-primary,var(--vvd-color-canvas-text));--_connotation-color-firm:var(--vvd-date-picker-accent-firm,var(--vvd-color-canvas-text));--_connotation-color-faint:var(--vvd-date-picker-accent-faint,var(--vvd-color-neutral-50));--_connotation-color-soft:var(--vvd-date-picker-accent-soft,var(--vvd-color-neutral-100));--_connotation-color-dim:var(--vvd-date-picker-accent-dim,var(--vvd-color-neutral-200));--_connotation-color-pale:var(--vvd-date-picker-accent-pale,var(--vvd-color-neutral-300));--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}@media (hover:hover){.button:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:var(--_connotation-color-faint);--_appearance-color-outline:transparent}}.button.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:var(--_connotation-color-faint);--_appearance-color-outline:transparent}.button:active:where(:not(.disabled,:disabled)),.button.active:where(:not(.disabled,:disabled)),.button.selected:where(:not(.disabled,:disabled)){--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:var(--_connotation-color-soft);--_appearance-color-outline:transparent}@media (hover:hover){.button.selected:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:var(--_connotation-color-dim);--_appearance-color-outline:transparent}}.button.selected.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:var(--_connotation-color-dim);--_appearance-color-outline:transparent}.button.selected:disabled,.button.selected.disabled{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:var(--vvd-color-neutral-200);--_appearance-color-outline:transparent}.button{background-color:var(--_appearance-color-fill);color:var(--_appearance-color-text);cursor:pointer;border:none;padding:0;position:relative}.button:disabled{cursor:not-allowed}.button:focus-visible{--focus-stroke-gap-color:transparent;color:var(--vvd-color-canvas-text);box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}.button:focus-visible.start,.button:focus-visible.end{border-width:3px}.button.current{border:1px solid var(--vvd-color-neutral-200)}.button.selected{border:1px solid var(--vvd-color-neutral-900)}";
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/addLeadingZeros.js
|
|
12
|
+
function addLeadingZeros(number, targetLength) {
|
|
13
|
+
return (number < 0 ? "-" : "") + Math.abs(number).toString().padStart(targetLength, "0");
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/constants.js
|
|
17
|
+
/**
|
|
18
|
+
* @constant
|
|
19
|
+
* @name daysInYear
|
|
20
|
+
* @summary Days in 1 year.
|
|
21
|
+
*
|
|
22
|
+
* @description
|
|
23
|
+
* How many days in a year.
|
|
24
|
+
*
|
|
25
|
+
* One years equals 365.2425 days according to the formula:
|
|
26
|
+
*
|
|
27
|
+
* > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400.
|
|
28
|
+
* > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days
|
|
29
|
+
*/
|
|
30
|
+
var daysInYear = 365.2425;
|
|
31
|
+
Math.pow(10, 8) * 24 * 60 * 60 * 1e3;
|
|
32
|
+
/**
|
|
33
|
+
* @constant
|
|
34
|
+
* @name millisecondsInWeek
|
|
35
|
+
* @summary Milliseconds in 1 week.
|
|
36
|
+
*/
|
|
37
|
+
var millisecondsInWeek = 6048e5;
|
|
38
|
+
/**
|
|
39
|
+
* @constant
|
|
40
|
+
* @name millisecondsInDay
|
|
41
|
+
* @summary Milliseconds in 1 day.
|
|
42
|
+
*/
|
|
43
|
+
var millisecondsInDay = 864e5;
|
|
44
|
+
/**
|
|
45
|
+
* @constant
|
|
46
|
+
* @name millisecondsInMinute
|
|
47
|
+
* @summary Milliseconds in 1 minute
|
|
48
|
+
*/
|
|
49
|
+
var millisecondsInMinute = 6e4;
|
|
50
|
+
/**
|
|
51
|
+
* @constant
|
|
52
|
+
* @name millisecondsInHour
|
|
53
|
+
* @summary Milliseconds in 1 hour
|
|
54
|
+
*/
|
|
55
|
+
var millisecondsInHour = 36e5;
|
|
56
|
+
/**
|
|
57
|
+
* @constant
|
|
58
|
+
* @name millisecondsInSecond
|
|
59
|
+
* @summary Milliseconds in 1 second
|
|
60
|
+
*/
|
|
61
|
+
var millisecondsInSecond = 1e3;
|
|
62
|
+
/**
|
|
63
|
+
* @constant
|
|
64
|
+
* @name secondsInDay
|
|
65
|
+
* @summary Seconds in 1 day.
|
|
66
|
+
*/
|
|
67
|
+
var secondsInDay = 3600 * 24;
|
|
68
|
+
secondsInDay * 7;
|
|
69
|
+
secondsInDay * daysInYear / 12 * 3;
|
|
70
|
+
/**
|
|
71
|
+
* @constant
|
|
72
|
+
* @name constructFromSymbol
|
|
73
|
+
* @summary Symbol enabling Date extensions to inherit properties from the reference date.
|
|
74
|
+
*
|
|
75
|
+
* The symbol is used to enable the `constructFrom` function to construct a date
|
|
76
|
+
* using a reference date and a value. It allows to transfer extra properties
|
|
77
|
+
* from the reference date to the new date. It's useful for extensions like
|
|
78
|
+
* [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as
|
|
79
|
+
* a constructor argument.
|
|
80
|
+
*/
|
|
81
|
+
var constructFromSymbol = Symbol.for("constructDateFrom");
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/constructFrom.js
|
|
84
|
+
/**
|
|
85
|
+
* @name constructFrom
|
|
86
|
+
* @category Generic Helpers
|
|
87
|
+
* @summary Constructs a date using the reference date and the value
|
|
88
|
+
*
|
|
89
|
+
* @description
|
|
90
|
+
* The function constructs a new date using the constructor from the reference
|
|
91
|
+
* date and the given value. It helps to build generic functions that accept
|
|
92
|
+
* date extensions.
|
|
93
|
+
*
|
|
94
|
+
* It defaults to `Date` if the passed reference date is a number or a string.
|
|
95
|
+
*
|
|
96
|
+
* Starting from v3.7.0, it allows to construct a date using `[Symbol.for("constructDateFrom")]`
|
|
97
|
+
* enabling to transfer extra properties from the reference date to the new date.
|
|
98
|
+
* It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
|
|
99
|
+
* that accept a time zone as a constructor argument.
|
|
100
|
+
*
|
|
101
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
102
|
+
*
|
|
103
|
+
* @param date - The reference date to take constructor from
|
|
104
|
+
* @param value - The value to create the date
|
|
105
|
+
*
|
|
106
|
+
* @returns Date initialized using the given date and value
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* import { constructFrom } from "./constructFrom/date-fns";
|
|
110
|
+
*
|
|
111
|
+
* // A function that clones a date preserving the original type
|
|
112
|
+
* function cloneDate<DateType extends Date>(date: DateType): DateType {
|
|
113
|
+
* return constructFrom(
|
|
114
|
+
* date, // Use constructor from the given date
|
|
115
|
+
* date.getTime() // Use the date value to create a new date
|
|
116
|
+
* );
|
|
117
|
+
* }
|
|
118
|
+
*/
|
|
119
|
+
function constructFrom(date, value) {
|
|
120
|
+
if (typeof date === "function") return date(value);
|
|
121
|
+
if (date && typeof date === "object" && constructFromSymbol in date) return date[constructFromSymbol](value);
|
|
122
|
+
if (date instanceof Date) return new date.constructor(value);
|
|
123
|
+
return new Date(value);
|
|
124
|
+
}
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/toDate.js
|
|
127
|
+
/**
|
|
128
|
+
* @name toDate
|
|
129
|
+
* @category Common Helpers
|
|
130
|
+
* @summary Convert the given argument to an instance of Date.
|
|
131
|
+
*
|
|
132
|
+
* @description
|
|
133
|
+
* Convert the given argument to an instance of Date.
|
|
134
|
+
*
|
|
135
|
+
* If the argument is an instance of Date, the function returns its clone.
|
|
136
|
+
*
|
|
137
|
+
* If the argument is a number, it is treated as a timestamp.
|
|
138
|
+
*
|
|
139
|
+
* If the argument is none of the above, the function returns Invalid Date.
|
|
140
|
+
*
|
|
141
|
+
* Starting from v3.7.0, it clones a date using `[Symbol.for("constructDateFrom")]`
|
|
142
|
+
* enabling to transfer extra properties from the reference date to the new date.
|
|
143
|
+
* It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
|
|
144
|
+
* that accept a time zone as a constructor argument.
|
|
145
|
+
*
|
|
146
|
+
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
|
|
147
|
+
*
|
|
148
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
149
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
150
|
+
*
|
|
151
|
+
* @param argument - The value to convert
|
|
152
|
+
*
|
|
153
|
+
* @returns The parsed date in the local time zone
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* // Clone the date:
|
|
157
|
+
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
|
|
158
|
+
* //=> Tue Feb 11 2014 11:30:30
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* // Convert the timestamp to date:
|
|
162
|
+
* const result = toDate(1392098430000)
|
|
163
|
+
* //=> Tue Feb 11 2014 11:30:30
|
|
164
|
+
*/
|
|
165
|
+
function toDate(argument, context) {
|
|
166
|
+
return constructFrom(context || argument, argument);
|
|
167
|
+
}
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/formatISO.js
|
|
170
|
+
/**
|
|
171
|
+
* The {@link formatISO} function options.
|
|
172
|
+
*/
|
|
173
|
+
/**
|
|
174
|
+
* @name formatISO
|
|
175
|
+
* @category Common Helpers
|
|
176
|
+
* @summary Format the date according to the ISO 8601 standard (https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003169814.htm).
|
|
177
|
+
*
|
|
178
|
+
* @description
|
|
179
|
+
* Return the formatted date string in ISO 8601 format. Options may be passed to control the parts and notations of the date.
|
|
180
|
+
*
|
|
181
|
+
* @param date - The original date
|
|
182
|
+
* @param options - An object with options.
|
|
183
|
+
*
|
|
184
|
+
* @returns The formatted date string (in local time zone)
|
|
185
|
+
*
|
|
186
|
+
* @throws `date` must not be Invalid Date
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* // Represent 18 September 2019 in ISO 8601 format (local time zone is UTC):
|
|
190
|
+
* const result = formatISO(new Date(2019, 8, 18, 19, 0, 52))
|
|
191
|
+
* //=> '2019-09-18T19:00:52Z'
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* // Represent 18 September 2019 in ISO 8601, short format (local time zone is UTC):
|
|
195
|
+
* const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { format: 'basic' })
|
|
196
|
+
* //=> '20190918T190052'
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* // Represent 18 September 2019 in ISO 8601 format, date only:
|
|
200
|
+
* const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'date' })
|
|
201
|
+
* //=> '2019-09-18'
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* // Represent 18 September 2019 in ISO 8601 format, time only (local time zone is UTC):
|
|
205
|
+
* const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'time' })
|
|
206
|
+
* //=> '19:00:52Z'
|
|
207
|
+
*/
|
|
208
|
+
function formatISO(date, options) {
|
|
209
|
+
const date_ = toDate(date, options?.in);
|
|
210
|
+
if (isNaN(+date_)) throw new RangeError("Invalid time value");
|
|
211
|
+
const format = options?.format ?? "extended";
|
|
212
|
+
const representation = options?.representation ?? "complete";
|
|
213
|
+
let result = "";
|
|
214
|
+
let tzOffset = "";
|
|
215
|
+
const dateDelimiter = format === "extended" ? "-" : "";
|
|
216
|
+
const timeDelimiter = format === "extended" ? ":" : "";
|
|
217
|
+
if (representation !== "time") {
|
|
218
|
+
const day = addLeadingZeros(date_.getDate(), 2);
|
|
219
|
+
const month = addLeadingZeros(date_.getMonth() + 1, 2);
|
|
220
|
+
result = `${addLeadingZeros(date_.getFullYear(), 4)}${dateDelimiter}${month}${dateDelimiter}${day}`;
|
|
221
|
+
}
|
|
222
|
+
if (representation !== "date") {
|
|
223
|
+
const offset = date_.getTimezoneOffset();
|
|
224
|
+
if (offset !== 0) {
|
|
225
|
+
const absoluteOffset = Math.abs(offset);
|
|
226
|
+
const hourOffset = addLeadingZeros(Math.trunc(absoluteOffset / 60), 2);
|
|
227
|
+
const minuteOffset = addLeadingZeros(absoluteOffset % 60, 2);
|
|
228
|
+
tzOffset = `${offset < 0 ? "+" : "-"}${hourOffset}:${minuteOffset}`;
|
|
229
|
+
} else tzOffset = "Z";
|
|
230
|
+
const hour = addLeadingZeros(date_.getHours(), 2);
|
|
231
|
+
const minute = addLeadingZeros(date_.getMinutes(), 2);
|
|
232
|
+
const second = addLeadingZeros(date_.getSeconds(), 2);
|
|
233
|
+
const separator = result === "" ? "" : "T";
|
|
234
|
+
const time = [
|
|
235
|
+
hour,
|
|
236
|
+
minute,
|
|
237
|
+
second
|
|
238
|
+
].join(timeDelimiter);
|
|
239
|
+
result = `${result}${separator}${time}${tzOffset}`;
|
|
240
|
+
}
|
|
241
|
+
return result;
|
|
242
|
+
}
|
|
10
243
|
//#endregion
|
|
11
244
|
//#region src/shared/datetime/dateStr.ts
|
|
12
245
|
var formatDateStr = (date) => formatISO(date, { representation: "date" });
|
|
@@ -15,7 +248,7 @@ var parseDateStr = (dateStr) => {
|
|
|
15
248
|
const [year, month, day] = dateStr.split("-");
|
|
16
249
|
return new Date(parseInt(year), parseInt(month) - 1, parseInt(day));
|
|
17
250
|
};
|
|
18
|
-
var addDays$
|
|
251
|
+
var addDays$2 = (dateStr, days) => {
|
|
19
252
|
const date = parseDateStr(dateStr);
|
|
20
253
|
const resultDate = new Date(date);
|
|
21
254
|
resultDate.setDate(resultDate.getDate() + days);
|
|
@@ -36,6 +269,4111 @@ var isValidDateStr = (string) => {
|
|
|
36
269
|
return hasThreeComponents(components) && allComponentsAreNumbers(components) && isValidDate(components);
|
|
37
270
|
};
|
|
38
271
|
//#endregion
|
|
272
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatDistance.js
|
|
273
|
+
var formatDistanceLocale = {
|
|
274
|
+
lessThanXSeconds: {
|
|
275
|
+
one: "less than a second",
|
|
276
|
+
other: "less than {{count}} seconds"
|
|
277
|
+
},
|
|
278
|
+
xSeconds: {
|
|
279
|
+
one: "1 second",
|
|
280
|
+
other: "{{count}} seconds"
|
|
281
|
+
},
|
|
282
|
+
halfAMinute: "half a minute",
|
|
283
|
+
lessThanXMinutes: {
|
|
284
|
+
one: "less than a minute",
|
|
285
|
+
other: "less than {{count}} minutes"
|
|
286
|
+
},
|
|
287
|
+
xMinutes: {
|
|
288
|
+
one: "1 minute",
|
|
289
|
+
other: "{{count}} minutes"
|
|
290
|
+
},
|
|
291
|
+
aboutXHours: {
|
|
292
|
+
one: "about 1 hour",
|
|
293
|
+
other: "about {{count}} hours"
|
|
294
|
+
},
|
|
295
|
+
xHours: {
|
|
296
|
+
one: "1 hour",
|
|
297
|
+
other: "{{count}} hours"
|
|
298
|
+
},
|
|
299
|
+
xDays: {
|
|
300
|
+
one: "1 day",
|
|
301
|
+
other: "{{count}} days"
|
|
302
|
+
},
|
|
303
|
+
aboutXWeeks: {
|
|
304
|
+
one: "about 1 week",
|
|
305
|
+
other: "about {{count}} weeks"
|
|
306
|
+
},
|
|
307
|
+
xWeeks: {
|
|
308
|
+
one: "1 week",
|
|
309
|
+
other: "{{count}} weeks"
|
|
310
|
+
},
|
|
311
|
+
aboutXMonths: {
|
|
312
|
+
one: "about 1 month",
|
|
313
|
+
other: "about {{count}} months"
|
|
314
|
+
},
|
|
315
|
+
xMonths: {
|
|
316
|
+
one: "1 month",
|
|
317
|
+
other: "{{count}} months"
|
|
318
|
+
},
|
|
319
|
+
aboutXYears: {
|
|
320
|
+
one: "about 1 year",
|
|
321
|
+
other: "about {{count}} years"
|
|
322
|
+
},
|
|
323
|
+
xYears: {
|
|
324
|
+
one: "1 year",
|
|
325
|
+
other: "{{count}} years"
|
|
326
|
+
},
|
|
327
|
+
overXYears: {
|
|
328
|
+
one: "over 1 year",
|
|
329
|
+
other: "over {{count}} years"
|
|
330
|
+
},
|
|
331
|
+
almostXYears: {
|
|
332
|
+
one: "almost 1 year",
|
|
333
|
+
other: "almost {{count}} years"
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
var formatDistance = (token, count, options) => {
|
|
337
|
+
let result;
|
|
338
|
+
const tokenValue = formatDistanceLocale[token];
|
|
339
|
+
if (typeof tokenValue === "string") result = tokenValue;
|
|
340
|
+
else if (count === 1) result = tokenValue.one;
|
|
341
|
+
else result = tokenValue.other.replace("{{count}}", count.toString());
|
|
342
|
+
if (options?.addSuffix) if (options.comparison && options.comparison > 0) return "in " + result;
|
|
343
|
+
else return result + " ago";
|
|
344
|
+
return result;
|
|
345
|
+
};
|
|
346
|
+
//#endregion
|
|
347
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildFormatLongFn.js
|
|
348
|
+
function buildFormatLongFn(args) {
|
|
349
|
+
return (options = {}) => {
|
|
350
|
+
const width = options.width ? String(options.width) : args.defaultWidth;
|
|
351
|
+
return args.formats[width] || args.formats[args.defaultWidth];
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
var formatLong = {
|
|
355
|
+
date: buildFormatLongFn({
|
|
356
|
+
formats: {
|
|
357
|
+
full: "EEEE, MMMM do, y",
|
|
358
|
+
long: "MMMM do, y",
|
|
359
|
+
medium: "MMM d, y",
|
|
360
|
+
short: "MM/dd/yyyy"
|
|
361
|
+
},
|
|
362
|
+
defaultWidth: "full"
|
|
363
|
+
}),
|
|
364
|
+
time: buildFormatLongFn({
|
|
365
|
+
formats: {
|
|
366
|
+
full: "h:mm:ss a zzzz",
|
|
367
|
+
long: "h:mm:ss a z",
|
|
368
|
+
medium: "h:mm:ss a",
|
|
369
|
+
short: "h:mm a"
|
|
370
|
+
},
|
|
371
|
+
defaultWidth: "full"
|
|
372
|
+
}),
|
|
373
|
+
dateTime: buildFormatLongFn({
|
|
374
|
+
formats: {
|
|
375
|
+
full: "{{date}} 'at' {{time}}",
|
|
376
|
+
long: "{{date}} 'at' {{time}}",
|
|
377
|
+
medium: "{{date}}, {{time}}",
|
|
378
|
+
short: "{{date}}, {{time}}"
|
|
379
|
+
},
|
|
380
|
+
defaultWidth: "full"
|
|
381
|
+
})
|
|
382
|
+
};
|
|
383
|
+
//#endregion
|
|
384
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatRelative.js
|
|
385
|
+
var formatRelativeLocale = {
|
|
386
|
+
lastWeek: "'last' eeee 'at' p",
|
|
387
|
+
yesterday: "'yesterday at' p",
|
|
388
|
+
today: "'today at' p",
|
|
389
|
+
tomorrow: "'tomorrow at' p",
|
|
390
|
+
nextWeek: "eeee 'at' p",
|
|
391
|
+
other: "P"
|
|
392
|
+
};
|
|
393
|
+
var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
|
|
394
|
+
//#endregion
|
|
395
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildLocalizeFn.js
|
|
396
|
+
/**
|
|
397
|
+
* The localize function argument callback which allows to convert raw value to
|
|
398
|
+
* the actual type.
|
|
399
|
+
*
|
|
400
|
+
* @param value - The value to convert
|
|
401
|
+
*
|
|
402
|
+
* @returns The converted value
|
|
403
|
+
*/
|
|
404
|
+
/**
|
|
405
|
+
* The map of localized values for each width.
|
|
406
|
+
*/
|
|
407
|
+
/**
|
|
408
|
+
* The index type of the locale unit value. It types conversion of units of
|
|
409
|
+
* values that don't start at 0 (i.e. quarters).
|
|
410
|
+
*/
|
|
411
|
+
/**
|
|
412
|
+
* Converts the unit value to the tuple of values.
|
|
413
|
+
*/
|
|
414
|
+
/**
|
|
415
|
+
* The tuple of localized era values. The first element represents BC,
|
|
416
|
+
* the second element represents AD.
|
|
417
|
+
*/
|
|
418
|
+
/**
|
|
419
|
+
* The tuple of localized quarter values. The first element represents Q1.
|
|
420
|
+
*/
|
|
421
|
+
/**
|
|
422
|
+
* The tuple of localized day values. The first element represents Sunday.
|
|
423
|
+
*/
|
|
424
|
+
/**
|
|
425
|
+
* The tuple of localized month values. The first element represents January.
|
|
426
|
+
*/
|
|
427
|
+
function buildLocalizeFn(args) {
|
|
428
|
+
return (value, options) => {
|
|
429
|
+
const context = options?.context ? String(options.context) : "standalone";
|
|
430
|
+
let valuesArray;
|
|
431
|
+
if (context === "formatting" && args.formattingValues) {
|
|
432
|
+
const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
|
433
|
+
const width = options?.width ? String(options.width) : defaultWidth;
|
|
434
|
+
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
|
435
|
+
} else {
|
|
436
|
+
const defaultWidth = args.defaultWidth;
|
|
437
|
+
const width = options?.width ? String(options.width) : args.defaultWidth;
|
|
438
|
+
valuesArray = args.values[width] || args.values[defaultWidth];
|
|
439
|
+
}
|
|
440
|
+
const index = args.argumentCallback ? args.argumentCallback(value) : value;
|
|
441
|
+
return valuesArray[index];
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
//#endregion
|
|
445
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/localize.js
|
|
446
|
+
var eraValues = {
|
|
447
|
+
narrow: ["B", "A"],
|
|
448
|
+
abbreviated: ["BC", "AD"],
|
|
449
|
+
wide: ["Before Christ", "Anno Domini"]
|
|
450
|
+
};
|
|
451
|
+
var quarterValues = {
|
|
452
|
+
narrow: [
|
|
453
|
+
"1",
|
|
454
|
+
"2",
|
|
455
|
+
"3",
|
|
456
|
+
"4"
|
|
457
|
+
],
|
|
458
|
+
abbreviated: [
|
|
459
|
+
"Q1",
|
|
460
|
+
"Q2",
|
|
461
|
+
"Q3",
|
|
462
|
+
"Q4"
|
|
463
|
+
],
|
|
464
|
+
wide: [
|
|
465
|
+
"1st quarter",
|
|
466
|
+
"2nd quarter",
|
|
467
|
+
"3rd quarter",
|
|
468
|
+
"4th quarter"
|
|
469
|
+
]
|
|
470
|
+
};
|
|
471
|
+
var monthValues = {
|
|
472
|
+
narrow: [
|
|
473
|
+
"J",
|
|
474
|
+
"F",
|
|
475
|
+
"M",
|
|
476
|
+
"A",
|
|
477
|
+
"M",
|
|
478
|
+
"J",
|
|
479
|
+
"J",
|
|
480
|
+
"A",
|
|
481
|
+
"S",
|
|
482
|
+
"O",
|
|
483
|
+
"N",
|
|
484
|
+
"D"
|
|
485
|
+
],
|
|
486
|
+
abbreviated: [
|
|
487
|
+
"Jan",
|
|
488
|
+
"Feb",
|
|
489
|
+
"Mar",
|
|
490
|
+
"Apr",
|
|
491
|
+
"May",
|
|
492
|
+
"Jun",
|
|
493
|
+
"Jul",
|
|
494
|
+
"Aug",
|
|
495
|
+
"Sep",
|
|
496
|
+
"Oct",
|
|
497
|
+
"Nov",
|
|
498
|
+
"Dec"
|
|
499
|
+
],
|
|
500
|
+
wide: [
|
|
501
|
+
"January",
|
|
502
|
+
"February",
|
|
503
|
+
"March",
|
|
504
|
+
"April",
|
|
505
|
+
"May",
|
|
506
|
+
"June",
|
|
507
|
+
"July",
|
|
508
|
+
"August",
|
|
509
|
+
"September",
|
|
510
|
+
"October",
|
|
511
|
+
"November",
|
|
512
|
+
"December"
|
|
513
|
+
]
|
|
514
|
+
};
|
|
515
|
+
var dayValues = {
|
|
516
|
+
narrow: [
|
|
517
|
+
"S",
|
|
518
|
+
"M",
|
|
519
|
+
"T",
|
|
520
|
+
"W",
|
|
521
|
+
"T",
|
|
522
|
+
"F",
|
|
523
|
+
"S"
|
|
524
|
+
],
|
|
525
|
+
short: [
|
|
526
|
+
"Su",
|
|
527
|
+
"Mo",
|
|
528
|
+
"Tu",
|
|
529
|
+
"We",
|
|
530
|
+
"Th",
|
|
531
|
+
"Fr",
|
|
532
|
+
"Sa"
|
|
533
|
+
],
|
|
534
|
+
abbreviated: [
|
|
535
|
+
"Sun",
|
|
536
|
+
"Mon",
|
|
537
|
+
"Tue",
|
|
538
|
+
"Wed",
|
|
539
|
+
"Thu",
|
|
540
|
+
"Fri",
|
|
541
|
+
"Sat"
|
|
542
|
+
],
|
|
543
|
+
wide: [
|
|
544
|
+
"Sunday",
|
|
545
|
+
"Monday",
|
|
546
|
+
"Tuesday",
|
|
547
|
+
"Wednesday",
|
|
548
|
+
"Thursday",
|
|
549
|
+
"Friday",
|
|
550
|
+
"Saturday"
|
|
551
|
+
]
|
|
552
|
+
};
|
|
553
|
+
var dayPeriodValues = {
|
|
554
|
+
narrow: {
|
|
555
|
+
am: "a",
|
|
556
|
+
pm: "p",
|
|
557
|
+
midnight: "mi",
|
|
558
|
+
noon: "n",
|
|
559
|
+
morning: "morning",
|
|
560
|
+
afternoon: "afternoon",
|
|
561
|
+
evening: "evening",
|
|
562
|
+
night: "night"
|
|
563
|
+
},
|
|
564
|
+
abbreviated: {
|
|
565
|
+
am: "AM",
|
|
566
|
+
pm: "PM",
|
|
567
|
+
midnight: "midnight",
|
|
568
|
+
noon: "noon",
|
|
569
|
+
morning: "morning",
|
|
570
|
+
afternoon: "afternoon",
|
|
571
|
+
evening: "evening",
|
|
572
|
+
night: "night"
|
|
573
|
+
},
|
|
574
|
+
wide: {
|
|
575
|
+
am: "a.m.",
|
|
576
|
+
pm: "p.m.",
|
|
577
|
+
midnight: "midnight",
|
|
578
|
+
noon: "noon",
|
|
579
|
+
morning: "morning",
|
|
580
|
+
afternoon: "afternoon",
|
|
581
|
+
evening: "evening",
|
|
582
|
+
night: "night"
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
var formattingDayPeriodValues = {
|
|
586
|
+
narrow: {
|
|
587
|
+
am: "a",
|
|
588
|
+
pm: "p",
|
|
589
|
+
midnight: "mi",
|
|
590
|
+
noon: "n",
|
|
591
|
+
morning: "in the morning",
|
|
592
|
+
afternoon: "in the afternoon",
|
|
593
|
+
evening: "in the evening",
|
|
594
|
+
night: "at night"
|
|
595
|
+
},
|
|
596
|
+
abbreviated: {
|
|
597
|
+
am: "AM",
|
|
598
|
+
pm: "PM",
|
|
599
|
+
midnight: "midnight",
|
|
600
|
+
noon: "noon",
|
|
601
|
+
morning: "in the morning",
|
|
602
|
+
afternoon: "in the afternoon",
|
|
603
|
+
evening: "in the evening",
|
|
604
|
+
night: "at night"
|
|
605
|
+
},
|
|
606
|
+
wide: {
|
|
607
|
+
am: "a.m.",
|
|
608
|
+
pm: "p.m.",
|
|
609
|
+
midnight: "midnight",
|
|
610
|
+
noon: "noon",
|
|
611
|
+
morning: "in the morning",
|
|
612
|
+
afternoon: "in the afternoon",
|
|
613
|
+
evening: "in the evening",
|
|
614
|
+
night: "at night"
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
var ordinalNumber = (dirtyNumber, _options) => {
|
|
618
|
+
const number = Number(dirtyNumber);
|
|
619
|
+
const rem100 = number % 100;
|
|
620
|
+
if (rem100 > 20 || rem100 < 10) switch (rem100 % 10) {
|
|
621
|
+
case 1: return number + "st";
|
|
622
|
+
case 2: return number + "nd";
|
|
623
|
+
case 3: return number + "rd";
|
|
624
|
+
}
|
|
625
|
+
return number + "th";
|
|
626
|
+
};
|
|
627
|
+
var localize = {
|
|
628
|
+
ordinalNumber,
|
|
629
|
+
era: buildLocalizeFn({
|
|
630
|
+
values: eraValues,
|
|
631
|
+
defaultWidth: "wide"
|
|
632
|
+
}),
|
|
633
|
+
quarter: buildLocalizeFn({
|
|
634
|
+
values: quarterValues,
|
|
635
|
+
defaultWidth: "wide",
|
|
636
|
+
argumentCallback: (quarter) => quarter - 1
|
|
637
|
+
}),
|
|
638
|
+
month: buildLocalizeFn({
|
|
639
|
+
values: monthValues,
|
|
640
|
+
defaultWidth: "wide"
|
|
641
|
+
}),
|
|
642
|
+
day: buildLocalizeFn({
|
|
643
|
+
values: dayValues,
|
|
644
|
+
defaultWidth: "wide"
|
|
645
|
+
}),
|
|
646
|
+
dayPeriod: buildLocalizeFn({
|
|
647
|
+
values: dayPeriodValues,
|
|
648
|
+
defaultWidth: "wide",
|
|
649
|
+
formattingValues: formattingDayPeriodValues,
|
|
650
|
+
defaultFormattingWidth: "wide"
|
|
651
|
+
})
|
|
652
|
+
};
|
|
653
|
+
//#endregion
|
|
654
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildMatchFn.js
|
|
655
|
+
function buildMatchFn(args) {
|
|
656
|
+
return (string, options = {}) => {
|
|
657
|
+
const width = options.width;
|
|
658
|
+
const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
|
659
|
+
const matchResult = string.match(matchPattern);
|
|
660
|
+
if (!matchResult) return null;
|
|
661
|
+
const matchedString = matchResult[0];
|
|
662
|
+
const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
|
663
|
+
const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : findKey(parsePatterns, (pattern) => pattern.test(matchedString));
|
|
664
|
+
let value;
|
|
665
|
+
value = args.valueCallback ? args.valueCallback(key) : key;
|
|
666
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
667
|
+
const rest = string.slice(matchedString.length);
|
|
668
|
+
return {
|
|
669
|
+
value,
|
|
670
|
+
rest
|
|
671
|
+
};
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
function findKey(object, predicate) {
|
|
675
|
+
for (const key in object) if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) return key;
|
|
676
|
+
}
|
|
677
|
+
function findIndex(array, predicate) {
|
|
678
|
+
for (let key = 0; key < array.length; key++) if (predicate(array[key])) return key;
|
|
679
|
+
}
|
|
680
|
+
//#endregion
|
|
681
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
|
|
682
|
+
function buildMatchPatternFn(args) {
|
|
683
|
+
return (string, options = {}) => {
|
|
684
|
+
const matchResult = string.match(args.matchPattern);
|
|
685
|
+
if (!matchResult) return null;
|
|
686
|
+
const matchedString = matchResult[0];
|
|
687
|
+
const parseResult = string.match(args.parsePattern);
|
|
688
|
+
if (!parseResult) return null;
|
|
689
|
+
let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
|
690
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
691
|
+
const rest = string.slice(matchedString.length);
|
|
692
|
+
return {
|
|
693
|
+
value,
|
|
694
|
+
rest
|
|
695
|
+
};
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
//#endregion
|
|
699
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US.js
|
|
700
|
+
/**
|
|
701
|
+
* @category Locales
|
|
702
|
+
* @summary English locale (United States).
|
|
703
|
+
* @language English
|
|
704
|
+
* @iso-639-2 eng
|
|
705
|
+
* @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)
|
|
706
|
+
* @author Lesha Koss [@leshakoss](https://github.com/leshakoss)
|
|
707
|
+
*/
|
|
708
|
+
var enUS = {
|
|
709
|
+
code: "en-US",
|
|
710
|
+
formatDistance,
|
|
711
|
+
formatLong,
|
|
712
|
+
formatRelative,
|
|
713
|
+
localize,
|
|
714
|
+
match: {
|
|
715
|
+
ordinalNumber: buildMatchPatternFn({
|
|
716
|
+
matchPattern: /^(\d+)(th|st|nd|rd)?/i,
|
|
717
|
+
parsePattern: /\d+/i,
|
|
718
|
+
valueCallback: (value) => parseInt(value, 10)
|
|
719
|
+
}),
|
|
720
|
+
era: buildMatchFn({
|
|
721
|
+
matchPatterns: {
|
|
722
|
+
narrow: /^(b|a)/i,
|
|
723
|
+
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
724
|
+
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
725
|
+
},
|
|
726
|
+
defaultMatchWidth: "wide",
|
|
727
|
+
parsePatterns: { any: [/^b/i, /^(a|c)/i] },
|
|
728
|
+
defaultParseWidth: "any"
|
|
729
|
+
}),
|
|
730
|
+
quarter: buildMatchFn({
|
|
731
|
+
matchPatterns: {
|
|
732
|
+
narrow: /^[1234]/i,
|
|
733
|
+
abbreviated: /^q[1234]/i,
|
|
734
|
+
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
735
|
+
},
|
|
736
|
+
defaultMatchWidth: "wide",
|
|
737
|
+
parsePatterns: { any: [
|
|
738
|
+
/1/i,
|
|
739
|
+
/2/i,
|
|
740
|
+
/3/i,
|
|
741
|
+
/4/i
|
|
742
|
+
] },
|
|
743
|
+
defaultParseWidth: "any",
|
|
744
|
+
valueCallback: (index) => index + 1
|
|
745
|
+
}),
|
|
746
|
+
month: buildMatchFn({
|
|
747
|
+
matchPatterns: {
|
|
748
|
+
narrow: /^[jfmasond]/i,
|
|
749
|
+
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
750
|
+
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
751
|
+
},
|
|
752
|
+
defaultMatchWidth: "wide",
|
|
753
|
+
parsePatterns: {
|
|
754
|
+
narrow: [
|
|
755
|
+
/^j/i,
|
|
756
|
+
/^f/i,
|
|
757
|
+
/^m/i,
|
|
758
|
+
/^a/i,
|
|
759
|
+
/^m/i,
|
|
760
|
+
/^j/i,
|
|
761
|
+
/^j/i,
|
|
762
|
+
/^a/i,
|
|
763
|
+
/^s/i,
|
|
764
|
+
/^o/i,
|
|
765
|
+
/^n/i,
|
|
766
|
+
/^d/i
|
|
767
|
+
],
|
|
768
|
+
any: [
|
|
769
|
+
/^ja/i,
|
|
770
|
+
/^f/i,
|
|
771
|
+
/^mar/i,
|
|
772
|
+
/^ap/i,
|
|
773
|
+
/^may/i,
|
|
774
|
+
/^jun/i,
|
|
775
|
+
/^jul/i,
|
|
776
|
+
/^au/i,
|
|
777
|
+
/^s/i,
|
|
778
|
+
/^o/i,
|
|
779
|
+
/^n/i,
|
|
780
|
+
/^d/i
|
|
781
|
+
]
|
|
782
|
+
},
|
|
783
|
+
defaultParseWidth: "any"
|
|
784
|
+
}),
|
|
785
|
+
day: buildMatchFn({
|
|
786
|
+
matchPatterns: {
|
|
787
|
+
narrow: /^[smtwf]/i,
|
|
788
|
+
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
789
|
+
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
790
|
+
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
791
|
+
},
|
|
792
|
+
defaultMatchWidth: "wide",
|
|
793
|
+
parsePatterns: {
|
|
794
|
+
narrow: [
|
|
795
|
+
/^s/i,
|
|
796
|
+
/^m/i,
|
|
797
|
+
/^t/i,
|
|
798
|
+
/^w/i,
|
|
799
|
+
/^t/i,
|
|
800
|
+
/^f/i,
|
|
801
|
+
/^s/i
|
|
802
|
+
],
|
|
803
|
+
any: [
|
|
804
|
+
/^su/i,
|
|
805
|
+
/^m/i,
|
|
806
|
+
/^tu/i,
|
|
807
|
+
/^w/i,
|
|
808
|
+
/^th/i,
|
|
809
|
+
/^f/i,
|
|
810
|
+
/^sa/i
|
|
811
|
+
]
|
|
812
|
+
},
|
|
813
|
+
defaultParseWidth: "any"
|
|
814
|
+
}),
|
|
815
|
+
dayPeriod: buildMatchFn({
|
|
816
|
+
matchPatterns: {
|
|
817
|
+
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
818
|
+
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
819
|
+
},
|
|
820
|
+
defaultMatchWidth: "any",
|
|
821
|
+
parsePatterns: { any: {
|
|
822
|
+
am: /^a/i,
|
|
823
|
+
pm: /^p/i,
|
|
824
|
+
midnight: /^mi/i,
|
|
825
|
+
noon: /^no/i,
|
|
826
|
+
morning: /morning/i,
|
|
827
|
+
afternoon: /afternoon/i,
|
|
828
|
+
evening: /evening/i,
|
|
829
|
+
night: /night/i
|
|
830
|
+
} },
|
|
831
|
+
defaultParseWidth: "any"
|
|
832
|
+
})
|
|
833
|
+
},
|
|
834
|
+
options: {
|
|
835
|
+
weekStartsOn: 0,
|
|
836
|
+
firstWeekContainsDate: 1
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
//#endregion
|
|
840
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/defaultOptions.js
|
|
841
|
+
var defaultOptions = {};
|
|
842
|
+
function getDefaultOptions$1() {
|
|
843
|
+
return defaultOptions;
|
|
844
|
+
}
|
|
845
|
+
//#endregion
|
|
846
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
|
|
847
|
+
/**
|
|
848
|
+
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
|
|
849
|
+
* They usually appear for dates that denote time before the timezones were introduced
|
|
850
|
+
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
|
|
851
|
+
* and GMT+01:00:00 after that date)
|
|
852
|
+
*
|
|
853
|
+
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
|
|
854
|
+
* which would lead to incorrect calculations.
|
|
855
|
+
*
|
|
856
|
+
* This function returns the timezone offset in milliseconds that takes seconds in account.
|
|
857
|
+
*/
|
|
858
|
+
function getTimezoneOffsetInMilliseconds(date) {
|
|
859
|
+
const _date = toDate(date);
|
|
860
|
+
const utcDate = new Date(Date.UTC(_date.getFullYear(), _date.getMonth(), _date.getDate(), _date.getHours(), _date.getMinutes(), _date.getSeconds(), _date.getMilliseconds()));
|
|
861
|
+
utcDate.setUTCFullYear(_date.getFullYear());
|
|
862
|
+
return +date - +utcDate;
|
|
863
|
+
}
|
|
864
|
+
//#endregion
|
|
865
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeDates.js
|
|
866
|
+
function normalizeDates(context, ...dates) {
|
|
867
|
+
const normalize = constructFrom.bind(null, context || dates.find((date) => typeof date === "object"));
|
|
868
|
+
return dates.map(normalize);
|
|
869
|
+
}
|
|
870
|
+
//#endregion
|
|
871
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfDay.js
|
|
872
|
+
/**
|
|
873
|
+
* The {@link startOfDay} function options.
|
|
874
|
+
*/
|
|
875
|
+
/**
|
|
876
|
+
* @name startOfDay
|
|
877
|
+
* @category Day Helpers
|
|
878
|
+
* @summary Return the start of a day for the given date.
|
|
879
|
+
*
|
|
880
|
+
* @description
|
|
881
|
+
* Return the start of a day for the given date.
|
|
882
|
+
* The result will be in the local timezone.
|
|
883
|
+
*
|
|
884
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
885
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
886
|
+
*
|
|
887
|
+
* @param date - The original date
|
|
888
|
+
* @param options - The options
|
|
889
|
+
*
|
|
890
|
+
* @returns The start of a day
|
|
891
|
+
*
|
|
892
|
+
* @example
|
|
893
|
+
* // The start of a day for 2 September 2014 11:55:00:
|
|
894
|
+
* const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
|
|
895
|
+
* //=> Tue Sep 02 2014 00:00:00
|
|
896
|
+
*/
|
|
897
|
+
function startOfDay(date, options) {
|
|
898
|
+
const _date = toDate(date, options?.in);
|
|
899
|
+
_date.setHours(0, 0, 0, 0);
|
|
900
|
+
return _date;
|
|
901
|
+
}
|
|
902
|
+
//#endregion
|
|
903
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarDays.js
|
|
904
|
+
/**
|
|
905
|
+
* The {@link differenceInCalendarDays} function options.
|
|
906
|
+
*/
|
|
907
|
+
/**
|
|
908
|
+
* @name differenceInCalendarDays
|
|
909
|
+
* @category Day Helpers
|
|
910
|
+
* @summary Get the number of calendar days between the given dates.
|
|
911
|
+
*
|
|
912
|
+
* @description
|
|
913
|
+
* Get the number of calendar days between the given dates. This means that the times are removed
|
|
914
|
+
* from the dates and then the difference in days is calculated.
|
|
915
|
+
*
|
|
916
|
+
* @param laterDate - The later date
|
|
917
|
+
* @param earlierDate - The earlier date
|
|
918
|
+
* @param options - The options object
|
|
919
|
+
*
|
|
920
|
+
* @returns The number of calendar days
|
|
921
|
+
*
|
|
922
|
+
* @example
|
|
923
|
+
* // How many calendar days are between
|
|
924
|
+
* // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
|
|
925
|
+
* const result = differenceInCalendarDays(
|
|
926
|
+
* new Date(2012, 6, 2, 0, 0),
|
|
927
|
+
* new Date(2011, 6, 2, 23, 0)
|
|
928
|
+
* )
|
|
929
|
+
* //=> 366
|
|
930
|
+
* // How many calendar days are between
|
|
931
|
+
* // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
|
|
932
|
+
* const result = differenceInCalendarDays(
|
|
933
|
+
* new Date(2011, 6, 3, 0, 1),
|
|
934
|
+
* new Date(2011, 6, 2, 23, 59)
|
|
935
|
+
* )
|
|
936
|
+
* //=> 1
|
|
937
|
+
*/
|
|
938
|
+
function differenceInCalendarDays(laterDate, earlierDate, options) {
|
|
939
|
+
const [laterDate_, earlierDate_] = normalizeDates(options?.in, laterDate, earlierDate);
|
|
940
|
+
const laterStartOfDay = startOfDay(laterDate_);
|
|
941
|
+
const earlierStartOfDay = startOfDay(earlierDate_);
|
|
942
|
+
const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
|
|
943
|
+
const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
|
|
944
|
+
return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
|
|
945
|
+
}
|
|
946
|
+
//#endregion
|
|
947
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfYear.js
|
|
948
|
+
/**
|
|
949
|
+
* The {@link startOfYear} function options.
|
|
950
|
+
*/
|
|
951
|
+
/**
|
|
952
|
+
* @name startOfYear
|
|
953
|
+
* @category Year Helpers
|
|
954
|
+
* @summary Return the start of a year for the given date.
|
|
955
|
+
*
|
|
956
|
+
* @description
|
|
957
|
+
* Return the start of a year for the given date.
|
|
958
|
+
* The result will be in the local timezone.
|
|
959
|
+
*
|
|
960
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
961
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
962
|
+
*
|
|
963
|
+
* @param date - The original date
|
|
964
|
+
* @param options - The options
|
|
965
|
+
*
|
|
966
|
+
* @returns The start of a year
|
|
967
|
+
*
|
|
968
|
+
* @example
|
|
969
|
+
* // The start of a year for 2 September 2014 11:55:00:
|
|
970
|
+
* const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))
|
|
971
|
+
* //=> Wed Jan 01 2014 00:00:00
|
|
972
|
+
*/
|
|
973
|
+
function startOfYear(date, options) {
|
|
974
|
+
const date_ = toDate(date, options?.in);
|
|
975
|
+
date_.setFullYear(date_.getFullYear(), 0, 1);
|
|
976
|
+
date_.setHours(0, 0, 0, 0);
|
|
977
|
+
return date_;
|
|
978
|
+
}
|
|
979
|
+
//#endregion
|
|
980
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getDayOfYear.js
|
|
981
|
+
/**
|
|
982
|
+
* The {@link getDayOfYear} function options.
|
|
983
|
+
*/
|
|
984
|
+
/**
|
|
985
|
+
* @name getDayOfYear
|
|
986
|
+
* @category Day Helpers
|
|
987
|
+
* @summary Get the day of the year of the given date.
|
|
988
|
+
*
|
|
989
|
+
* @description
|
|
990
|
+
* Get the day of the year of the given date.
|
|
991
|
+
*
|
|
992
|
+
* @param date - The given date
|
|
993
|
+
* @param options - The options
|
|
994
|
+
*
|
|
995
|
+
* @returns The day of year
|
|
996
|
+
*
|
|
997
|
+
* @example
|
|
998
|
+
* // Which day of the year is 2 July 2014?
|
|
999
|
+
* const result = getDayOfYear(new Date(2014, 6, 2))
|
|
1000
|
+
* //=> 183
|
|
1001
|
+
*/
|
|
1002
|
+
function getDayOfYear(date, options) {
|
|
1003
|
+
const _date = toDate(date, options?.in);
|
|
1004
|
+
return differenceInCalendarDays(_date, startOfYear(_date)) + 1;
|
|
1005
|
+
}
|
|
1006
|
+
//#endregion
|
|
1007
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfWeek.js
|
|
1008
|
+
/**
|
|
1009
|
+
* The {@link startOfWeek} function options.
|
|
1010
|
+
*/
|
|
1011
|
+
/**
|
|
1012
|
+
* @name startOfWeek
|
|
1013
|
+
* @category Week Helpers
|
|
1014
|
+
* @summary Return the start of a week for the given date.
|
|
1015
|
+
*
|
|
1016
|
+
* @description
|
|
1017
|
+
* Return the start of a week for the given date.
|
|
1018
|
+
* The result will be in the local timezone.
|
|
1019
|
+
*
|
|
1020
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
1021
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
1022
|
+
*
|
|
1023
|
+
* @param date - The original date
|
|
1024
|
+
* @param options - An object with options
|
|
1025
|
+
*
|
|
1026
|
+
* @returns The start of a week
|
|
1027
|
+
*
|
|
1028
|
+
* @example
|
|
1029
|
+
* // The start of a week for 2 September 2014 11:55:00:
|
|
1030
|
+
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
|
|
1031
|
+
* //=> Sun Aug 31 2014 00:00:00
|
|
1032
|
+
*
|
|
1033
|
+
* @example
|
|
1034
|
+
* // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
|
|
1035
|
+
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
|
|
1036
|
+
* //=> Mon Sep 01 2014 00:00:00
|
|
1037
|
+
*/
|
|
1038
|
+
function startOfWeek(date, options) {
|
|
1039
|
+
const defaultOptions = getDefaultOptions$1();
|
|
1040
|
+
const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0;
|
|
1041
|
+
const _date = toDate(date, options?.in);
|
|
1042
|
+
const day = _date.getDay();
|
|
1043
|
+
const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
1044
|
+
_date.setDate(_date.getDate() - diff);
|
|
1045
|
+
_date.setHours(0, 0, 0, 0);
|
|
1046
|
+
return _date;
|
|
1047
|
+
}
|
|
1048
|
+
//#endregion
|
|
1049
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeek.js
|
|
1050
|
+
/**
|
|
1051
|
+
* The {@link startOfISOWeek} function options.
|
|
1052
|
+
*/
|
|
1053
|
+
/**
|
|
1054
|
+
* @name startOfISOWeek
|
|
1055
|
+
* @category ISO Week Helpers
|
|
1056
|
+
* @summary Return the start of an ISO week for the given date.
|
|
1057
|
+
*
|
|
1058
|
+
* @description
|
|
1059
|
+
* Return the start of an ISO week for the given date.
|
|
1060
|
+
* The result will be in the local timezone.
|
|
1061
|
+
*
|
|
1062
|
+
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
1063
|
+
*
|
|
1064
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
1065
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
1066
|
+
*
|
|
1067
|
+
* @param date - The original date
|
|
1068
|
+
* @param options - An object with options
|
|
1069
|
+
*
|
|
1070
|
+
* @returns The start of an ISO week
|
|
1071
|
+
*
|
|
1072
|
+
* @example
|
|
1073
|
+
* // The start of an ISO week for 2 September 2014 11:55:00:
|
|
1074
|
+
* const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
|
|
1075
|
+
* //=> Mon Sep 01 2014 00:00:00
|
|
1076
|
+
*/
|
|
1077
|
+
function startOfISOWeek(date, options) {
|
|
1078
|
+
return startOfWeek(date, {
|
|
1079
|
+
...options,
|
|
1080
|
+
weekStartsOn: 1
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
//#endregion
|
|
1084
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISOWeekYear.js
|
|
1085
|
+
/**
|
|
1086
|
+
* The {@link getISOWeekYear} function options.
|
|
1087
|
+
*/
|
|
1088
|
+
/**
|
|
1089
|
+
* @name getISOWeekYear
|
|
1090
|
+
* @category ISO Week-Numbering Year Helpers
|
|
1091
|
+
* @summary Get the ISO week-numbering year of the given date.
|
|
1092
|
+
*
|
|
1093
|
+
* @description
|
|
1094
|
+
* Get the ISO week-numbering year of the given date,
|
|
1095
|
+
* which always starts 3 days before the year's first Thursday.
|
|
1096
|
+
*
|
|
1097
|
+
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
1098
|
+
*
|
|
1099
|
+
* @param date - The given date
|
|
1100
|
+
*
|
|
1101
|
+
* @returns The ISO week-numbering year
|
|
1102
|
+
*
|
|
1103
|
+
* @example
|
|
1104
|
+
* // Which ISO-week numbering year is 2 January 2005?
|
|
1105
|
+
* const result = getISOWeekYear(new Date(2005, 0, 2))
|
|
1106
|
+
* //=> 2004
|
|
1107
|
+
*/
|
|
1108
|
+
function getISOWeekYear(date, options) {
|
|
1109
|
+
const _date = toDate(date, options?.in);
|
|
1110
|
+
const year = _date.getFullYear();
|
|
1111
|
+
const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
|
|
1112
|
+
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
|
|
1113
|
+
fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
|
|
1114
|
+
const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
|
|
1115
|
+
const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
|
|
1116
|
+
fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
|
|
1117
|
+
fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
|
|
1118
|
+
const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
|
|
1119
|
+
if (_date.getTime() >= startOfNextYear.getTime()) return year + 1;
|
|
1120
|
+
else if (_date.getTime() >= startOfThisYear.getTime()) return year;
|
|
1121
|
+
else return year - 1;
|
|
1122
|
+
}
|
|
1123
|
+
//#endregion
|
|
1124
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeekYear.js
|
|
1125
|
+
/**
|
|
1126
|
+
* The {@link startOfISOWeekYear} function options.
|
|
1127
|
+
*/
|
|
1128
|
+
/**
|
|
1129
|
+
* @name startOfISOWeekYear
|
|
1130
|
+
* @category ISO Week-Numbering Year Helpers
|
|
1131
|
+
* @summary Return the start of an ISO week-numbering year for the given date.
|
|
1132
|
+
*
|
|
1133
|
+
* @description
|
|
1134
|
+
* Return the start of an ISO week-numbering year,
|
|
1135
|
+
* which always starts 3 days before the year's first Thursday.
|
|
1136
|
+
* The result will be in the local timezone.
|
|
1137
|
+
*
|
|
1138
|
+
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
1139
|
+
*
|
|
1140
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
1141
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
1142
|
+
*
|
|
1143
|
+
* @param date - The original date
|
|
1144
|
+
* @param options - An object with options
|
|
1145
|
+
*
|
|
1146
|
+
* @returns The start of an ISO week-numbering year
|
|
1147
|
+
*
|
|
1148
|
+
* @example
|
|
1149
|
+
* // The start of an ISO week-numbering year for 2 July 2005:
|
|
1150
|
+
* const result = startOfISOWeekYear(new Date(2005, 6, 2))
|
|
1151
|
+
* //=> Mon Jan 03 2005 00:00:00
|
|
1152
|
+
*/
|
|
1153
|
+
function startOfISOWeekYear(date, options) {
|
|
1154
|
+
const year = getISOWeekYear(date, options);
|
|
1155
|
+
const fourthOfJanuary = constructFrom(options?.in || date, 0);
|
|
1156
|
+
fourthOfJanuary.setFullYear(year, 0, 4);
|
|
1157
|
+
fourthOfJanuary.setHours(0, 0, 0, 0);
|
|
1158
|
+
return startOfISOWeek(fourthOfJanuary);
|
|
1159
|
+
}
|
|
1160
|
+
//#endregion
|
|
1161
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISOWeek.js
|
|
1162
|
+
/**
|
|
1163
|
+
* The {@link getISOWeek} function options.
|
|
1164
|
+
*/
|
|
1165
|
+
/**
|
|
1166
|
+
* @name getISOWeek
|
|
1167
|
+
* @category ISO Week Helpers
|
|
1168
|
+
* @summary Get the ISO week of the given date.
|
|
1169
|
+
*
|
|
1170
|
+
* @description
|
|
1171
|
+
* Get the ISO week of the given date.
|
|
1172
|
+
*
|
|
1173
|
+
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
1174
|
+
*
|
|
1175
|
+
* @param date - The given date
|
|
1176
|
+
* @param options - The options
|
|
1177
|
+
*
|
|
1178
|
+
* @returns The ISO week
|
|
1179
|
+
*
|
|
1180
|
+
* @example
|
|
1181
|
+
* // Which week of the ISO-week numbering year is 2 January 2005?
|
|
1182
|
+
* const result = getISOWeek(new Date(2005, 0, 2))
|
|
1183
|
+
* //=> 53
|
|
1184
|
+
*/
|
|
1185
|
+
function getISOWeek(date, options) {
|
|
1186
|
+
const _date = toDate(date, options?.in);
|
|
1187
|
+
const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
|
|
1188
|
+
return Math.round(diff / millisecondsInWeek) + 1;
|
|
1189
|
+
}
|
|
1190
|
+
//#endregion
|
|
1191
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getWeekYear.js
|
|
1192
|
+
/**
|
|
1193
|
+
* The {@link getWeekYear} function options.
|
|
1194
|
+
*/
|
|
1195
|
+
/**
|
|
1196
|
+
* @name getWeekYear
|
|
1197
|
+
* @category Week-Numbering Year Helpers
|
|
1198
|
+
* @summary Get the local week-numbering year of the given date.
|
|
1199
|
+
*
|
|
1200
|
+
* @description
|
|
1201
|
+
* Get the local week-numbering year of the given date.
|
|
1202
|
+
* The exact calculation depends on the values of
|
|
1203
|
+
* `options.weekStartsOn` (which is the index of the first day of the week)
|
|
1204
|
+
* and `options.firstWeekContainsDate` (which is the day of January, which is always in
|
|
1205
|
+
* the first week of the week-numbering year)
|
|
1206
|
+
*
|
|
1207
|
+
* Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
|
|
1208
|
+
*
|
|
1209
|
+
* @param date - The given date
|
|
1210
|
+
* @param options - An object with options.
|
|
1211
|
+
*
|
|
1212
|
+
* @returns The local week-numbering year
|
|
1213
|
+
*
|
|
1214
|
+
* @example
|
|
1215
|
+
* // Which week numbering year is 26 December 2004 with the default settings?
|
|
1216
|
+
* const result = getWeekYear(new Date(2004, 11, 26))
|
|
1217
|
+
* //=> 2005
|
|
1218
|
+
*
|
|
1219
|
+
* @example
|
|
1220
|
+
* // Which week numbering year is 26 December 2004 if week starts on Saturday?
|
|
1221
|
+
* const result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 })
|
|
1222
|
+
* //=> 2004
|
|
1223
|
+
*
|
|
1224
|
+
* @example
|
|
1225
|
+
* // Which week numbering year is 26 December 2004 if the first week contains 4 January?
|
|
1226
|
+
* const result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 })
|
|
1227
|
+
* //=> 2004
|
|
1228
|
+
*/
|
|
1229
|
+
function getWeekYear(date, options) {
|
|
1230
|
+
const _date = toDate(date, options?.in);
|
|
1231
|
+
const year = _date.getFullYear();
|
|
1232
|
+
const defaultOptions = getDefaultOptions$1();
|
|
1233
|
+
const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1;
|
|
1234
|
+
const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
|
|
1235
|
+
firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
|
|
1236
|
+
firstWeekOfNextYear.setHours(0, 0, 0, 0);
|
|
1237
|
+
const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
|
|
1238
|
+
const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
|
|
1239
|
+
firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
|
|
1240
|
+
firstWeekOfThisYear.setHours(0, 0, 0, 0);
|
|
1241
|
+
const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
|
|
1242
|
+
if (+_date >= +startOfNextYear) return year + 1;
|
|
1243
|
+
else if (+_date >= +startOfThisYear) return year;
|
|
1244
|
+
else return year - 1;
|
|
1245
|
+
}
|
|
1246
|
+
//#endregion
|
|
1247
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfWeekYear.js
|
|
1248
|
+
/**
|
|
1249
|
+
* The {@link startOfWeekYear} function options.
|
|
1250
|
+
*/
|
|
1251
|
+
/**
|
|
1252
|
+
* @name startOfWeekYear
|
|
1253
|
+
* @category Week-Numbering Year Helpers
|
|
1254
|
+
* @summary Return the start of a local week-numbering year for the given date.
|
|
1255
|
+
*
|
|
1256
|
+
* @description
|
|
1257
|
+
* Return the start of a local week-numbering year.
|
|
1258
|
+
* The exact calculation depends on the values of
|
|
1259
|
+
* `options.weekStartsOn` (which is the index of the first day of the week)
|
|
1260
|
+
* and `options.firstWeekContainsDate` (which is the day of January, which is always in
|
|
1261
|
+
* the first week of the week-numbering year)
|
|
1262
|
+
*
|
|
1263
|
+
* Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
|
|
1264
|
+
*
|
|
1265
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
1266
|
+
* @typeParam ResultDate - The result `Date` type.
|
|
1267
|
+
*
|
|
1268
|
+
* @param date - The original date
|
|
1269
|
+
* @param options - An object with options
|
|
1270
|
+
*
|
|
1271
|
+
* @returns The start of a week-numbering year
|
|
1272
|
+
*
|
|
1273
|
+
* @example
|
|
1274
|
+
* // The start of an a week-numbering year for 2 July 2005 with default settings:
|
|
1275
|
+
* const result = startOfWeekYear(new Date(2005, 6, 2))
|
|
1276
|
+
* //=> Sun Dec 26 2004 00:00:00
|
|
1277
|
+
*
|
|
1278
|
+
* @example
|
|
1279
|
+
* // The start of a week-numbering year for 2 July 2005
|
|
1280
|
+
* // if Monday is the first day of week
|
|
1281
|
+
* // and 4 January is always in the first week of the year:
|
|
1282
|
+
* const result = startOfWeekYear(new Date(2005, 6, 2), {
|
|
1283
|
+
* weekStartsOn: 1,
|
|
1284
|
+
* firstWeekContainsDate: 4
|
|
1285
|
+
* })
|
|
1286
|
+
* //=> Mon Jan 03 2005 00:00:00
|
|
1287
|
+
*/
|
|
1288
|
+
function startOfWeekYear(date, options) {
|
|
1289
|
+
const defaultOptions = getDefaultOptions$1();
|
|
1290
|
+
const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1;
|
|
1291
|
+
const year = getWeekYear(date, options);
|
|
1292
|
+
const firstWeek = constructFrom(options?.in || date, 0);
|
|
1293
|
+
firstWeek.setFullYear(year, 0, firstWeekContainsDate);
|
|
1294
|
+
firstWeek.setHours(0, 0, 0, 0);
|
|
1295
|
+
return startOfWeek(firstWeek, options);
|
|
1296
|
+
}
|
|
1297
|
+
//#endregion
|
|
1298
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getWeek.js
|
|
1299
|
+
/**
|
|
1300
|
+
* The {@link getWeek} function options.
|
|
1301
|
+
*/
|
|
1302
|
+
/**
|
|
1303
|
+
* @name getWeek
|
|
1304
|
+
* @category Week Helpers
|
|
1305
|
+
* @summary Get the local week index of the given date.
|
|
1306
|
+
*
|
|
1307
|
+
* @description
|
|
1308
|
+
* Get the local week index of the given date.
|
|
1309
|
+
* The exact calculation depends on the values of
|
|
1310
|
+
* `options.weekStartsOn` (which is the index of the first day of the week)
|
|
1311
|
+
* and `options.firstWeekContainsDate` (which is the day of January, which is always in
|
|
1312
|
+
* the first week of the week-numbering year)
|
|
1313
|
+
*
|
|
1314
|
+
* Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
|
|
1315
|
+
*
|
|
1316
|
+
* @param date - The given date
|
|
1317
|
+
* @param options - An object with options
|
|
1318
|
+
*
|
|
1319
|
+
* @returns The week
|
|
1320
|
+
*
|
|
1321
|
+
* @example
|
|
1322
|
+
* // Which week of the local week numbering year is 2 January 2005 with default options?
|
|
1323
|
+
* const result = getWeek(new Date(2005, 0, 2))
|
|
1324
|
+
* //=> 2
|
|
1325
|
+
*
|
|
1326
|
+
* @example
|
|
1327
|
+
* // Which week of the local week numbering year is 2 January 2005,
|
|
1328
|
+
* // if Monday is the first day of the week,
|
|
1329
|
+
* // and the first week of the year always contains 4 January?
|
|
1330
|
+
* const result = getWeek(new Date(2005, 0, 2), {
|
|
1331
|
+
* weekStartsOn: 1,
|
|
1332
|
+
* firstWeekContainsDate: 4
|
|
1333
|
+
* })
|
|
1334
|
+
* //=> 53
|
|
1335
|
+
*/
|
|
1336
|
+
function getWeek(date, options) {
|
|
1337
|
+
const _date = toDate(date, options?.in);
|
|
1338
|
+
const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
|
|
1339
|
+
return Math.round(diff / millisecondsInWeek) + 1;
|
|
1340
|
+
}
|
|
1341
|
+
//#endregion
|
|
1342
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/format/lightFormatters.js
|
|
1343
|
+
var lightFormatters = {
|
|
1344
|
+
y(date, token) {
|
|
1345
|
+
const signedYear = date.getFullYear();
|
|
1346
|
+
const year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
1347
|
+
return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
|
|
1348
|
+
},
|
|
1349
|
+
M(date, token) {
|
|
1350
|
+
const month = date.getMonth();
|
|
1351
|
+
return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
|
|
1352
|
+
},
|
|
1353
|
+
d(date, token) {
|
|
1354
|
+
return addLeadingZeros(date.getDate(), token.length);
|
|
1355
|
+
},
|
|
1356
|
+
a(date, token) {
|
|
1357
|
+
const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
|
|
1358
|
+
switch (token) {
|
|
1359
|
+
case "a":
|
|
1360
|
+
case "aa": return dayPeriodEnumValue.toUpperCase();
|
|
1361
|
+
case "aaa": return dayPeriodEnumValue;
|
|
1362
|
+
case "aaaaa": return dayPeriodEnumValue[0];
|
|
1363
|
+
default: return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
|
|
1364
|
+
}
|
|
1365
|
+
},
|
|
1366
|
+
h(date, token) {
|
|
1367
|
+
return addLeadingZeros(date.getHours() % 12 || 12, token.length);
|
|
1368
|
+
},
|
|
1369
|
+
H(date, token) {
|
|
1370
|
+
return addLeadingZeros(date.getHours(), token.length);
|
|
1371
|
+
},
|
|
1372
|
+
m(date, token) {
|
|
1373
|
+
return addLeadingZeros(date.getMinutes(), token.length);
|
|
1374
|
+
},
|
|
1375
|
+
s(date, token) {
|
|
1376
|
+
return addLeadingZeros(date.getSeconds(), token.length);
|
|
1377
|
+
},
|
|
1378
|
+
S(date, token) {
|
|
1379
|
+
const numberOfDigits = token.length;
|
|
1380
|
+
const milliseconds = date.getMilliseconds();
|
|
1381
|
+
return addLeadingZeros(Math.trunc(milliseconds * Math.pow(10, numberOfDigits - 3)), token.length);
|
|
1382
|
+
}
|
|
1383
|
+
};
|
|
1384
|
+
//#endregion
|
|
1385
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/format/formatters.js
|
|
1386
|
+
var dayPeriodEnum = {
|
|
1387
|
+
am: "am",
|
|
1388
|
+
pm: "pm",
|
|
1389
|
+
midnight: "midnight",
|
|
1390
|
+
noon: "noon",
|
|
1391
|
+
morning: "morning",
|
|
1392
|
+
afternoon: "afternoon",
|
|
1393
|
+
evening: "evening",
|
|
1394
|
+
night: "night"
|
|
1395
|
+
};
|
|
1396
|
+
var formatters = {
|
|
1397
|
+
G: function(date, token, localize) {
|
|
1398
|
+
const era = date.getFullYear() > 0 ? 1 : 0;
|
|
1399
|
+
switch (token) {
|
|
1400
|
+
case "G":
|
|
1401
|
+
case "GG":
|
|
1402
|
+
case "GGG": return localize.era(era, { width: "abbreviated" });
|
|
1403
|
+
case "GGGGG": return localize.era(era, { width: "narrow" });
|
|
1404
|
+
default: return localize.era(era, { width: "wide" });
|
|
1405
|
+
}
|
|
1406
|
+
},
|
|
1407
|
+
y: function(date, token, localize) {
|
|
1408
|
+
if (token === "yo") {
|
|
1409
|
+
const signedYear = date.getFullYear();
|
|
1410
|
+
const year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
1411
|
+
return localize.ordinalNumber(year, { unit: "year" });
|
|
1412
|
+
}
|
|
1413
|
+
return lightFormatters.y(date, token);
|
|
1414
|
+
},
|
|
1415
|
+
Y: function(date, token, localize, options) {
|
|
1416
|
+
const signedWeekYear = getWeekYear(date, options);
|
|
1417
|
+
const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
|
|
1418
|
+
if (token === "YY") return addLeadingZeros(weekYear % 100, 2);
|
|
1419
|
+
if (token === "Yo") return localize.ordinalNumber(weekYear, { unit: "year" });
|
|
1420
|
+
return addLeadingZeros(weekYear, token.length);
|
|
1421
|
+
},
|
|
1422
|
+
R: function(date, token) {
|
|
1423
|
+
return addLeadingZeros(getISOWeekYear(date), token.length);
|
|
1424
|
+
},
|
|
1425
|
+
u: function(date, token) {
|
|
1426
|
+
return addLeadingZeros(date.getFullYear(), token.length);
|
|
1427
|
+
},
|
|
1428
|
+
Q: function(date, token, localize) {
|
|
1429
|
+
const quarter = Math.ceil((date.getMonth() + 1) / 3);
|
|
1430
|
+
switch (token) {
|
|
1431
|
+
case "Q": return String(quarter);
|
|
1432
|
+
case "QQ": return addLeadingZeros(quarter, 2);
|
|
1433
|
+
case "Qo": return localize.ordinalNumber(quarter, { unit: "quarter" });
|
|
1434
|
+
case "QQQ": return localize.quarter(quarter, {
|
|
1435
|
+
width: "abbreviated",
|
|
1436
|
+
context: "formatting"
|
|
1437
|
+
});
|
|
1438
|
+
case "QQQQQ": return localize.quarter(quarter, {
|
|
1439
|
+
width: "narrow",
|
|
1440
|
+
context: "formatting"
|
|
1441
|
+
});
|
|
1442
|
+
default: return localize.quarter(quarter, {
|
|
1443
|
+
width: "wide",
|
|
1444
|
+
context: "formatting"
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1447
|
+
},
|
|
1448
|
+
q: function(date, token, localize) {
|
|
1449
|
+
const quarter = Math.ceil((date.getMonth() + 1) / 3);
|
|
1450
|
+
switch (token) {
|
|
1451
|
+
case "q": return String(quarter);
|
|
1452
|
+
case "qq": return addLeadingZeros(quarter, 2);
|
|
1453
|
+
case "qo": return localize.ordinalNumber(quarter, { unit: "quarter" });
|
|
1454
|
+
case "qqq": return localize.quarter(quarter, {
|
|
1455
|
+
width: "abbreviated",
|
|
1456
|
+
context: "standalone"
|
|
1457
|
+
});
|
|
1458
|
+
case "qqqqq": return localize.quarter(quarter, {
|
|
1459
|
+
width: "narrow",
|
|
1460
|
+
context: "standalone"
|
|
1461
|
+
});
|
|
1462
|
+
default: return localize.quarter(quarter, {
|
|
1463
|
+
width: "wide",
|
|
1464
|
+
context: "standalone"
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
},
|
|
1468
|
+
M: function(date, token, localize) {
|
|
1469
|
+
const month = date.getMonth();
|
|
1470
|
+
switch (token) {
|
|
1471
|
+
case "M":
|
|
1472
|
+
case "MM": return lightFormatters.M(date, token);
|
|
1473
|
+
case "Mo": return localize.ordinalNumber(month + 1, { unit: "month" });
|
|
1474
|
+
case "MMM": return localize.month(month, {
|
|
1475
|
+
width: "abbreviated",
|
|
1476
|
+
context: "formatting"
|
|
1477
|
+
});
|
|
1478
|
+
case "MMMMM": return localize.month(month, {
|
|
1479
|
+
width: "narrow",
|
|
1480
|
+
context: "formatting"
|
|
1481
|
+
});
|
|
1482
|
+
default: return localize.month(month, {
|
|
1483
|
+
width: "wide",
|
|
1484
|
+
context: "formatting"
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
},
|
|
1488
|
+
L: function(date, token, localize) {
|
|
1489
|
+
const month = date.getMonth();
|
|
1490
|
+
switch (token) {
|
|
1491
|
+
case "L": return String(month + 1);
|
|
1492
|
+
case "LL": return addLeadingZeros(month + 1, 2);
|
|
1493
|
+
case "Lo": return localize.ordinalNumber(month + 1, { unit: "month" });
|
|
1494
|
+
case "LLL": return localize.month(month, {
|
|
1495
|
+
width: "abbreviated",
|
|
1496
|
+
context: "standalone"
|
|
1497
|
+
});
|
|
1498
|
+
case "LLLLL": return localize.month(month, {
|
|
1499
|
+
width: "narrow",
|
|
1500
|
+
context: "standalone"
|
|
1501
|
+
});
|
|
1502
|
+
default: return localize.month(month, {
|
|
1503
|
+
width: "wide",
|
|
1504
|
+
context: "standalone"
|
|
1505
|
+
});
|
|
1506
|
+
}
|
|
1507
|
+
},
|
|
1508
|
+
w: function(date, token, localize, options) {
|
|
1509
|
+
const week = getWeek(date, options);
|
|
1510
|
+
if (token === "wo") return localize.ordinalNumber(week, { unit: "week" });
|
|
1511
|
+
return addLeadingZeros(week, token.length);
|
|
1512
|
+
},
|
|
1513
|
+
I: function(date, token, localize) {
|
|
1514
|
+
const isoWeek = getISOWeek(date);
|
|
1515
|
+
if (token === "Io") return localize.ordinalNumber(isoWeek, { unit: "week" });
|
|
1516
|
+
return addLeadingZeros(isoWeek, token.length);
|
|
1517
|
+
},
|
|
1518
|
+
d: function(date, token, localize) {
|
|
1519
|
+
if (token === "do") return localize.ordinalNumber(date.getDate(), { unit: "date" });
|
|
1520
|
+
return lightFormatters.d(date, token);
|
|
1521
|
+
},
|
|
1522
|
+
D: function(date, token, localize) {
|
|
1523
|
+
const dayOfYear = getDayOfYear(date);
|
|
1524
|
+
if (token === "Do") return localize.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
|
|
1525
|
+
return addLeadingZeros(dayOfYear, token.length);
|
|
1526
|
+
},
|
|
1527
|
+
E: function(date, token, localize) {
|
|
1528
|
+
const dayOfWeek = date.getDay();
|
|
1529
|
+
switch (token) {
|
|
1530
|
+
case "E":
|
|
1531
|
+
case "EE":
|
|
1532
|
+
case "EEE": return localize.day(dayOfWeek, {
|
|
1533
|
+
width: "abbreviated",
|
|
1534
|
+
context: "formatting"
|
|
1535
|
+
});
|
|
1536
|
+
case "EEEEE": return localize.day(dayOfWeek, {
|
|
1537
|
+
width: "narrow",
|
|
1538
|
+
context: "formatting"
|
|
1539
|
+
});
|
|
1540
|
+
case "EEEEEE": return localize.day(dayOfWeek, {
|
|
1541
|
+
width: "short",
|
|
1542
|
+
context: "formatting"
|
|
1543
|
+
});
|
|
1544
|
+
default: return localize.day(dayOfWeek, {
|
|
1545
|
+
width: "wide",
|
|
1546
|
+
context: "formatting"
|
|
1547
|
+
});
|
|
1548
|
+
}
|
|
1549
|
+
},
|
|
1550
|
+
e: function(date, token, localize, options) {
|
|
1551
|
+
const dayOfWeek = date.getDay();
|
|
1552
|
+
const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
1553
|
+
switch (token) {
|
|
1554
|
+
case "e": return String(localDayOfWeek);
|
|
1555
|
+
case "ee": return addLeadingZeros(localDayOfWeek, 2);
|
|
1556
|
+
case "eo": return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
|
|
1557
|
+
case "eee": return localize.day(dayOfWeek, {
|
|
1558
|
+
width: "abbreviated",
|
|
1559
|
+
context: "formatting"
|
|
1560
|
+
});
|
|
1561
|
+
case "eeeee": return localize.day(dayOfWeek, {
|
|
1562
|
+
width: "narrow",
|
|
1563
|
+
context: "formatting"
|
|
1564
|
+
});
|
|
1565
|
+
case "eeeeee": return localize.day(dayOfWeek, {
|
|
1566
|
+
width: "short",
|
|
1567
|
+
context: "formatting"
|
|
1568
|
+
});
|
|
1569
|
+
default: return localize.day(dayOfWeek, {
|
|
1570
|
+
width: "wide",
|
|
1571
|
+
context: "formatting"
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1574
|
+
},
|
|
1575
|
+
c: function(date, token, localize, options) {
|
|
1576
|
+
const dayOfWeek = date.getDay();
|
|
1577
|
+
const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
1578
|
+
switch (token) {
|
|
1579
|
+
case "c": return String(localDayOfWeek);
|
|
1580
|
+
case "cc": return addLeadingZeros(localDayOfWeek, token.length);
|
|
1581
|
+
case "co": return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
|
|
1582
|
+
case "ccc": return localize.day(dayOfWeek, {
|
|
1583
|
+
width: "abbreviated",
|
|
1584
|
+
context: "standalone"
|
|
1585
|
+
});
|
|
1586
|
+
case "ccccc": return localize.day(dayOfWeek, {
|
|
1587
|
+
width: "narrow",
|
|
1588
|
+
context: "standalone"
|
|
1589
|
+
});
|
|
1590
|
+
case "cccccc": return localize.day(dayOfWeek, {
|
|
1591
|
+
width: "short",
|
|
1592
|
+
context: "standalone"
|
|
1593
|
+
});
|
|
1594
|
+
default: return localize.day(dayOfWeek, {
|
|
1595
|
+
width: "wide",
|
|
1596
|
+
context: "standalone"
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
},
|
|
1600
|
+
i: function(date, token, localize) {
|
|
1601
|
+
const dayOfWeek = date.getDay();
|
|
1602
|
+
const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
|
|
1603
|
+
switch (token) {
|
|
1604
|
+
case "i": return String(isoDayOfWeek);
|
|
1605
|
+
case "ii": return addLeadingZeros(isoDayOfWeek, token.length);
|
|
1606
|
+
case "io": return localize.ordinalNumber(isoDayOfWeek, { unit: "day" });
|
|
1607
|
+
case "iii": return localize.day(dayOfWeek, {
|
|
1608
|
+
width: "abbreviated",
|
|
1609
|
+
context: "formatting"
|
|
1610
|
+
});
|
|
1611
|
+
case "iiiii": return localize.day(dayOfWeek, {
|
|
1612
|
+
width: "narrow",
|
|
1613
|
+
context: "formatting"
|
|
1614
|
+
});
|
|
1615
|
+
case "iiiiii": return localize.day(dayOfWeek, {
|
|
1616
|
+
width: "short",
|
|
1617
|
+
context: "formatting"
|
|
1618
|
+
});
|
|
1619
|
+
default: return localize.day(dayOfWeek, {
|
|
1620
|
+
width: "wide",
|
|
1621
|
+
context: "formatting"
|
|
1622
|
+
});
|
|
1623
|
+
}
|
|
1624
|
+
},
|
|
1625
|
+
a: function(date, token, localize) {
|
|
1626
|
+
const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
|
|
1627
|
+
switch (token) {
|
|
1628
|
+
case "a":
|
|
1629
|
+
case "aa": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1630
|
+
width: "abbreviated",
|
|
1631
|
+
context: "formatting"
|
|
1632
|
+
});
|
|
1633
|
+
case "aaa": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1634
|
+
width: "abbreviated",
|
|
1635
|
+
context: "formatting"
|
|
1636
|
+
}).toLowerCase();
|
|
1637
|
+
case "aaaaa": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1638
|
+
width: "narrow",
|
|
1639
|
+
context: "formatting"
|
|
1640
|
+
});
|
|
1641
|
+
default: return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1642
|
+
width: "wide",
|
|
1643
|
+
context: "formatting"
|
|
1644
|
+
});
|
|
1645
|
+
}
|
|
1646
|
+
},
|
|
1647
|
+
b: function(date, token, localize) {
|
|
1648
|
+
const hours = date.getHours();
|
|
1649
|
+
let dayPeriodEnumValue;
|
|
1650
|
+
if (hours === 12) dayPeriodEnumValue = dayPeriodEnum.noon;
|
|
1651
|
+
else if (hours === 0) dayPeriodEnumValue = dayPeriodEnum.midnight;
|
|
1652
|
+
else dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
|
|
1653
|
+
switch (token) {
|
|
1654
|
+
case "b":
|
|
1655
|
+
case "bb": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1656
|
+
width: "abbreviated",
|
|
1657
|
+
context: "formatting"
|
|
1658
|
+
});
|
|
1659
|
+
case "bbb": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1660
|
+
width: "abbreviated",
|
|
1661
|
+
context: "formatting"
|
|
1662
|
+
}).toLowerCase();
|
|
1663
|
+
case "bbbbb": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1664
|
+
width: "narrow",
|
|
1665
|
+
context: "formatting"
|
|
1666
|
+
});
|
|
1667
|
+
default: return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1668
|
+
width: "wide",
|
|
1669
|
+
context: "formatting"
|
|
1670
|
+
});
|
|
1671
|
+
}
|
|
1672
|
+
},
|
|
1673
|
+
B: function(date, token, localize) {
|
|
1674
|
+
const hours = date.getHours();
|
|
1675
|
+
let dayPeriodEnumValue;
|
|
1676
|
+
if (hours >= 17) dayPeriodEnumValue = dayPeriodEnum.evening;
|
|
1677
|
+
else if (hours >= 12) dayPeriodEnumValue = dayPeriodEnum.afternoon;
|
|
1678
|
+
else if (hours >= 4) dayPeriodEnumValue = dayPeriodEnum.morning;
|
|
1679
|
+
else dayPeriodEnumValue = dayPeriodEnum.night;
|
|
1680
|
+
switch (token) {
|
|
1681
|
+
case "B":
|
|
1682
|
+
case "BB":
|
|
1683
|
+
case "BBB": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1684
|
+
width: "abbreviated",
|
|
1685
|
+
context: "formatting"
|
|
1686
|
+
});
|
|
1687
|
+
case "BBBBB": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1688
|
+
width: "narrow",
|
|
1689
|
+
context: "formatting"
|
|
1690
|
+
});
|
|
1691
|
+
default: return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1692
|
+
width: "wide",
|
|
1693
|
+
context: "formatting"
|
|
1694
|
+
});
|
|
1695
|
+
}
|
|
1696
|
+
},
|
|
1697
|
+
h: function(date, token, localize) {
|
|
1698
|
+
if (token === "ho") {
|
|
1699
|
+
let hours = date.getHours() % 12;
|
|
1700
|
+
if (hours === 0) hours = 12;
|
|
1701
|
+
return localize.ordinalNumber(hours, { unit: "hour" });
|
|
1702
|
+
}
|
|
1703
|
+
return lightFormatters.h(date, token);
|
|
1704
|
+
},
|
|
1705
|
+
H: function(date, token, localize) {
|
|
1706
|
+
if (token === "Ho") return localize.ordinalNumber(date.getHours(), { unit: "hour" });
|
|
1707
|
+
return lightFormatters.H(date, token);
|
|
1708
|
+
},
|
|
1709
|
+
K: function(date, token, localize) {
|
|
1710
|
+
const hours = date.getHours() % 12;
|
|
1711
|
+
if (token === "Ko") return localize.ordinalNumber(hours, { unit: "hour" });
|
|
1712
|
+
return addLeadingZeros(hours, token.length);
|
|
1713
|
+
},
|
|
1714
|
+
k: function(date, token, localize) {
|
|
1715
|
+
let hours = date.getHours();
|
|
1716
|
+
if (hours === 0) hours = 24;
|
|
1717
|
+
if (token === "ko") return localize.ordinalNumber(hours, { unit: "hour" });
|
|
1718
|
+
return addLeadingZeros(hours, token.length);
|
|
1719
|
+
},
|
|
1720
|
+
m: function(date, token, localize) {
|
|
1721
|
+
if (token === "mo") return localize.ordinalNumber(date.getMinutes(), { unit: "minute" });
|
|
1722
|
+
return lightFormatters.m(date, token);
|
|
1723
|
+
},
|
|
1724
|
+
s: function(date, token, localize) {
|
|
1725
|
+
if (token === "so") return localize.ordinalNumber(date.getSeconds(), { unit: "second" });
|
|
1726
|
+
return lightFormatters.s(date, token);
|
|
1727
|
+
},
|
|
1728
|
+
S: function(date, token) {
|
|
1729
|
+
return lightFormatters.S(date, token);
|
|
1730
|
+
},
|
|
1731
|
+
X: function(date, token, _localize) {
|
|
1732
|
+
const timezoneOffset = date.getTimezoneOffset();
|
|
1733
|
+
if (timezoneOffset === 0) return "Z";
|
|
1734
|
+
switch (token) {
|
|
1735
|
+
case "X": return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
1736
|
+
case "XXXX":
|
|
1737
|
+
case "XX": return formatTimezone(timezoneOffset);
|
|
1738
|
+
default: return formatTimezone(timezoneOffset, ":");
|
|
1739
|
+
}
|
|
1740
|
+
},
|
|
1741
|
+
x: function(date, token, _localize) {
|
|
1742
|
+
const timezoneOffset = date.getTimezoneOffset();
|
|
1743
|
+
switch (token) {
|
|
1744
|
+
case "x": return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
1745
|
+
case "xxxx":
|
|
1746
|
+
case "xx": return formatTimezone(timezoneOffset);
|
|
1747
|
+
default: return formatTimezone(timezoneOffset, ":");
|
|
1748
|
+
}
|
|
1749
|
+
},
|
|
1750
|
+
O: function(date, token, _localize) {
|
|
1751
|
+
const timezoneOffset = date.getTimezoneOffset();
|
|
1752
|
+
switch (token) {
|
|
1753
|
+
case "O":
|
|
1754
|
+
case "OO":
|
|
1755
|
+
case "OOO": return "GMT" + formatTimezoneShort(timezoneOffset, ":");
|
|
1756
|
+
default: return "GMT" + formatTimezone(timezoneOffset, ":");
|
|
1757
|
+
}
|
|
1758
|
+
},
|
|
1759
|
+
z: function(date, token, _localize) {
|
|
1760
|
+
const timezoneOffset = date.getTimezoneOffset();
|
|
1761
|
+
switch (token) {
|
|
1762
|
+
case "z":
|
|
1763
|
+
case "zz":
|
|
1764
|
+
case "zzz": return "GMT" + formatTimezoneShort(timezoneOffset, ":");
|
|
1765
|
+
default: return "GMT" + formatTimezone(timezoneOffset, ":");
|
|
1766
|
+
}
|
|
1767
|
+
},
|
|
1768
|
+
t: function(date, token, _localize) {
|
|
1769
|
+
return addLeadingZeros(Math.trunc(+date / 1e3), token.length);
|
|
1770
|
+
},
|
|
1771
|
+
T: function(date, token, _localize) {
|
|
1772
|
+
return addLeadingZeros(+date, token.length);
|
|
1773
|
+
}
|
|
1774
|
+
};
|
|
1775
|
+
function formatTimezoneShort(offset, delimiter = "") {
|
|
1776
|
+
const sign = offset > 0 ? "-" : "+";
|
|
1777
|
+
const absOffset = Math.abs(offset);
|
|
1778
|
+
const hours = Math.trunc(absOffset / 60);
|
|
1779
|
+
const minutes = absOffset % 60;
|
|
1780
|
+
if (minutes === 0) return sign + String(hours);
|
|
1781
|
+
return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
|
|
1782
|
+
}
|
|
1783
|
+
function formatTimezoneWithOptionalMinutes(offset, delimiter) {
|
|
1784
|
+
if (offset % 60 === 0) return (offset > 0 ? "-" : "+") + addLeadingZeros(Math.abs(offset) / 60, 2);
|
|
1785
|
+
return formatTimezone(offset, delimiter);
|
|
1786
|
+
}
|
|
1787
|
+
function formatTimezone(offset, delimiter = "") {
|
|
1788
|
+
const sign = offset > 0 ? "-" : "+";
|
|
1789
|
+
const absOffset = Math.abs(offset);
|
|
1790
|
+
const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
|
|
1791
|
+
const minutes = addLeadingZeros(absOffset % 60, 2);
|
|
1792
|
+
return sign + hours + delimiter + minutes;
|
|
1793
|
+
}
|
|
1794
|
+
//#endregion
|
|
1795
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/format/longFormatters.js
|
|
1796
|
+
var dateLongFormatter = (pattern, formatLong) => {
|
|
1797
|
+
switch (pattern) {
|
|
1798
|
+
case "P": return formatLong.date({ width: "short" });
|
|
1799
|
+
case "PP": return formatLong.date({ width: "medium" });
|
|
1800
|
+
case "PPP": return formatLong.date({ width: "long" });
|
|
1801
|
+
default: return formatLong.date({ width: "full" });
|
|
1802
|
+
}
|
|
1803
|
+
};
|
|
1804
|
+
var timeLongFormatter = (pattern, formatLong) => {
|
|
1805
|
+
switch (pattern) {
|
|
1806
|
+
case "p": return formatLong.time({ width: "short" });
|
|
1807
|
+
case "pp": return formatLong.time({ width: "medium" });
|
|
1808
|
+
case "ppp": return formatLong.time({ width: "long" });
|
|
1809
|
+
default: return formatLong.time({ width: "full" });
|
|
1810
|
+
}
|
|
1811
|
+
};
|
|
1812
|
+
var dateTimeLongFormatter = (pattern, formatLong) => {
|
|
1813
|
+
const matchResult = pattern.match(/(P+)(p+)?/) || [];
|
|
1814
|
+
const datePattern = matchResult[1];
|
|
1815
|
+
const timePattern = matchResult[2];
|
|
1816
|
+
if (!timePattern) return dateLongFormatter(pattern, formatLong);
|
|
1817
|
+
let dateTimeFormat;
|
|
1818
|
+
switch (datePattern) {
|
|
1819
|
+
case "P":
|
|
1820
|
+
dateTimeFormat = formatLong.dateTime({ width: "short" });
|
|
1821
|
+
break;
|
|
1822
|
+
case "PP":
|
|
1823
|
+
dateTimeFormat = formatLong.dateTime({ width: "medium" });
|
|
1824
|
+
break;
|
|
1825
|
+
case "PPP":
|
|
1826
|
+
dateTimeFormat = formatLong.dateTime({ width: "long" });
|
|
1827
|
+
break;
|
|
1828
|
+
default:
|
|
1829
|
+
dateTimeFormat = formatLong.dateTime({ width: "full" });
|
|
1830
|
+
break;
|
|
1831
|
+
}
|
|
1832
|
+
return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong)).replace("{{time}}", timeLongFormatter(timePattern, formatLong));
|
|
1833
|
+
};
|
|
1834
|
+
var longFormatters = {
|
|
1835
|
+
p: timeLongFormatter,
|
|
1836
|
+
P: dateTimeLongFormatter
|
|
1837
|
+
};
|
|
1838
|
+
//#endregion
|
|
1839
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/protectedTokens.js
|
|
1840
|
+
var dayOfYearTokenRE = /^D+$/;
|
|
1841
|
+
var weekYearTokenRE = /^Y+$/;
|
|
1842
|
+
var throwTokens = [
|
|
1843
|
+
"D",
|
|
1844
|
+
"DD",
|
|
1845
|
+
"YY",
|
|
1846
|
+
"YYYY"
|
|
1847
|
+
];
|
|
1848
|
+
function isProtectedDayOfYearToken(token) {
|
|
1849
|
+
return dayOfYearTokenRE.test(token);
|
|
1850
|
+
}
|
|
1851
|
+
function isProtectedWeekYearToken(token) {
|
|
1852
|
+
return weekYearTokenRE.test(token);
|
|
1853
|
+
}
|
|
1854
|
+
function warnOrThrowProtectedError(token, format, input) {
|
|
1855
|
+
const _message = message(token, format, input);
|
|
1856
|
+
console.warn(_message);
|
|
1857
|
+
if (throwTokens.includes(token)) throw new RangeError(_message);
|
|
1858
|
+
}
|
|
1859
|
+
function message(token, format, input) {
|
|
1860
|
+
const subject = token[0] === "Y" ? "years" : "days of the month";
|
|
1861
|
+
return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
|
1862
|
+
}
|
|
1863
|
+
//#endregion
|
|
1864
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isDate.js
|
|
1865
|
+
/**
|
|
1866
|
+
* @name isDate
|
|
1867
|
+
* @category Common Helpers
|
|
1868
|
+
* @summary Is the given value a date?
|
|
1869
|
+
*
|
|
1870
|
+
* @description
|
|
1871
|
+
* Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
|
|
1872
|
+
*
|
|
1873
|
+
* @param value - The value to check
|
|
1874
|
+
*
|
|
1875
|
+
* @returns True if the given value is a date
|
|
1876
|
+
*
|
|
1877
|
+
* @example
|
|
1878
|
+
* // For a valid date:
|
|
1879
|
+
* const result = isDate(new Date())
|
|
1880
|
+
* //=> true
|
|
1881
|
+
*
|
|
1882
|
+
* @example
|
|
1883
|
+
* // For an invalid date:
|
|
1884
|
+
* const result = isDate(new Date(NaN))
|
|
1885
|
+
* //=> true
|
|
1886
|
+
*
|
|
1887
|
+
* @example
|
|
1888
|
+
* // For some value:
|
|
1889
|
+
* const result = isDate('2014-02-31')
|
|
1890
|
+
* //=> false
|
|
1891
|
+
*
|
|
1892
|
+
* @example
|
|
1893
|
+
* // For an object:
|
|
1894
|
+
* const result = isDate({})
|
|
1895
|
+
* //=> false
|
|
1896
|
+
*/
|
|
1897
|
+
function isDate(value) {
|
|
1898
|
+
return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
|
|
1899
|
+
}
|
|
1900
|
+
//#endregion
|
|
1901
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isValid.js
|
|
1902
|
+
/**
|
|
1903
|
+
* @name isValid
|
|
1904
|
+
* @category Common Helpers
|
|
1905
|
+
* @summary Is the given date valid?
|
|
1906
|
+
*
|
|
1907
|
+
* @description
|
|
1908
|
+
* Returns false if argument is Invalid Date and true otherwise.
|
|
1909
|
+
* Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)
|
|
1910
|
+
* Invalid Date is a Date, whose time value is NaN.
|
|
1911
|
+
*
|
|
1912
|
+
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
|
1913
|
+
*
|
|
1914
|
+
* @param date - The date to check
|
|
1915
|
+
*
|
|
1916
|
+
* @returns The date is valid
|
|
1917
|
+
*
|
|
1918
|
+
* @example
|
|
1919
|
+
* // For the valid date:
|
|
1920
|
+
* const result = isValid(new Date(2014, 1, 31))
|
|
1921
|
+
* //=> true
|
|
1922
|
+
*
|
|
1923
|
+
* @example
|
|
1924
|
+
* // For the value, convertible into a date:
|
|
1925
|
+
* const result = isValid(1393804800000)
|
|
1926
|
+
* //=> true
|
|
1927
|
+
*
|
|
1928
|
+
* @example
|
|
1929
|
+
* // For the invalid date:
|
|
1930
|
+
* const result = isValid(new Date(''))
|
|
1931
|
+
* //=> false
|
|
1932
|
+
*/
|
|
1933
|
+
function isValid(date) {
|
|
1934
|
+
return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
|
|
1935
|
+
}
|
|
1936
|
+
//#endregion
|
|
1937
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/format.js
|
|
1938
|
+
var formattingTokensRegExp$1 = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
|
1939
|
+
var longFormattingTokensRegExp$1 = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
1940
|
+
var escapedStringRegExp$1 = /^'([^]*?)'?$/;
|
|
1941
|
+
var doubleQuoteRegExp$1 = /''/g;
|
|
1942
|
+
var unescapedLatinCharacterRegExp$1 = /[a-zA-Z]/;
|
|
1943
|
+
/**
|
|
1944
|
+
* The {@link format} function options.
|
|
1945
|
+
*/
|
|
1946
|
+
/**
|
|
1947
|
+
* @name format
|
|
1948
|
+
* @alias formatDate
|
|
1949
|
+
* @category Common Helpers
|
|
1950
|
+
* @summary Format the date.
|
|
1951
|
+
*
|
|
1952
|
+
* @description
|
|
1953
|
+
* Return the formatted date string in the given format. The result may vary by locale.
|
|
1954
|
+
*
|
|
1955
|
+
* > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
|
|
1956
|
+
* > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
1957
|
+
*
|
|
1958
|
+
* The characters wrapped between two single quotes characters (') are escaped.
|
|
1959
|
+
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
|
|
1960
|
+
* (see the last example)
|
|
1961
|
+
*
|
|
1962
|
+
* Format of the string is based on Unicode Technical Standard #35:
|
|
1963
|
+
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
1964
|
+
* with a few additions (see note 7 below the table).
|
|
1965
|
+
*
|
|
1966
|
+
* Accepted patterns:
|
|
1967
|
+
* | Unit | Pattern | Result examples | Notes |
|
|
1968
|
+
* |---------------------------------|---------|-----------------------------------|-------|
|
|
1969
|
+
* | Era | G..GGG | AD, BC | |
|
|
1970
|
+
* | | GGGG | Anno Domini, Before Christ | 2 |
|
|
1971
|
+
* | | GGGGG | A, B | |
|
|
1972
|
+
* | Calendar year | y | 44, 1, 1900, 2017 | 5 |
|
|
1973
|
+
* | | yo | 44th, 1st, 0th, 17th | 5,7 |
|
|
1974
|
+
* | | yy | 44, 01, 00, 17 | 5 |
|
|
1975
|
+
* | | yyy | 044, 001, 1900, 2017 | 5 |
|
|
1976
|
+
* | | yyyy | 0044, 0001, 1900, 2017 | 5 |
|
|
1977
|
+
* | | yyyyy | ... | 3,5 |
|
|
1978
|
+
* | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
|
|
1979
|
+
* | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
|
|
1980
|
+
* | | YY | 44, 01, 00, 17 | 5,8 |
|
|
1981
|
+
* | | YYY | 044, 001, 1900, 2017 | 5 |
|
|
1982
|
+
* | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
|
|
1983
|
+
* | | YYYYY | ... | 3,5 |
|
|
1984
|
+
* | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
|
|
1985
|
+
* | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
|
|
1986
|
+
* | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
|
|
1987
|
+
* | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
|
|
1988
|
+
* | | RRRRR | ... | 3,5,7 |
|
|
1989
|
+
* | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
|
|
1990
|
+
* | | uu | -43, 01, 1900, 2017 | 5 |
|
|
1991
|
+
* | | uuu | -043, 001, 1900, 2017 | 5 |
|
|
1992
|
+
* | | uuuu | -0043, 0001, 1900, 2017 | 5 |
|
|
1993
|
+
* | | uuuuu | ... | 3,5 |
|
|
1994
|
+
* | Quarter (formatting) | Q | 1, 2, 3, 4 | |
|
|
1995
|
+
* | | Qo | 1st, 2nd, 3rd, 4th | 7 |
|
|
1996
|
+
* | | QQ | 01, 02, 03, 04 | |
|
|
1997
|
+
* | | QQQ | Q1, Q2, Q3, Q4 | |
|
|
1998
|
+
* | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
|
|
1999
|
+
* | | QQQQQ | 1, 2, 3, 4 | 4 |
|
|
2000
|
+
* | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
|
|
2001
|
+
* | | qo | 1st, 2nd, 3rd, 4th | 7 |
|
|
2002
|
+
* | | qq | 01, 02, 03, 04 | |
|
|
2003
|
+
* | | qqq | Q1, Q2, Q3, Q4 | |
|
|
2004
|
+
* | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
|
|
2005
|
+
* | | qqqqq | 1, 2, 3, 4 | 4 |
|
|
2006
|
+
* | Month (formatting) | M | 1, 2, ..., 12 | |
|
|
2007
|
+
* | | Mo | 1st, 2nd, ..., 12th | 7 |
|
|
2008
|
+
* | | MM | 01, 02, ..., 12 | |
|
|
2009
|
+
* | | MMM | Jan, Feb, ..., Dec | |
|
|
2010
|
+
* | | MMMM | January, February, ..., December | 2 |
|
|
2011
|
+
* | | MMMMM | J, F, ..., D | |
|
|
2012
|
+
* | Month (stand-alone) | L | 1, 2, ..., 12 | |
|
|
2013
|
+
* | | Lo | 1st, 2nd, ..., 12th | 7 |
|
|
2014
|
+
* | | LL | 01, 02, ..., 12 | |
|
|
2015
|
+
* | | LLL | Jan, Feb, ..., Dec | |
|
|
2016
|
+
* | | LLLL | January, February, ..., December | 2 |
|
|
2017
|
+
* | | LLLLL | J, F, ..., D | |
|
|
2018
|
+
* | Local week of year | w | 1, 2, ..., 53 | |
|
|
2019
|
+
* | | wo | 1st, 2nd, ..., 53th | 7 |
|
|
2020
|
+
* | | ww | 01, 02, ..., 53 | |
|
|
2021
|
+
* | ISO week of year | I | 1, 2, ..., 53 | 7 |
|
|
2022
|
+
* | | Io | 1st, 2nd, ..., 53th | 7 |
|
|
2023
|
+
* | | II | 01, 02, ..., 53 | 7 |
|
|
2024
|
+
* | Day of month | d | 1, 2, ..., 31 | |
|
|
2025
|
+
* | | do | 1st, 2nd, ..., 31st | 7 |
|
|
2026
|
+
* | | dd | 01, 02, ..., 31 | |
|
|
2027
|
+
* | Day of year | D | 1, 2, ..., 365, 366 | 9 |
|
|
2028
|
+
* | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
|
|
2029
|
+
* | | DD | 01, 02, ..., 365, 366 | 9 |
|
|
2030
|
+
* | | DDD | 001, 002, ..., 365, 366 | |
|
|
2031
|
+
* | | DDDD | ... | 3 |
|
|
2032
|
+
* | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
|
|
2033
|
+
* | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
|
|
2034
|
+
* | | EEEEE | M, T, W, T, F, S, S | |
|
|
2035
|
+
* | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
2036
|
+
* | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
|
|
2037
|
+
* | | io | 1st, 2nd, ..., 7th | 7 |
|
|
2038
|
+
* | | ii | 01, 02, ..., 07 | 7 |
|
|
2039
|
+
* | | iii | Mon, Tue, Wed, ..., Sun | 7 |
|
|
2040
|
+
* | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
|
|
2041
|
+
* | | iiiii | M, T, W, T, F, S, S | 7 |
|
|
2042
|
+
* | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
|
|
2043
|
+
* | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
|
|
2044
|
+
* | | eo | 2nd, 3rd, ..., 1st | 7 |
|
|
2045
|
+
* | | ee | 02, 03, ..., 01 | |
|
|
2046
|
+
* | | eee | Mon, Tue, Wed, ..., Sun | |
|
|
2047
|
+
* | | eeee | Monday, Tuesday, ..., Sunday | 2 |
|
|
2048
|
+
* | | eeeee | M, T, W, T, F, S, S | |
|
|
2049
|
+
* | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
2050
|
+
* | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
|
|
2051
|
+
* | | co | 2nd, 3rd, ..., 1st | 7 |
|
|
2052
|
+
* | | cc | 02, 03, ..., 01 | |
|
|
2053
|
+
* | | ccc | Mon, Tue, Wed, ..., Sun | |
|
|
2054
|
+
* | | cccc | Monday, Tuesday, ..., Sunday | 2 |
|
|
2055
|
+
* | | ccccc | M, T, W, T, F, S, S | |
|
|
2056
|
+
* | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
2057
|
+
* | AM, PM | a..aa | AM, PM | |
|
|
2058
|
+
* | | aaa | am, pm | |
|
|
2059
|
+
* | | aaaa | a.m., p.m. | 2 |
|
|
2060
|
+
* | | aaaaa | a, p | |
|
|
2061
|
+
* | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
|
|
2062
|
+
* | | bbb | am, pm, noon, midnight | |
|
|
2063
|
+
* | | bbbb | a.m., p.m., noon, midnight | 2 |
|
|
2064
|
+
* | | bbbbb | a, p, n, mi | |
|
|
2065
|
+
* | Flexible day period | B..BBB | at night, in the morning, ... | |
|
|
2066
|
+
* | | BBBB | at night, in the morning, ... | 2 |
|
|
2067
|
+
* | | BBBBB | at night, in the morning, ... | |
|
|
2068
|
+
* | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
|
|
2069
|
+
* | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
|
|
2070
|
+
* | | hh | 01, 02, ..., 11, 12 | |
|
|
2071
|
+
* | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
|
|
2072
|
+
* | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
|
|
2073
|
+
* | | HH | 00, 01, 02, ..., 23 | |
|
|
2074
|
+
* | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
|
|
2075
|
+
* | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
|
|
2076
|
+
* | | KK | 01, 02, ..., 11, 00 | |
|
|
2077
|
+
* | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
|
|
2078
|
+
* | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
|
|
2079
|
+
* | | kk | 24, 01, 02, ..., 23 | |
|
|
2080
|
+
* | Minute | m | 0, 1, ..., 59 | |
|
|
2081
|
+
* | | mo | 0th, 1st, ..., 59th | 7 |
|
|
2082
|
+
* | | mm | 00, 01, ..., 59 | |
|
|
2083
|
+
* | Second | s | 0, 1, ..., 59 | |
|
|
2084
|
+
* | | so | 0th, 1st, ..., 59th | 7 |
|
|
2085
|
+
* | | ss | 00, 01, ..., 59 | |
|
|
2086
|
+
* | Fraction of second | S | 0, 1, ..., 9 | |
|
|
2087
|
+
* | | SS | 00, 01, ..., 99 | |
|
|
2088
|
+
* | | SSS | 000, 001, ..., 999 | |
|
|
2089
|
+
* | | SSSS | ... | 3 |
|
|
2090
|
+
* | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
|
|
2091
|
+
* | | XX | -0800, +0530, Z | |
|
|
2092
|
+
* | | XXX | -08:00, +05:30, Z | |
|
|
2093
|
+
* | | XXXX | -0800, +0530, Z, +123456 | 2 |
|
|
2094
|
+
* | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
|
|
2095
|
+
* | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
|
|
2096
|
+
* | | xx | -0800, +0530, +0000 | |
|
|
2097
|
+
* | | xxx | -08:00, +05:30, +00:00 | 2 |
|
|
2098
|
+
* | | xxxx | -0800, +0530, +0000, +123456 | |
|
|
2099
|
+
* | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
|
|
2100
|
+
* | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
|
|
2101
|
+
* | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
|
|
2102
|
+
* | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
|
|
2103
|
+
* | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
|
|
2104
|
+
* | Seconds timestamp | t | 512969520 | 7 |
|
|
2105
|
+
* | | tt | ... | 3,7 |
|
|
2106
|
+
* | Milliseconds timestamp | T | 512969520900 | 7 |
|
|
2107
|
+
* | | TT | ... | 3,7 |
|
|
2108
|
+
* | Long localized date | P | 04/29/1453 | 7 |
|
|
2109
|
+
* | | PP | Apr 29, 1453 | 7 |
|
|
2110
|
+
* | | PPP | April 29th, 1453 | 7 |
|
|
2111
|
+
* | | PPPP | Friday, April 29th, 1453 | 2,7 |
|
|
2112
|
+
* | Long localized time | p | 12:00 AM | 7 |
|
|
2113
|
+
* | | pp | 12:00:00 AM | 7 |
|
|
2114
|
+
* | | ppp | 12:00:00 AM GMT+2 | 7 |
|
|
2115
|
+
* | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
|
|
2116
|
+
* | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
|
|
2117
|
+
* | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
|
|
2118
|
+
* | | PPPppp | April 29th, 1453 at ... | 7 |
|
|
2119
|
+
* | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
|
|
2120
|
+
* Notes:
|
|
2121
|
+
* 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
|
|
2122
|
+
* are the same as "stand-alone" units, but are different in some languages.
|
|
2123
|
+
* "Formatting" units are declined according to the rules of the language
|
|
2124
|
+
* in the context of a date. "Stand-alone" units are always nominative singular:
|
|
2125
|
+
*
|
|
2126
|
+
* `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
|
|
2127
|
+
*
|
|
2128
|
+
* `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
|
|
2129
|
+
*
|
|
2130
|
+
* 2. Any sequence of the identical letters is a pattern, unless it is escaped by
|
|
2131
|
+
* the single quote characters (see below).
|
|
2132
|
+
* If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
|
|
2133
|
+
* the output will be the same as default pattern for this unit, usually
|
|
2134
|
+
* the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
|
|
2135
|
+
* are marked with "2" in the last column of the table.
|
|
2136
|
+
*
|
|
2137
|
+
* `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
|
|
2138
|
+
*
|
|
2139
|
+
* `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
|
|
2140
|
+
*
|
|
2141
|
+
* `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
|
|
2142
|
+
*
|
|
2143
|
+
* `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
|
|
2144
|
+
*
|
|
2145
|
+
* `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
|
|
2146
|
+
*
|
|
2147
|
+
* 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
|
|
2148
|
+
* The output will be padded with zeros to match the length of the pattern.
|
|
2149
|
+
*
|
|
2150
|
+
* `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
|
|
2151
|
+
*
|
|
2152
|
+
* 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
|
|
2153
|
+
* These tokens represent the shortest form of the quarter.
|
|
2154
|
+
*
|
|
2155
|
+
* 5. The main difference between `y` and `u` patterns are B.C. years:
|
|
2156
|
+
*
|
|
2157
|
+
* | Year | `y` | `u` |
|
|
2158
|
+
* |------|-----|-----|
|
|
2159
|
+
* | AC 1 | 1 | 1 |
|
|
2160
|
+
* | BC 1 | 1 | 0 |
|
|
2161
|
+
* | BC 2 | 2 | -1 |
|
|
2162
|
+
*
|
|
2163
|
+
* Also `yy` always returns the last two digits of a year,
|
|
2164
|
+
* while `uu` pads single digit years to 2 characters and returns other years unchanged:
|
|
2165
|
+
*
|
|
2166
|
+
* | Year | `yy` | `uu` |
|
|
2167
|
+
* |------|------|------|
|
|
2168
|
+
* | 1 | 01 | 01 |
|
|
2169
|
+
* | 14 | 14 | 14 |
|
|
2170
|
+
* | 376 | 76 | 376 |
|
|
2171
|
+
* | 1453 | 53 | 1453 |
|
|
2172
|
+
*
|
|
2173
|
+
* The same difference is true for local and ISO week-numbering years (`Y` and `R`),
|
|
2174
|
+
* except local week-numbering years are dependent on `options.weekStartsOn`
|
|
2175
|
+
* and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear)
|
|
2176
|
+
* and [getWeekYear](https://date-fns.org/docs/getWeekYear)).
|
|
2177
|
+
*
|
|
2178
|
+
* 6. Specific non-location timezones are currently unavailable in `date-fns`,
|
|
2179
|
+
* so right now these tokens fall back to GMT timezones.
|
|
2180
|
+
*
|
|
2181
|
+
* 7. These patterns are not in the Unicode Technical Standard #35:
|
|
2182
|
+
* - `i`: ISO day of week
|
|
2183
|
+
* - `I`: ISO week of year
|
|
2184
|
+
* - `R`: ISO week-numbering year
|
|
2185
|
+
* - `t`: seconds timestamp
|
|
2186
|
+
* - `T`: milliseconds timestamp
|
|
2187
|
+
* - `o`: ordinal number modifier
|
|
2188
|
+
* - `P`: long localized date
|
|
2189
|
+
* - `p`: long localized time
|
|
2190
|
+
*
|
|
2191
|
+
* 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
|
|
2192
|
+
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2193
|
+
*
|
|
2194
|
+
* 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
|
|
2195
|
+
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2196
|
+
*
|
|
2197
|
+
* @param date - The original date
|
|
2198
|
+
* @param format - The string of tokens
|
|
2199
|
+
* @param options - An object with options
|
|
2200
|
+
*
|
|
2201
|
+
* @returns The formatted date string
|
|
2202
|
+
*
|
|
2203
|
+
* @throws `date` must not be Invalid Date
|
|
2204
|
+
* @throws `options.locale` must contain `localize` property
|
|
2205
|
+
* @throws `options.locale` must contain `formatLong` property
|
|
2206
|
+
* @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2207
|
+
* @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2208
|
+
* @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2209
|
+
* @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2210
|
+
* @throws format string contains an unescaped latin alphabet character
|
|
2211
|
+
*
|
|
2212
|
+
* @example
|
|
2213
|
+
* // Represent 11 February 2014 in middle-endian format:
|
|
2214
|
+
* const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
|
|
2215
|
+
* //=> '02/11/2014'
|
|
2216
|
+
*
|
|
2217
|
+
* @example
|
|
2218
|
+
* // Represent 2 July 2014 in Esperanto:
|
|
2219
|
+
* import { eoLocale } from 'date-fns/locale/eo'
|
|
2220
|
+
* const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
|
|
2221
|
+
* locale: eoLocale
|
|
2222
|
+
* })
|
|
2223
|
+
* //=> '2-a de julio 2014'
|
|
2224
|
+
*
|
|
2225
|
+
* @example
|
|
2226
|
+
* // Escape string by single quote characters:
|
|
2227
|
+
* const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
|
|
2228
|
+
* //=> "3 o'clock"
|
|
2229
|
+
*/
|
|
2230
|
+
function format(date, formatStr, options) {
|
|
2231
|
+
const defaultOptions = getDefaultOptions$1();
|
|
2232
|
+
const locale = options?.locale ?? defaultOptions.locale ?? enUS;
|
|
2233
|
+
const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1;
|
|
2234
|
+
const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0;
|
|
2235
|
+
const originalDate = toDate(date, options?.in);
|
|
2236
|
+
if (!isValid(originalDate)) throw new RangeError("Invalid time value");
|
|
2237
|
+
let parts = formatStr.match(longFormattingTokensRegExp$1).map((substring) => {
|
|
2238
|
+
const firstCharacter = substring[0];
|
|
2239
|
+
if (firstCharacter === "p" || firstCharacter === "P") {
|
|
2240
|
+
const longFormatter = longFormatters[firstCharacter];
|
|
2241
|
+
return longFormatter(substring, locale.formatLong);
|
|
2242
|
+
}
|
|
2243
|
+
return substring;
|
|
2244
|
+
}).join("").match(formattingTokensRegExp$1).map((substring) => {
|
|
2245
|
+
if (substring === "''") return {
|
|
2246
|
+
isToken: false,
|
|
2247
|
+
value: "'"
|
|
2248
|
+
};
|
|
2249
|
+
const firstCharacter = substring[0];
|
|
2250
|
+
if (firstCharacter === "'") return {
|
|
2251
|
+
isToken: false,
|
|
2252
|
+
value: cleanEscapedString$1(substring)
|
|
2253
|
+
};
|
|
2254
|
+
if (formatters[firstCharacter]) return {
|
|
2255
|
+
isToken: true,
|
|
2256
|
+
value: substring
|
|
2257
|
+
};
|
|
2258
|
+
if (firstCharacter.match(unescapedLatinCharacterRegExp$1)) throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
|
|
2259
|
+
return {
|
|
2260
|
+
isToken: false,
|
|
2261
|
+
value: substring
|
|
2262
|
+
};
|
|
2263
|
+
});
|
|
2264
|
+
if (locale.localize.preprocessor) parts = locale.localize.preprocessor(originalDate, parts);
|
|
2265
|
+
const formatterOptions = {
|
|
2266
|
+
firstWeekContainsDate,
|
|
2267
|
+
weekStartsOn,
|
|
2268
|
+
locale
|
|
2269
|
+
};
|
|
2270
|
+
return parts.map((part) => {
|
|
2271
|
+
if (!part.isToken) return part.value;
|
|
2272
|
+
const token = part.value;
|
|
2273
|
+
if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) warnOrThrowProtectedError(token, formatStr, String(date));
|
|
2274
|
+
const formatter = formatters[token[0]];
|
|
2275
|
+
return formatter(originalDate, token, locale.localize, formatterOptions);
|
|
2276
|
+
}).join("");
|
|
2277
|
+
}
|
|
2278
|
+
function cleanEscapedString$1(input) {
|
|
2279
|
+
const matched = input.match(escapedStringRegExp$1);
|
|
2280
|
+
if (!matched) return input;
|
|
2281
|
+
return matched[1].replace(doubleQuoteRegExp$1, "'");
|
|
2282
|
+
}
|
|
2283
|
+
//#endregion
|
|
2284
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getDefaultOptions.js
|
|
2285
|
+
/**
|
|
2286
|
+
* @name getDefaultOptions
|
|
2287
|
+
* @category Common Helpers
|
|
2288
|
+
* @summary Get default options.
|
|
2289
|
+
* @pure false
|
|
2290
|
+
*
|
|
2291
|
+
* @description
|
|
2292
|
+
* Returns an object that contains defaults for
|
|
2293
|
+
* `options.locale`, `options.weekStartsOn` and `options.firstWeekContainsDate`
|
|
2294
|
+
* arguments for all functions.
|
|
2295
|
+
*
|
|
2296
|
+
* You can change these with [setDefaultOptions](https://date-fns.org/docs/setDefaultOptions).
|
|
2297
|
+
*
|
|
2298
|
+
* @returns The default options
|
|
2299
|
+
*
|
|
2300
|
+
* @example
|
|
2301
|
+
* const result = getDefaultOptions()
|
|
2302
|
+
* //=> {}
|
|
2303
|
+
*
|
|
2304
|
+
* @example
|
|
2305
|
+
* setDefaultOptions({ weekStarsOn: 1, firstWeekContainsDate: 4 })
|
|
2306
|
+
* const result = getDefaultOptions()
|
|
2307
|
+
* //=> { weekStarsOn: 1, firstWeekContainsDate: 4 }
|
|
2308
|
+
*/
|
|
2309
|
+
function getDefaultOptions() {
|
|
2310
|
+
return Object.assign({}, getDefaultOptions$1());
|
|
2311
|
+
}
|
|
2312
|
+
//#endregion
|
|
2313
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/transpose.js
|
|
2314
|
+
/**
|
|
2315
|
+
* @name transpose
|
|
2316
|
+
* @category Generic Helpers
|
|
2317
|
+
* @summary Transpose the date to the given constructor.
|
|
2318
|
+
*
|
|
2319
|
+
* @description
|
|
2320
|
+
* The function transposes the date to the given constructor. It helps you
|
|
2321
|
+
* to transpose the date in the system time zone to say `UTCDate` or any other
|
|
2322
|
+
* date extension.
|
|
2323
|
+
*
|
|
2324
|
+
* @typeParam InputDate - The input `Date` type derived from the passed argument.
|
|
2325
|
+
* @typeParam ResultDate - The result `Date` type derived from the passed constructor.
|
|
2326
|
+
*
|
|
2327
|
+
* @param date - The date to use values from
|
|
2328
|
+
* @param constructor - The date constructor to use
|
|
2329
|
+
*
|
|
2330
|
+
* @returns Date transposed to the given constructor
|
|
2331
|
+
*
|
|
2332
|
+
* @example
|
|
2333
|
+
* // Create July 10, 2022 00:00 in locale time zone
|
|
2334
|
+
* const date = new Date(2022, 6, 10)
|
|
2335
|
+
* //=> 'Sun Jul 10 2022 00:00:00 GMT+0800 (Singapore Standard Time)'
|
|
2336
|
+
*
|
|
2337
|
+
* @example
|
|
2338
|
+
* // Transpose the date to July 10, 2022 00:00 in UTC
|
|
2339
|
+
* transpose(date, UTCDate)
|
|
2340
|
+
* //=> 'Sun Jul 10 2022 00:00:00 GMT+0000 (Coordinated Universal Time)'
|
|
2341
|
+
*/
|
|
2342
|
+
function transpose(date, constructor) {
|
|
2343
|
+
const date_ = isConstructor(constructor) ? new constructor(0) : constructFrom(constructor, 0);
|
|
2344
|
+
date_.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
|
|
2345
|
+
date_.setHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
|
|
2346
|
+
return date_;
|
|
2347
|
+
}
|
|
2348
|
+
function isConstructor(constructor) {
|
|
2349
|
+
return typeof constructor === "function" && constructor.prototype?.constructor === constructor;
|
|
2350
|
+
}
|
|
2351
|
+
//#endregion
|
|
2352
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/Setter.js
|
|
2353
|
+
var TIMEZONE_UNIT_PRIORITY = 10;
|
|
2354
|
+
var Setter = class {
|
|
2355
|
+
subPriority = 0;
|
|
2356
|
+
validate(_utcDate, _options) {
|
|
2357
|
+
return true;
|
|
2358
|
+
}
|
|
2359
|
+
};
|
|
2360
|
+
var ValueSetter = class extends Setter {
|
|
2361
|
+
constructor(value, validateValue, setValue, priority, subPriority) {
|
|
2362
|
+
super();
|
|
2363
|
+
this.value = value;
|
|
2364
|
+
this.validateValue = validateValue;
|
|
2365
|
+
this.setValue = setValue;
|
|
2366
|
+
this.priority = priority;
|
|
2367
|
+
if (subPriority) this.subPriority = subPriority;
|
|
2368
|
+
}
|
|
2369
|
+
validate(date, options) {
|
|
2370
|
+
return this.validateValue(date, this.value, options);
|
|
2371
|
+
}
|
|
2372
|
+
set(date, flags, options) {
|
|
2373
|
+
return this.setValue(date, flags, this.value, options);
|
|
2374
|
+
}
|
|
2375
|
+
};
|
|
2376
|
+
var DateTimezoneSetter = class extends Setter {
|
|
2377
|
+
priority = TIMEZONE_UNIT_PRIORITY;
|
|
2378
|
+
subPriority = -1;
|
|
2379
|
+
constructor(context, reference) {
|
|
2380
|
+
super();
|
|
2381
|
+
this.context = context || ((date) => constructFrom(reference, date));
|
|
2382
|
+
}
|
|
2383
|
+
set(date, flags) {
|
|
2384
|
+
if (flags.timestampIsSet) return date;
|
|
2385
|
+
return constructFrom(date, transpose(date, this.context));
|
|
2386
|
+
}
|
|
2387
|
+
};
|
|
2388
|
+
//#endregion
|
|
2389
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/Parser.js
|
|
2390
|
+
var Parser = class {
|
|
2391
|
+
run(dateString, token, match, options) {
|
|
2392
|
+
const result = this.parse(dateString, token, match, options);
|
|
2393
|
+
if (!result) return null;
|
|
2394
|
+
return {
|
|
2395
|
+
setter: new ValueSetter(result.value, this.validate, this.set, this.priority, this.subPriority),
|
|
2396
|
+
rest: result.rest
|
|
2397
|
+
};
|
|
2398
|
+
}
|
|
2399
|
+
validate(_utcDate, _value, _options) {
|
|
2400
|
+
return true;
|
|
2401
|
+
}
|
|
2402
|
+
};
|
|
2403
|
+
//#endregion
|
|
2404
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/EraParser.js
|
|
2405
|
+
var EraParser = class extends Parser {
|
|
2406
|
+
priority = 140;
|
|
2407
|
+
parse(dateString, token, match) {
|
|
2408
|
+
switch (token) {
|
|
2409
|
+
case "G":
|
|
2410
|
+
case "GG":
|
|
2411
|
+
case "GGG": return match.era(dateString, { width: "abbreviated" }) || match.era(dateString, { width: "narrow" });
|
|
2412
|
+
case "GGGGG": return match.era(dateString, { width: "narrow" });
|
|
2413
|
+
default: return match.era(dateString, { width: "wide" }) || match.era(dateString, { width: "abbreviated" }) || match.era(dateString, { width: "narrow" });
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
set(date, flags, value) {
|
|
2417
|
+
flags.era = value;
|
|
2418
|
+
date.setFullYear(value, 0, 1);
|
|
2419
|
+
date.setHours(0, 0, 0, 0);
|
|
2420
|
+
return date;
|
|
2421
|
+
}
|
|
2422
|
+
incompatibleTokens = [
|
|
2423
|
+
"R",
|
|
2424
|
+
"u",
|
|
2425
|
+
"t",
|
|
2426
|
+
"T"
|
|
2427
|
+
];
|
|
2428
|
+
};
|
|
2429
|
+
//#endregion
|
|
2430
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/constants.js
|
|
2431
|
+
var numericPatterns = {
|
|
2432
|
+
month: /^(1[0-2]|0?\d)/,
|
|
2433
|
+
date: /^(3[0-1]|[0-2]?\d)/,
|
|
2434
|
+
dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,
|
|
2435
|
+
week: /^(5[0-3]|[0-4]?\d)/,
|
|
2436
|
+
hour23h: /^(2[0-3]|[0-1]?\d)/,
|
|
2437
|
+
hour24h: /^(2[0-4]|[0-1]?\d)/,
|
|
2438
|
+
hour11h: /^(1[0-1]|0?\d)/,
|
|
2439
|
+
hour12h: /^(1[0-2]|0?\d)/,
|
|
2440
|
+
minute: /^[0-5]?\d/,
|
|
2441
|
+
second: /^[0-5]?\d/,
|
|
2442
|
+
singleDigit: /^\d/,
|
|
2443
|
+
twoDigits: /^\d{1,2}/,
|
|
2444
|
+
threeDigits: /^\d{1,3}/,
|
|
2445
|
+
fourDigits: /^\d{1,4}/,
|
|
2446
|
+
anyDigitsSigned: /^-?\d+/,
|
|
2447
|
+
singleDigitSigned: /^-?\d/,
|
|
2448
|
+
twoDigitsSigned: /^-?\d{1,2}/,
|
|
2449
|
+
threeDigitsSigned: /^-?\d{1,3}/,
|
|
2450
|
+
fourDigitsSigned: /^-?\d{1,4}/
|
|
2451
|
+
};
|
|
2452
|
+
var timezonePatterns = {
|
|
2453
|
+
basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
|
|
2454
|
+
basic: /^([+-])(\d{2})(\d{2})|Z/,
|
|
2455
|
+
basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
|
|
2456
|
+
extended: /^([+-])(\d{2}):(\d{2})|Z/,
|
|
2457
|
+
extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
|
|
2458
|
+
};
|
|
2459
|
+
//#endregion
|
|
2460
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/utils.js
|
|
2461
|
+
function mapValue(parseFnResult, mapFn) {
|
|
2462
|
+
if (!parseFnResult) return parseFnResult;
|
|
2463
|
+
return {
|
|
2464
|
+
value: mapFn(parseFnResult.value),
|
|
2465
|
+
rest: parseFnResult.rest
|
|
2466
|
+
};
|
|
2467
|
+
}
|
|
2468
|
+
function parseNumericPattern(pattern, dateString) {
|
|
2469
|
+
const matchResult = dateString.match(pattern);
|
|
2470
|
+
if (!matchResult) return null;
|
|
2471
|
+
return {
|
|
2472
|
+
value: parseInt(matchResult[0], 10),
|
|
2473
|
+
rest: dateString.slice(matchResult[0].length)
|
|
2474
|
+
};
|
|
2475
|
+
}
|
|
2476
|
+
function parseTimezonePattern(pattern, dateString) {
|
|
2477
|
+
const matchResult = dateString.match(pattern);
|
|
2478
|
+
if (!matchResult) return null;
|
|
2479
|
+
if (matchResult[0] === "Z") return {
|
|
2480
|
+
value: 0,
|
|
2481
|
+
rest: dateString.slice(1)
|
|
2482
|
+
};
|
|
2483
|
+
const sign = matchResult[1] === "+" ? 1 : -1;
|
|
2484
|
+
const hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;
|
|
2485
|
+
const minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;
|
|
2486
|
+
const seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;
|
|
2487
|
+
return {
|
|
2488
|
+
value: sign * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),
|
|
2489
|
+
rest: dateString.slice(matchResult[0].length)
|
|
2490
|
+
};
|
|
2491
|
+
}
|
|
2492
|
+
function parseAnyDigitsSigned(dateString) {
|
|
2493
|
+
return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);
|
|
2494
|
+
}
|
|
2495
|
+
function parseNDigits(n, dateString) {
|
|
2496
|
+
switch (n) {
|
|
2497
|
+
case 1: return parseNumericPattern(numericPatterns.singleDigit, dateString);
|
|
2498
|
+
case 2: return parseNumericPattern(numericPatterns.twoDigits, dateString);
|
|
2499
|
+
case 3: return parseNumericPattern(numericPatterns.threeDigits, dateString);
|
|
2500
|
+
case 4: return parseNumericPattern(numericPatterns.fourDigits, dateString);
|
|
2501
|
+
default: return parseNumericPattern(new RegExp("^\\d{1," + n + "}"), dateString);
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
function parseNDigitsSigned(n, dateString) {
|
|
2505
|
+
switch (n) {
|
|
2506
|
+
case 1: return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);
|
|
2507
|
+
case 2: return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);
|
|
2508
|
+
case 3: return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);
|
|
2509
|
+
case 4: return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);
|
|
2510
|
+
default: return parseNumericPattern(new RegExp("^-?\\d{1," + n + "}"), dateString);
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
function dayPeriodEnumToHours(dayPeriod) {
|
|
2514
|
+
switch (dayPeriod) {
|
|
2515
|
+
case "morning": return 4;
|
|
2516
|
+
case "evening": return 17;
|
|
2517
|
+
case "pm":
|
|
2518
|
+
case "noon":
|
|
2519
|
+
case "afternoon": return 12;
|
|
2520
|
+
default: return 0;
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
function normalizeTwoDigitYear(twoDigitYear, currentYear) {
|
|
2524
|
+
const isCommonEra = currentYear > 0;
|
|
2525
|
+
const absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
|
|
2526
|
+
let result;
|
|
2527
|
+
if (absCurrentYear <= 50) result = twoDigitYear || 100;
|
|
2528
|
+
else {
|
|
2529
|
+
const rangeEnd = absCurrentYear + 50;
|
|
2530
|
+
const rangeEndCentury = Math.trunc(rangeEnd / 100) * 100;
|
|
2531
|
+
const isPreviousCentury = twoDigitYear >= rangeEnd % 100;
|
|
2532
|
+
result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
|
|
2533
|
+
}
|
|
2534
|
+
return isCommonEra ? result : 1 - result;
|
|
2535
|
+
}
|
|
2536
|
+
function isLeapYearIndex(year) {
|
|
2537
|
+
return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
|
|
2538
|
+
}
|
|
2539
|
+
//#endregion
|
|
2540
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/YearParser.js
|
|
2541
|
+
var YearParser = class extends Parser {
|
|
2542
|
+
priority = 130;
|
|
2543
|
+
incompatibleTokens = [
|
|
2544
|
+
"Y",
|
|
2545
|
+
"R",
|
|
2546
|
+
"u",
|
|
2547
|
+
"w",
|
|
2548
|
+
"I",
|
|
2549
|
+
"i",
|
|
2550
|
+
"e",
|
|
2551
|
+
"c",
|
|
2552
|
+
"t",
|
|
2553
|
+
"T"
|
|
2554
|
+
];
|
|
2555
|
+
parse(dateString, token, match) {
|
|
2556
|
+
const valueCallback = (year) => ({
|
|
2557
|
+
year,
|
|
2558
|
+
isTwoDigitYear: token === "yy"
|
|
2559
|
+
});
|
|
2560
|
+
switch (token) {
|
|
2561
|
+
case "y": return mapValue(parseNDigits(4, dateString), valueCallback);
|
|
2562
|
+
case "yo": return mapValue(match.ordinalNumber(dateString, { unit: "year" }), valueCallback);
|
|
2563
|
+
default: return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
validate(_date, value) {
|
|
2567
|
+
return value.isTwoDigitYear || value.year > 0;
|
|
2568
|
+
}
|
|
2569
|
+
set(date, flags, value) {
|
|
2570
|
+
const currentYear = date.getFullYear();
|
|
2571
|
+
if (value.isTwoDigitYear) {
|
|
2572
|
+
const normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
|
|
2573
|
+
date.setFullYear(normalizedTwoDigitYear, 0, 1);
|
|
2574
|
+
date.setHours(0, 0, 0, 0);
|
|
2575
|
+
return date;
|
|
2576
|
+
}
|
|
2577
|
+
const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
|
|
2578
|
+
date.setFullYear(year, 0, 1);
|
|
2579
|
+
date.setHours(0, 0, 0, 0);
|
|
2580
|
+
return date;
|
|
2581
|
+
}
|
|
2582
|
+
};
|
|
2583
|
+
//#endregion
|
|
2584
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js
|
|
2585
|
+
var LocalWeekYearParser = class extends Parser {
|
|
2586
|
+
priority = 130;
|
|
2587
|
+
parse(dateString, token, match) {
|
|
2588
|
+
const valueCallback = (year) => ({
|
|
2589
|
+
year,
|
|
2590
|
+
isTwoDigitYear: token === "YY"
|
|
2591
|
+
});
|
|
2592
|
+
switch (token) {
|
|
2593
|
+
case "Y": return mapValue(parseNDigits(4, dateString), valueCallback);
|
|
2594
|
+
case "Yo": return mapValue(match.ordinalNumber(dateString, { unit: "year" }), valueCallback);
|
|
2595
|
+
default: return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
validate(_date, value) {
|
|
2599
|
+
return value.isTwoDigitYear || value.year > 0;
|
|
2600
|
+
}
|
|
2601
|
+
set(date, flags, value, options) {
|
|
2602
|
+
const currentYear = getWeekYear(date, options);
|
|
2603
|
+
if (value.isTwoDigitYear) {
|
|
2604
|
+
const normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
|
|
2605
|
+
date.setFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate);
|
|
2606
|
+
date.setHours(0, 0, 0, 0);
|
|
2607
|
+
return startOfWeek(date, options);
|
|
2608
|
+
}
|
|
2609
|
+
const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
|
|
2610
|
+
date.setFullYear(year, 0, options.firstWeekContainsDate);
|
|
2611
|
+
date.setHours(0, 0, 0, 0);
|
|
2612
|
+
return startOfWeek(date, options);
|
|
2613
|
+
}
|
|
2614
|
+
incompatibleTokens = [
|
|
2615
|
+
"y",
|
|
2616
|
+
"R",
|
|
2617
|
+
"u",
|
|
2618
|
+
"Q",
|
|
2619
|
+
"q",
|
|
2620
|
+
"M",
|
|
2621
|
+
"L",
|
|
2622
|
+
"I",
|
|
2623
|
+
"d",
|
|
2624
|
+
"D",
|
|
2625
|
+
"i",
|
|
2626
|
+
"t",
|
|
2627
|
+
"T"
|
|
2628
|
+
];
|
|
2629
|
+
};
|
|
2630
|
+
//#endregion
|
|
2631
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js
|
|
2632
|
+
var ISOWeekYearParser = class extends Parser {
|
|
2633
|
+
priority = 130;
|
|
2634
|
+
parse(dateString, token) {
|
|
2635
|
+
if (token === "R") return parseNDigitsSigned(4, dateString);
|
|
2636
|
+
return parseNDigitsSigned(token.length, dateString);
|
|
2637
|
+
}
|
|
2638
|
+
set(date, _flags, value) {
|
|
2639
|
+
const firstWeekOfYear = constructFrom(date, 0);
|
|
2640
|
+
firstWeekOfYear.setFullYear(value, 0, 4);
|
|
2641
|
+
firstWeekOfYear.setHours(0, 0, 0, 0);
|
|
2642
|
+
return startOfISOWeek(firstWeekOfYear);
|
|
2643
|
+
}
|
|
2644
|
+
incompatibleTokens = [
|
|
2645
|
+
"G",
|
|
2646
|
+
"y",
|
|
2647
|
+
"Y",
|
|
2648
|
+
"u",
|
|
2649
|
+
"Q",
|
|
2650
|
+
"q",
|
|
2651
|
+
"M",
|
|
2652
|
+
"L",
|
|
2653
|
+
"w",
|
|
2654
|
+
"d",
|
|
2655
|
+
"D",
|
|
2656
|
+
"e",
|
|
2657
|
+
"c",
|
|
2658
|
+
"t",
|
|
2659
|
+
"T"
|
|
2660
|
+
];
|
|
2661
|
+
};
|
|
2662
|
+
//#endregion
|
|
2663
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js
|
|
2664
|
+
var ExtendedYearParser = class extends Parser {
|
|
2665
|
+
priority = 130;
|
|
2666
|
+
parse(dateString, token) {
|
|
2667
|
+
if (token === "u") return parseNDigitsSigned(4, dateString);
|
|
2668
|
+
return parseNDigitsSigned(token.length, dateString);
|
|
2669
|
+
}
|
|
2670
|
+
set(date, _flags, value) {
|
|
2671
|
+
date.setFullYear(value, 0, 1);
|
|
2672
|
+
date.setHours(0, 0, 0, 0);
|
|
2673
|
+
return date;
|
|
2674
|
+
}
|
|
2675
|
+
incompatibleTokens = [
|
|
2676
|
+
"G",
|
|
2677
|
+
"y",
|
|
2678
|
+
"Y",
|
|
2679
|
+
"R",
|
|
2680
|
+
"w",
|
|
2681
|
+
"I",
|
|
2682
|
+
"i",
|
|
2683
|
+
"e",
|
|
2684
|
+
"c",
|
|
2685
|
+
"t",
|
|
2686
|
+
"T"
|
|
2687
|
+
];
|
|
2688
|
+
};
|
|
2689
|
+
//#endregion
|
|
2690
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/QuarterParser.js
|
|
2691
|
+
var QuarterParser = class extends Parser {
|
|
2692
|
+
priority = 120;
|
|
2693
|
+
parse(dateString, token, match) {
|
|
2694
|
+
switch (token) {
|
|
2695
|
+
case "Q":
|
|
2696
|
+
case "QQ": return parseNDigits(token.length, dateString);
|
|
2697
|
+
case "Qo": return match.ordinalNumber(dateString, { unit: "quarter" });
|
|
2698
|
+
case "QQQ": return match.quarter(dateString, {
|
|
2699
|
+
width: "abbreviated",
|
|
2700
|
+
context: "formatting"
|
|
2701
|
+
}) || match.quarter(dateString, {
|
|
2702
|
+
width: "narrow",
|
|
2703
|
+
context: "formatting"
|
|
2704
|
+
});
|
|
2705
|
+
case "QQQQQ": return match.quarter(dateString, {
|
|
2706
|
+
width: "narrow",
|
|
2707
|
+
context: "formatting"
|
|
2708
|
+
});
|
|
2709
|
+
default: return match.quarter(dateString, {
|
|
2710
|
+
width: "wide",
|
|
2711
|
+
context: "formatting"
|
|
2712
|
+
}) || match.quarter(dateString, {
|
|
2713
|
+
width: "abbreviated",
|
|
2714
|
+
context: "formatting"
|
|
2715
|
+
}) || match.quarter(dateString, {
|
|
2716
|
+
width: "narrow",
|
|
2717
|
+
context: "formatting"
|
|
2718
|
+
});
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
validate(_date, value) {
|
|
2722
|
+
return value >= 1 && value <= 4;
|
|
2723
|
+
}
|
|
2724
|
+
set(date, _flags, value) {
|
|
2725
|
+
date.setMonth((value - 1) * 3, 1);
|
|
2726
|
+
date.setHours(0, 0, 0, 0);
|
|
2727
|
+
return date;
|
|
2728
|
+
}
|
|
2729
|
+
incompatibleTokens = [
|
|
2730
|
+
"Y",
|
|
2731
|
+
"R",
|
|
2732
|
+
"q",
|
|
2733
|
+
"M",
|
|
2734
|
+
"L",
|
|
2735
|
+
"w",
|
|
2736
|
+
"I",
|
|
2737
|
+
"d",
|
|
2738
|
+
"D",
|
|
2739
|
+
"i",
|
|
2740
|
+
"e",
|
|
2741
|
+
"c",
|
|
2742
|
+
"t",
|
|
2743
|
+
"T"
|
|
2744
|
+
];
|
|
2745
|
+
};
|
|
2746
|
+
//#endregion
|
|
2747
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js
|
|
2748
|
+
var StandAloneQuarterParser = class extends Parser {
|
|
2749
|
+
priority = 120;
|
|
2750
|
+
parse(dateString, token, match) {
|
|
2751
|
+
switch (token) {
|
|
2752
|
+
case "q":
|
|
2753
|
+
case "qq": return parseNDigits(token.length, dateString);
|
|
2754
|
+
case "qo": return match.ordinalNumber(dateString, { unit: "quarter" });
|
|
2755
|
+
case "qqq": return match.quarter(dateString, {
|
|
2756
|
+
width: "abbreviated",
|
|
2757
|
+
context: "standalone"
|
|
2758
|
+
}) || match.quarter(dateString, {
|
|
2759
|
+
width: "narrow",
|
|
2760
|
+
context: "standalone"
|
|
2761
|
+
});
|
|
2762
|
+
case "qqqqq": return match.quarter(dateString, {
|
|
2763
|
+
width: "narrow",
|
|
2764
|
+
context: "standalone"
|
|
2765
|
+
});
|
|
2766
|
+
default: return match.quarter(dateString, {
|
|
2767
|
+
width: "wide",
|
|
2768
|
+
context: "standalone"
|
|
2769
|
+
}) || match.quarter(dateString, {
|
|
2770
|
+
width: "abbreviated",
|
|
2771
|
+
context: "standalone"
|
|
2772
|
+
}) || match.quarter(dateString, {
|
|
2773
|
+
width: "narrow",
|
|
2774
|
+
context: "standalone"
|
|
2775
|
+
});
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2778
|
+
validate(_date, value) {
|
|
2779
|
+
return value >= 1 && value <= 4;
|
|
2780
|
+
}
|
|
2781
|
+
set(date, _flags, value) {
|
|
2782
|
+
date.setMonth((value - 1) * 3, 1);
|
|
2783
|
+
date.setHours(0, 0, 0, 0);
|
|
2784
|
+
return date;
|
|
2785
|
+
}
|
|
2786
|
+
incompatibleTokens = [
|
|
2787
|
+
"Y",
|
|
2788
|
+
"R",
|
|
2789
|
+
"Q",
|
|
2790
|
+
"M",
|
|
2791
|
+
"L",
|
|
2792
|
+
"w",
|
|
2793
|
+
"I",
|
|
2794
|
+
"d",
|
|
2795
|
+
"D",
|
|
2796
|
+
"i",
|
|
2797
|
+
"e",
|
|
2798
|
+
"c",
|
|
2799
|
+
"t",
|
|
2800
|
+
"T"
|
|
2801
|
+
];
|
|
2802
|
+
};
|
|
2803
|
+
//#endregion
|
|
2804
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/MonthParser.js
|
|
2805
|
+
var MonthParser = class extends Parser {
|
|
2806
|
+
incompatibleTokens = [
|
|
2807
|
+
"Y",
|
|
2808
|
+
"R",
|
|
2809
|
+
"q",
|
|
2810
|
+
"Q",
|
|
2811
|
+
"L",
|
|
2812
|
+
"w",
|
|
2813
|
+
"I",
|
|
2814
|
+
"D",
|
|
2815
|
+
"i",
|
|
2816
|
+
"e",
|
|
2817
|
+
"c",
|
|
2818
|
+
"t",
|
|
2819
|
+
"T"
|
|
2820
|
+
];
|
|
2821
|
+
priority = 110;
|
|
2822
|
+
parse(dateString, token, match) {
|
|
2823
|
+
const valueCallback = (value) => value - 1;
|
|
2824
|
+
switch (token) {
|
|
2825
|
+
case "M": return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);
|
|
2826
|
+
case "MM": return mapValue(parseNDigits(2, dateString), valueCallback);
|
|
2827
|
+
case "Mo": return mapValue(match.ordinalNumber(dateString, { unit: "month" }), valueCallback);
|
|
2828
|
+
case "MMM": return match.month(dateString, {
|
|
2829
|
+
width: "abbreviated",
|
|
2830
|
+
context: "formatting"
|
|
2831
|
+
}) || match.month(dateString, {
|
|
2832
|
+
width: "narrow",
|
|
2833
|
+
context: "formatting"
|
|
2834
|
+
});
|
|
2835
|
+
case "MMMMM": return match.month(dateString, {
|
|
2836
|
+
width: "narrow",
|
|
2837
|
+
context: "formatting"
|
|
2838
|
+
});
|
|
2839
|
+
default: return match.month(dateString, {
|
|
2840
|
+
width: "wide",
|
|
2841
|
+
context: "formatting"
|
|
2842
|
+
}) || match.month(dateString, {
|
|
2843
|
+
width: "abbreviated",
|
|
2844
|
+
context: "formatting"
|
|
2845
|
+
}) || match.month(dateString, {
|
|
2846
|
+
width: "narrow",
|
|
2847
|
+
context: "formatting"
|
|
2848
|
+
});
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
validate(_date, value) {
|
|
2852
|
+
return value >= 0 && value <= 11;
|
|
2853
|
+
}
|
|
2854
|
+
set(date, _flags, value) {
|
|
2855
|
+
date.setMonth(value, 1);
|
|
2856
|
+
date.setHours(0, 0, 0, 0);
|
|
2857
|
+
return date;
|
|
2858
|
+
}
|
|
2859
|
+
};
|
|
2860
|
+
//#endregion
|
|
2861
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js
|
|
2862
|
+
var StandAloneMonthParser = class extends Parser {
|
|
2863
|
+
priority = 110;
|
|
2864
|
+
parse(dateString, token, match) {
|
|
2865
|
+
const valueCallback = (value) => value - 1;
|
|
2866
|
+
switch (token) {
|
|
2867
|
+
case "L": return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);
|
|
2868
|
+
case "LL": return mapValue(parseNDigits(2, dateString), valueCallback);
|
|
2869
|
+
case "Lo": return mapValue(match.ordinalNumber(dateString, { unit: "month" }), valueCallback);
|
|
2870
|
+
case "LLL": return match.month(dateString, {
|
|
2871
|
+
width: "abbreviated",
|
|
2872
|
+
context: "standalone"
|
|
2873
|
+
}) || match.month(dateString, {
|
|
2874
|
+
width: "narrow",
|
|
2875
|
+
context: "standalone"
|
|
2876
|
+
});
|
|
2877
|
+
case "LLLLL": return match.month(dateString, {
|
|
2878
|
+
width: "narrow",
|
|
2879
|
+
context: "standalone"
|
|
2880
|
+
});
|
|
2881
|
+
default: return match.month(dateString, {
|
|
2882
|
+
width: "wide",
|
|
2883
|
+
context: "standalone"
|
|
2884
|
+
}) || match.month(dateString, {
|
|
2885
|
+
width: "abbreviated",
|
|
2886
|
+
context: "standalone"
|
|
2887
|
+
}) || match.month(dateString, {
|
|
2888
|
+
width: "narrow",
|
|
2889
|
+
context: "standalone"
|
|
2890
|
+
});
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
validate(_date, value) {
|
|
2894
|
+
return value >= 0 && value <= 11;
|
|
2895
|
+
}
|
|
2896
|
+
set(date, _flags, value) {
|
|
2897
|
+
date.setMonth(value, 1);
|
|
2898
|
+
date.setHours(0, 0, 0, 0);
|
|
2899
|
+
return date;
|
|
2900
|
+
}
|
|
2901
|
+
incompatibleTokens = [
|
|
2902
|
+
"Y",
|
|
2903
|
+
"R",
|
|
2904
|
+
"q",
|
|
2905
|
+
"Q",
|
|
2906
|
+
"M",
|
|
2907
|
+
"w",
|
|
2908
|
+
"I",
|
|
2909
|
+
"D",
|
|
2910
|
+
"i",
|
|
2911
|
+
"e",
|
|
2912
|
+
"c",
|
|
2913
|
+
"t",
|
|
2914
|
+
"T"
|
|
2915
|
+
];
|
|
2916
|
+
};
|
|
2917
|
+
//#endregion
|
|
2918
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/setWeek.js
|
|
2919
|
+
/**
|
|
2920
|
+
* The {@link setWeek} function options.
|
|
2921
|
+
*/
|
|
2922
|
+
/**
|
|
2923
|
+
* @name setWeek
|
|
2924
|
+
* @category Week Helpers
|
|
2925
|
+
* @summary Set the local week to the given date.
|
|
2926
|
+
*
|
|
2927
|
+
* @description
|
|
2928
|
+
* Set the local week to the given date, saving the weekday number.
|
|
2929
|
+
* The exact calculation depends on the values of
|
|
2930
|
+
* `options.weekStartsOn` (which is the index of the first day of the week)
|
|
2931
|
+
* and `options.firstWeekContainsDate` (which is the day of January, which is always in
|
|
2932
|
+
* the first week of the week-numbering year)
|
|
2933
|
+
*
|
|
2934
|
+
* Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
|
|
2935
|
+
*
|
|
2936
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
2937
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
2938
|
+
*
|
|
2939
|
+
* @param date - The date to be changed
|
|
2940
|
+
* @param week - The week of the new date
|
|
2941
|
+
* @param options - An object with options
|
|
2942
|
+
*
|
|
2943
|
+
* @returns The new date with the local week set
|
|
2944
|
+
*
|
|
2945
|
+
* @example
|
|
2946
|
+
* // Set the 1st week to 2 January 2005 with default options:
|
|
2947
|
+
* const result = setWeek(new Date(2005, 0, 2), 1)
|
|
2948
|
+
* //=> Sun Dec 26 2004 00:00:00
|
|
2949
|
+
*
|
|
2950
|
+
* @example
|
|
2951
|
+
* // Set the 1st week to 2 January 2005,
|
|
2952
|
+
* // if Monday is the first day of the week,
|
|
2953
|
+
* // and the first week of the year always contains 4 January:
|
|
2954
|
+
* const result = setWeek(new Date(2005, 0, 2), 1, {
|
|
2955
|
+
* weekStartsOn: 1,
|
|
2956
|
+
* firstWeekContainsDate: 4
|
|
2957
|
+
* })
|
|
2958
|
+
* //=> Sun Jan 4 2004 00:00:00
|
|
2959
|
+
*/
|
|
2960
|
+
function setWeek(date, week, options) {
|
|
2961
|
+
const date_ = toDate(date, options?.in);
|
|
2962
|
+
const diff = getWeek(date_, options) - week;
|
|
2963
|
+
date_.setDate(date_.getDate() - diff * 7);
|
|
2964
|
+
return toDate(date_, options?.in);
|
|
2965
|
+
}
|
|
2966
|
+
//#endregion
|
|
2967
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js
|
|
2968
|
+
var LocalWeekParser = class extends Parser {
|
|
2969
|
+
priority = 100;
|
|
2970
|
+
parse(dateString, token, match) {
|
|
2971
|
+
switch (token) {
|
|
2972
|
+
case "w": return parseNumericPattern(numericPatterns.week, dateString);
|
|
2973
|
+
case "wo": return match.ordinalNumber(dateString, { unit: "week" });
|
|
2974
|
+
default: return parseNDigits(token.length, dateString);
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2977
|
+
validate(_date, value) {
|
|
2978
|
+
return value >= 1 && value <= 53;
|
|
2979
|
+
}
|
|
2980
|
+
set(date, _flags, value, options) {
|
|
2981
|
+
return startOfWeek(setWeek(date, value, options), options);
|
|
2982
|
+
}
|
|
2983
|
+
incompatibleTokens = [
|
|
2984
|
+
"y",
|
|
2985
|
+
"R",
|
|
2986
|
+
"u",
|
|
2987
|
+
"q",
|
|
2988
|
+
"Q",
|
|
2989
|
+
"M",
|
|
2990
|
+
"L",
|
|
2991
|
+
"I",
|
|
2992
|
+
"d",
|
|
2993
|
+
"D",
|
|
2994
|
+
"i",
|
|
2995
|
+
"t",
|
|
2996
|
+
"T"
|
|
2997
|
+
];
|
|
2998
|
+
};
|
|
2999
|
+
//#endregion
|
|
3000
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/setISOWeek.js
|
|
3001
|
+
/**
|
|
3002
|
+
* The {@link setISOWeek} function options.
|
|
3003
|
+
*/
|
|
3004
|
+
/**
|
|
3005
|
+
* @name setISOWeek
|
|
3006
|
+
* @category ISO Week Helpers
|
|
3007
|
+
* @summary Set the ISO week to the given date.
|
|
3008
|
+
*
|
|
3009
|
+
* @description
|
|
3010
|
+
* Set the ISO week to the given date, saving the weekday number.
|
|
3011
|
+
*
|
|
3012
|
+
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
3013
|
+
*
|
|
3014
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
3015
|
+
* @typeParam ResultDate - The `Date` type of the context function.
|
|
3016
|
+
*
|
|
3017
|
+
* @param date - The date to be changed
|
|
3018
|
+
* @param week - The ISO week of the new date
|
|
3019
|
+
* @param options - An object with options
|
|
3020
|
+
*
|
|
3021
|
+
* @returns The new date with the ISO week set
|
|
3022
|
+
*
|
|
3023
|
+
* @example
|
|
3024
|
+
* // Set the 53rd ISO week to 7 August 2004:
|
|
3025
|
+
* const result = setISOWeek(new Date(2004, 7, 7), 53)
|
|
3026
|
+
* //=> Sat Jan 01 2005 00:00:00
|
|
3027
|
+
*/
|
|
3028
|
+
function setISOWeek(date, week, options) {
|
|
3029
|
+
const _date = toDate(date, options?.in);
|
|
3030
|
+
const diff = getISOWeek(_date, options) - week;
|
|
3031
|
+
_date.setDate(_date.getDate() - diff * 7);
|
|
3032
|
+
return _date;
|
|
3033
|
+
}
|
|
3034
|
+
//#endregion
|
|
3035
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js
|
|
3036
|
+
var ISOWeekParser = class extends Parser {
|
|
3037
|
+
priority = 100;
|
|
3038
|
+
parse(dateString, token, match) {
|
|
3039
|
+
switch (token) {
|
|
3040
|
+
case "I": return parseNumericPattern(numericPatterns.week, dateString);
|
|
3041
|
+
case "Io": return match.ordinalNumber(dateString, { unit: "week" });
|
|
3042
|
+
default: return parseNDigits(token.length, dateString);
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
validate(_date, value) {
|
|
3046
|
+
return value >= 1 && value <= 53;
|
|
3047
|
+
}
|
|
3048
|
+
set(date, _flags, value) {
|
|
3049
|
+
return startOfISOWeek(setISOWeek(date, value));
|
|
3050
|
+
}
|
|
3051
|
+
incompatibleTokens = [
|
|
3052
|
+
"y",
|
|
3053
|
+
"Y",
|
|
3054
|
+
"u",
|
|
3055
|
+
"q",
|
|
3056
|
+
"Q",
|
|
3057
|
+
"M",
|
|
3058
|
+
"L",
|
|
3059
|
+
"w",
|
|
3060
|
+
"d",
|
|
3061
|
+
"D",
|
|
3062
|
+
"e",
|
|
3063
|
+
"c",
|
|
3064
|
+
"t",
|
|
3065
|
+
"T"
|
|
3066
|
+
];
|
|
3067
|
+
};
|
|
3068
|
+
//#endregion
|
|
3069
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/DateParser.js
|
|
3070
|
+
var DAYS_IN_MONTH = [
|
|
3071
|
+
31,
|
|
3072
|
+
28,
|
|
3073
|
+
31,
|
|
3074
|
+
30,
|
|
3075
|
+
31,
|
|
3076
|
+
30,
|
|
3077
|
+
31,
|
|
3078
|
+
31,
|
|
3079
|
+
30,
|
|
3080
|
+
31,
|
|
3081
|
+
30,
|
|
3082
|
+
31
|
|
3083
|
+
];
|
|
3084
|
+
var DAYS_IN_MONTH_LEAP_YEAR = [
|
|
3085
|
+
31,
|
|
3086
|
+
29,
|
|
3087
|
+
31,
|
|
3088
|
+
30,
|
|
3089
|
+
31,
|
|
3090
|
+
30,
|
|
3091
|
+
31,
|
|
3092
|
+
31,
|
|
3093
|
+
30,
|
|
3094
|
+
31,
|
|
3095
|
+
30,
|
|
3096
|
+
31
|
|
3097
|
+
];
|
|
3098
|
+
var DateParser = class extends Parser {
|
|
3099
|
+
priority = 90;
|
|
3100
|
+
subPriority = 1;
|
|
3101
|
+
parse(dateString, token, match) {
|
|
3102
|
+
switch (token) {
|
|
3103
|
+
case "d": return parseNumericPattern(numericPatterns.date, dateString);
|
|
3104
|
+
case "do": return match.ordinalNumber(dateString, { unit: "date" });
|
|
3105
|
+
default: return parseNDigits(token.length, dateString);
|
|
3106
|
+
}
|
|
3107
|
+
}
|
|
3108
|
+
validate(date, value) {
|
|
3109
|
+
const isLeapYear = isLeapYearIndex(date.getFullYear());
|
|
3110
|
+
const month = date.getMonth();
|
|
3111
|
+
if (isLeapYear) return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];
|
|
3112
|
+
else return value >= 1 && value <= DAYS_IN_MONTH[month];
|
|
3113
|
+
}
|
|
3114
|
+
set(date, _flags, value) {
|
|
3115
|
+
date.setDate(value);
|
|
3116
|
+
date.setHours(0, 0, 0, 0);
|
|
3117
|
+
return date;
|
|
3118
|
+
}
|
|
3119
|
+
incompatibleTokens = [
|
|
3120
|
+
"Y",
|
|
3121
|
+
"R",
|
|
3122
|
+
"q",
|
|
3123
|
+
"Q",
|
|
3124
|
+
"w",
|
|
3125
|
+
"I",
|
|
3126
|
+
"D",
|
|
3127
|
+
"i",
|
|
3128
|
+
"e",
|
|
3129
|
+
"c",
|
|
3130
|
+
"t",
|
|
3131
|
+
"T"
|
|
3132
|
+
];
|
|
3133
|
+
};
|
|
3134
|
+
//#endregion
|
|
3135
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js
|
|
3136
|
+
var DayOfYearParser = class extends Parser {
|
|
3137
|
+
priority = 90;
|
|
3138
|
+
subpriority = 1;
|
|
3139
|
+
parse(dateString, token, match) {
|
|
3140
|
+
switch (token) {
|
|
3141
|
+
case "D":
|
|
3142
|
+
case "DD": return parseNumericPattern(numericPatterns.dayOfYear, dateString);
|
|
3143
|
+
case "Do": return match.ordinalNumber(dateString, { unit: "date" });
|
|
3144
|
+
default: return parseNDigits(token.length, dateString);
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
validate(date, value) {
|
|
3148
|
+
if (isLeapYearIndex(date.getFullYear())) return value >= 1 && value <= 366;
|
|
3149
|
+
else return value >= 1 && value <= 365;
|
|
3150
|
+
}
|
|
3151
|
+
set(date, _flags, value) {
|
|
3152
|
+
date.setMonth(0, value);
|
|
3153
|
+
date.setHours(0, 0, 0, 0);
|
|
3154
|
+
return date;
|
|
3155
|
+
}
|
|
3156
|
+
incompatibleTokens = [
|
|
3157
|
+
"Y",
|
|
3158
|
+
"R",
|
|
3159
|
+
"q",
|
|
3160
|
+
"Q",
|
|
3161
|
+
"M",
|
|
3162
|
+
"L",
|
|
3163
|
+
"w",
|
|
3164
|
+
"I",
|
|
3165
|
+
"d",
|
|
3166
|
+
"E",
|
|
3167
|
+
"i",
|
|
3168
|
+
"e",
|
|
3169
|
+
"c",
|
|
3170
|
+
"t",
|
|
3171
|
+
"T"
|
|
3172
|
+
];
|
|
3173
|
+
};
|
|
3174
|
+
//#endregion
|
|
3175
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addDays.js
|
|
3176
|
+
/**
|
|
3177
|
+
* The {@link addDays} function options.
|
|
3178
|
+
*/
|
|
3179
|
+
/**
|
|
3180
|
+
* @name addDays
|
|
3181
|
+
* @category Day Helpers
|
|
3182
|
+
* @summary Add the specified number of days to the given date.
|
|
3183
|
+
*
|
|
3184
|
+
* @description
|
|
3185
|
+
* Add the specified number of days to the given date.
|
|
3186
|
+
*
|
|
3187
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
3188
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
3189
|
+
*
|
|
3190
|
+
* @param date - The date to be changed
|
|
3191
|
+
* @param amount - The amount of days to be added.
|
|
3192
|
+
* @param options - An object with options
|
|
3193
|
+
*
|
|
3194
|
+
* @returns The new date with the days added
|
|
3195
|
+
*
|
|
3196
|
+
* @example
|
|
3197
|
+
* // Add 10 days to 1 September 2014:
|
|
3198
|
+
* const result = addDays(new Date(2014, 8, 1), 10)
|
|
3199
|
+
* //=> Thu Sep 11 2014 00:00:00
|
|
3200
|
+
*/
|
|
3201
|
+
function addDays$1(date, amount, options) {
|
|
3202
|
+
const _date = toDate(date, options?.in);
|
|
3203
|
+
if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
|
|
3204
|
+
if (!amount) return _date;
|
|
3205
|
+
_date.setDate(_date.getDate() + amount);
|
|
3206
|
+
return _date;
|
|
3207
|
+
}
|
|
3208
|
+
//#endregion
|
|
3209
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/setDay.js
|
|
3210
|
+
/**
|
|
3211
|
+
* The {@link setDay} function options.
|
|
3212
|
+
*/
|
|
3213
|
+
/**
|
|
3214
|
+
* @name setDay
|
|
3215
|
+
* @category Weekday Helpers
|
|
3216
|
+
* @summary Set the day of the week to the given date.
|
|
3217
|
+
*
|
|
3218
|
+
* @description
|
|
3219
|
+
* Set the day of the week to the given date.
|
|
3220
|
+
*
|
|
3221
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
3222
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
3223
|
+
*
|
|
3224
|
+
* @param date - The date to be changed
|
|
3225
|
+
* @param day - The day of the week of the new date
|
|
3226
|
+
* @param options - An object with options.
|
|
3227
|
+
*
|
|
3228
|
+
* @returns The new date with the day of the week set
|
|
3229
|
+
*
|
|
3230
|
+
* @example
|
|
3231
|
+
* // Set week day to Sunday, with the default weekStartsOn of Sunday:
|
|
3232
|
+
* const result = setDay(new Date(2014, 8, 1), 0)
|
|
3233
|
+
* //=> Sun Aug 31 2014 00:00:00
|
|
3234
|
+
*
|
|
3235
|
+
* @example
|
|
3236
|
+
* // Set week day to Sunday, with a weekStartsOn of Monday:
|
|
3237
|
+
* const result = setDay(new Date(2014, 8, 1), 0, { weekStartsOn: 1 })
|
|
3238
|
+
* //=> Sun Sep 07 2014 00:00:00
|
|
3239
|
+
*/
|
|
3240
|
+
function setDay(date, day, options) {
|
|
3241
|
+
const defaultOptions = getDefaultOptions$1();
|
|
3242
|
+
const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0;
|
|
3243
|
+
const date_ = toDate(date, options?.in);
|
|
3244
|
+
const currentDay = date_.getDay();
|
|
3245
|
+
const dayIndex = (day % 7 + 7) % 7;
|
|
3246
|
+
const delta = 7 - weekStartsOn;
|
|
3247
|
+
return addDays$1(date_, day < 0 || day > 6 ? day - (currentDay + delta) % 7 : (dayIndex + delta) % 7 - (currentDay + delta) % 7, options);
|
|
3248
|
+
}
|
|
3249
|
+
//#endregion
|
|
3250
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/DayParser.js
|
|
3251
|
+
var DayParser = class extends Parser {
|
|
3252
|
+
priority = 90;
|
|
3253
|
+
parse(dateString, token, match) {
|
|
3254
|
+
switch (token) {
|
|
3255
|
+
case "E":
|
|
3256
|
+
case "EE":
|
|
3257
|
+
case "EEE": return match.day(dateString, {
|
|
3258
|
+
width: "abbreviated",
|
|
3259
|
+
context: "formatting"
|
|
3260
|
+
}) || match.day(dateString, {
|
|
3261
|
+
width: "short",
|
|
3262
|
+
context: "formatting"
|
|
3263
|
+
}) || match.day(dateString, {
|
|
3264
|
+
width: "narrow",
|
|
3265
|
+
context: "formatting"
|
|
3266
|
+
});
|
|
3267
|
+
case "EEEEE": return match.day(dateString, {
|
|
3268
|
+
width: "narrow",
|
|
3269
|
+
context: "formatting"
|
|
3270
|
+
});
|
|
3271
|
+
case "EEEEEE": return match.day(dateString, {
|
|
3272
|
+
width: "short",
|
|
3273
|
+
context: "formatting"
|
|
3274
|
+
}) || match.day(dateString, {
|
|
3275
|
+
width: "narrow",
|
|
3276
|
+
context: "formatting"
|
|
3277
|
+
});
|
|
3278
|
+
default: return match.day(dateString, {
|
|
3279
|
+
width: "wide",
|
|
3280
|
+
context: "formatting"
|
|
3281
|
+
}) || match.day(dateString, {
|
|
3282
|
+
width: "abbreviated",
|
|
3283
|
+
context: "formatting"
|
|
3284
|
+
}) || match.day(dateString, {
|
|
3285
|
+
width: "short",
|
|
3286
|
+
context: "formatting"
|
|
3287
|
+
}) || match.day(dateString, {
|
|
3288
|
+
width: "narrow",
|
|
3289
|
+
context: "formatting"
|
|
3290
|
+
});
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
validate(_date, value) {
|
|
3294
|
+
return value >= 0 && value <= 6;
|
|
3295
|
+
}
|
|
3296
|
+
set(date, _flags, value, options) {
|
|
3297
|
+
date = setDay(date, value, options);
|
|
3298
|
+
date.setHours(0, 0, 0, 0);
|
|
3299
|
+
return date;
|
|
3300
|
+
}
|
|
3301
|
+
incompatibleTokens = [
|
|
3302
|
+
"D",
|
|
3303
|
+
"i",
|
|
3304
|
+
"e",
|
|
3305
|
+
"c",
|
|
3306
|
+
"t",
|
|
3307
|
+
"T"
|
|
3308
|
+
];
|
|
3309
|
+
};
|
|
3310
|
+
//#endregion
|
|
3311
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js
|
|
3312
|
+
var LocalDayParser = class extends Parser {
|
|
3313
|
+
priority = 90;
|
|
3314
|
+
parse(dateString, token, match, options) {
|
|
3315
|
+
const valueCallback = (value) => {
|
|
3316
|
+
const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
|
|
3317
|
+
return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
|
|
3318
|
+
};
|
|
3319
|
+
switch (token) {
|
|
3320
|
+
case "e":
|
|
3321
|
+
case "ee": return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
|
3322
|
+
case "eo": return mapValue(match.ordinalNumber(dateString, { unit: "day" }), valueCallback);
|
|
3323
|
+
case "eee": return match.day(dateString, {
|
|
3324
|
+
width: "abbreviated",
|
|
3325
|
+
context: "formatting"
|
|
3326
|
+
}) || match.day(dateString, {
|
|
3327
|
+
width: "short",
|
|
3328
|
+
context: "formatting"
|
|
3329
|
+
}) || match.day(dateString, {
|
|
3330
|
+
width: "narrow",
|
|
3331
|
+
context: "formatting"
|
|
3332
|
+
});
|
|
3333
|
+
case "eeeee": return match.day(dateString, {
|
|
3334
|
+
width: "narrow",
|
|
3335
|
+
context: "formatting"
|
|
3336
|
+
});
|
|
3337
|
+
case "eeeeee": return match.day(dateString, {
|
|
3338
|
+
width: "short",
|
|
3339
|
+
context: "formatting"
|
|
3340
|
+
}) || match.day(dateString, {
|
|
3341
|
+
width: "narrow",
|
|
3342
|
+
context: "formatting"
|
|
3343
|
+
});
|
|
3344
|
+
default: return match.day(dateString, {
|
|
3345
|
+
width: "wide",
|
|
3346
|
+
context: "formatting"
|
|
3347
|
+
}) || match.day(dateString, {
|
|
3348
|
+
width: "abbreviated",
|
|
3349
|
+
context: "formatting"
|
|
3350
|
+
}) || match.day(dateString, {
|
|
3351
|
+
width: "short",
|
|
3352
|
+
context: "formatting"
|
|
3353
|
+
}) || match.day(dateString, {
|
|
3354
|
+
width: "narrow",
|
|
3355
|
+
context: "formatting"
|
|
3356
|
+
});
|
|
3357
|
+
}
|
|
3358
|
+
}
|
|
3359
|
+
validate(_date, value) {
|
|
3360
|
+
return value >= 0 && value <= 6;
|
|
3361
|
+
}
|
|
3362
|
+
set(date, _flags, value, options) {
|
|
3363
|
+
date = setDay(date, value, options);
|
|
3364
|
+
date.setHours(0, 0, 0, 0);
|
|
3365
|
+
return date;
|
|
3366
|
+
}
|
|
3367
|
+
incompatibleTokens = [
|
|
3368
|
+
"y",
|
|
3369
|
+
"R",
|
|
3370
|
+
"u",
|
|
3371
|
+
"q",
|
|
3372
|
+
"Q",
|
|
3373
|
+
"M",
|
|
3374
|
+
"L",
|
|
3375
|
+
"I",
|
|
3376
|
+
"d",
|
|
3377
|
+
"D",
|
|
3378
|
+
"E",
|
|
3379
|
+
"i",
|
|
3380
|
+
"c",
|
|
3381
|
+
"t",
|
|
3382
|
+
"T"
|
|
3383
|
+
];
|
|
3384
|
+
};
|
|
3385
|
+
//#endregion
|
|
3386
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js
|
|
3387
|
+
var StandAloneLocalDayParser = class extends Parser {
|
|
3388
|
+
priority = 90;
|
|
3389
|
+
parse(dateString, token, match, options) {
|
|
3390
|
+
const valueCallback = (value) => {
|
|
3391
|
+
const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
|
|
3392
|
+
return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
|
|
3393
|
+
};
|
|
3394
|
+
switch (token) {
|
|
3395
|
+
case "c":
|
|
3396
|
+
case "cc": return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
|
3397
|
+
case "co": return mapValue(match.ordinalNumber(dateString, { unit: "day" }), valueCallback);
|
|
3398
|
+
case "ccc": return match.day(dateString, {
|
|
3399
|
+
width: "abbreviated",
|
|
3400
|
+
context: "standalone"
|
|
3401
|
+
}) || match.day(dateString, {
|
|
3402
|
+
width: "short",
|
|
3403
|
+
context: "standalone"
|
|
3404
|
+
}) || match.day(dateString, {
|
|
3405
|
+
width: "narrow",
|
|
3406
|
+
context: "standalone"
|
|
3407
|
+
});
|
|
3408
|
+
case "ccccc": return match.day(dateString, {
|
|
3409
|
+
width: "narrow",
|
|
3410
|
+
context: "standalone"
|
|
3411
|
+
});
|
|
3412
|
+
case "cccccc": return match.day(dateString, {
|
|
3413
|
+
width: "short",
|
|
3414
|
+
context: "standalone"
|
|
3415
|
+
}) || match.day(dateString, {
|
|
3416
|
+
width: "narrow",
|
|
3417
|
+
context: "standalone"
|
|
3418
|
+
});
|
|
3419
|
+
default: return match.day(dateString, {
|
|
3420
|
+
width: "wide",
|
|
3421
|
+
context: "standalone"
|
|
3422
|
+
}) || match.day(dateString, {
|
|
3423
|
+
width: "abbreviated",
|
|
3424
|
+
context: "standalone"
|
|
3425
|
+
}) || match.day(dateString, {
|
|
3426
|
+
width: "short",
|
|
3427
|
+
context: "standalone"
|
|
3428
|
+
}) || match.day(dateString, {
|
|
3429
|
+
width: "narrow",
|
|
3430
|
+
context: "standalone"
|
|
3431
|
+
});
|
|
3432
|
+
}
|
|
3433
|
+
}
|
|
3434
|
+
validate(_date, value) {
|
|
3435
|
+
return value >= 0 && value <= 6;
|
|
3436
|
+
}
|
|
3437
|
+
set(date, _flags, value, options) {
|
|
3438
|
+
date = setDay(date, value, options);
|
|
3439
|
+
date.setHours(0, 0, 0, 0);
|
|
3440
|
+
return date;
|
|
3441
|
+
}
|
|
3442
|
+
incompatibleTokens = [
|
|
3443
|
+
"y",
|
|
3444
|
+
"R",
|
|
3445
|
+
"u",
|
|
3446
|
+
"q",
|
|
3447
|
+
"Q",
|
|
3448
|
+
"M",
|
|
3449
|
+
"L",
|
|
3450
|
+
"I",
|
|
3451
|
+
"d",
|
|
3452
|
+
"D",
|
|
3453
|
+
"E",
|
|
3454
|
+
"i",
|
|
3455
|
+
"e",
|
|
3456
|
+
"t",
|
|
3457
|
+
"T"
|
|
3458
|
+
];
|
|
3459
|
+
};
|
|
3460
|
+
//#endregion
|
|
3461
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISODay.js
|
|
3462
|
+
/**
|
|
3463
|
+
* The {@link getISODay} function options.
|
|
3464
|
+
*/
|
|
3465
|
+
/**
|
|
3466
|
+
* @name getISODay
|
|
3467
|
+
* @category Weekday Helpers
|
|
3468
|
+
* @summary Get the day of the ISO week of the given date.
|
|
3469
|
+
*
|
|
3470
|
+
* @description
|
|
3471
|
+
* Get the day of the ISO week of the given date,
|
|
3472
|
+
* which is 7 for Sunday, 1 for Monday etc.
|
|
3473
|
+
*
|
|
3474
|
+
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
3475
|
+
*
|
|
3476
|
+
* @param date - The given date
|
|
3477
|
+
* @param options - An object with options
|
|
3478
|
+
*
|
|
3479
|
+
* @returns The day of ISO week
|
|
3480
|
+
*
|
|
3481
|
+
* @example
|
|
3482
|
+
* // Which day of the ISO week is 26 February 2012?
|
|
3483
|
+
* const result = getISODay(new Date(2012, 1, 26))
|
|
3484
|
+
* //=> 7
|
|
3485
|
+
*/
|
|
3486
|
+
function getISODay(date, options) {
|
|
3487
|
+
const day = toDate(date, options?.in).getDay();
|
|
3488
|
+
return day === 0 ? 7 : day;
|
|
3489
|
+
}
|
|
3490
|
+
//#endregion
|
|
3491
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/setISODay.js
|
|
3492
|
+
/**
|
|
3493
|
+
* The {@link setISODay} function options.
|
|
3494
|
+
*/
|
|
3495
|
+
/**
|
|
3496
|
+
* @name setISODay
|
|
3497
|
+
* @category Weekday Helpers
|
|
3498
|
+
* @summary Set the day of the ISO week to the given date.
|
|
3499
|
+
*
|
|
3500
|
+
* @description
|
|
3501
|
+
* Set the day of the ISO week to the given date.
|
|
3502
|
+
* ISO week starts with Monday.
|
|
3503
|
+
* 7 is the index of Sunday, 1 is the index of Monday, etc.
|
|
3504
|
+
*
|
|
3505
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
3506
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
3507
|
+
*
|
|
3508
|
+
* @param date - The date to be changed
|
|
3509
|
+
* @param day - The day of the ISO week of the new date
|
|
3510
|
+
* @param options - An object with options
|
|
3511
|
+
*
|
|
3512
|
+
* @returns The new date with the day of the ISO week set
|
|
3513
|
+
*
|
|
3514
|
+
* @example
|
|
3515
|
+
* // Set Sunday to 1 September 2014:
|
|
3516
|
+
* const result = setISODay(new Date(2014, 8, 1), 7)
|
|
3517
|
+
* //=> Sun Sep 07 2014 00:00:00
|
|
3518
|
+
*/
|
|
3519
|
+
function setISODay(date, day, options) {
|
|
3520
|
+
const date_ = toDate(date, options?.in);
|
|
3521
|
+
return addDays$1(date_, day - getISODay(date_, options), options);
|
|
3522
|
+
}
|
|
3523
|
+
//#endregion
|
|
3524
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/ISODayParser.js
|
|
3525
|
+
var ISODayParser = class extends Parser {
|
|
3526
|
+
priority = 90;
|
|
3527
|
+
parse(dateString, token, match) {
|
|
3528
|
+
const valueCallback = (value) => {
|
|
3529
|
+
if (value === 0) return 7;
|
|
3530
|
+
return value;
|
|
3531
|
+
};
|
|
3532
|
+
switch (token) {
|
|
3533
|
+
case "i":
|
|
3534
|
+
case "ii": return parseNDigits(token.length, dateString);
|
|
3535
|
+
case "io": return match.ordinalNumber(dateString, { unit: "day" });
|
|
3536
|
+
case "iii": return mapValue(match.day(dateString, {
|
|
3537
|
+
width: "abbreviated",
|
|
3538
|
+
context: "formatting"
|
|
3539
|
+
}) || match.day(dateString, {
|
|
3540
|
+
width: "short",
|
|
3541
|
+
context: "formatting"
|
|
3542
|
+
}) || match.day(dateString, {
|
|
3543
|
+
width: "narrow",
|
|
3544
|
+
context: "formatting"
|
|
3545
|
+
}), valueCallback);
|
|
3546
|
+
case "iiiii": return mapValue(match.day(dateString, {
|
|
3547
|
+
width: "narrow",
|
|
3548
|
+
context: "formatting"
|
|
3549
|
+
}), valueCallback);
|
|
3550
|
+
case "iiiiii": return mapValue(match.day(dateString, {
|
|
3551
|
+
width: "short",
|
|
3552
|
+
context: "formatting"
|
|
3553
|
+
}) || match.day(dateString, {
|
|
3554
|
+
width: "narrow",
|
|
3555
|
+
context: "formatting"
|
|
3556
|
+
}), valueCallback);
|
|
3557
|
+
default: return mapValue(match.day(dateString, {
|
|
3558
|
+
width: "wide",
|
|
3559
|
+
context: "formatting"
|
|
3560
|
+
}) || match.day(dateString, {
|
|
3561
|
+
width: "abbreviated",
|
|
3562
|
+
context: "formatting"
|
|
3563
|
+
}) || match.day(dateString, {
|
|
3564
|
+
width: "short",
|
|
3565
|
+
context: "formatting"
|
|
3566
|
+
}) || match.day(dateString, {
|
|
3567
|
+
width: "narrow",
|
|
3568
|
+
context: "formatting"
|
|
3569
|
+
}), valueCallback);
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
validate(_date, value) {
|
|
3573
|
+
return value >= 1 && value <= 7;
|
|
3574
|
+
}
|
|
3575
|
+
set(date, _flags, value) {
|
|
3576
|
+
date = setISODay(date, value);
|
|
3577
|
+
date.setHours(0, 0, 0, 0);
|
|
3578
|
+
return date;
|
|
3579
|
+
}
|
|
3580
|
+
incompatibleTokens = [
|
|
3581
|
+
"y",
|
|
3582
|
+
"Y",
|
|
3583
|
+
"u",
|
|
3584
|
+
"q",
|
|
3585
|
+
"Q",
|
|
3586
|
+
"M",
|
|
3587
|
+
"L",
|
|
3588
|
+
"w",
|
|
3589
|
+
"d",
|
|
3590
|
+
"D",
|
|
3591
|
+
"E",
|
|
3592
|
+
"e",
|
|
3593
|
+
"c",
|
|
3594
|
+
"t",
|
|
3595
|
+
"T"
|
|
3596
|
+
];
|
|
3597
|
+
};
|
|
3598
|
+
//#endregion
|
|
3599
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/AMPMParser.js
|
|
3600
|
+
var AMPMParser = class extends Parser {
|
|
3601
|
+
priority = 80;
|
|
3602
|
+
parse(dateString, token, match) {
|
|
3603
|
+
switch (token) {
|
|
3604
|
+
case "a":
|
|
3605
|
+
case "aa":
|
|
3606
|
+
case "aaa": return match.dayPeriod(dateString, {
|
|
3607
|
+
width: "abbreviated",
|
|
3608
|
+
context: "formatting"
|
|
3609
|
+
}) || match.dayPeriod(dateString, {
|
|
3610
|
+
width: "narrow",
|
|
3611
|
+
context: "formatting"
|
|
3612
|
+
});
|
|
3613
|
+
case "aaaaa": return match.dayPeriod(dateString, {
|
|
3614
|
+
width: "narrow",
|
|
3615
|
+
context: "formatting"
|
|
3616
|
+
});
|
|
3617
|
+
default: return match.dayPeriod(dateString, {
|
|
3618
|
+
width: "wide",
|
|
3619
|
+
context: "formatting"
|
|
3620
|
+
}) || match.dayPeriod(dateString, {
|
|
3621
|
+
width: "abbreviated",
|
|
3622
|
+
context: "formatting"
|
|
3623
|
+
}) || match.dayPeriod(dateString, {
|
|
3624
|
+
width: "narrow",
|
|
3625
|
+
context: "formatting"
|
|
3626
|
+
});
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
set(date, _flags, value) {
|
|
3630
|
+
date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
|
3631
|
+
return date;
|
|
3632
|
+
}
|
|
3633
|
+
incompatibleTokens = [
|
|
3634
|
+
"b",
|
|
3635
|
+
"B",
|
|
3636
|
+
"H",
|
|
3637
|
+
"k",
|
|
3638
|
+
"t",
|
|
3639
|
+
"T"
|
|
3640
|
+
];
|
|
3641
|
+
};
|
|
3642
|
+
//#endregion
|
|
3643
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.js
|
|
3644
|
+
var AMPMMidnightParser = class extends Parser {
|
|
3645
|
+
priority = 80;
|
|
3646
|
+
parse(dateString, token, match) {
|
|
3647
|
+
switch (token) {
|
|
3648
|
+
case "b":
|
|
3649
|
+
case "bb":
|
|
3650
|
+
case "bbb": return match.dayPeriod(dateString, {
|
|
3651
|
+
width: "abbreviated",
|
|
3652
|
+
context: "formatting"
|
|
3653
|
+
}) || match.dayPeriod(dateString, {
|
|
3654
|
+
width: "narrow",
|
|
3655
|
+
context: "formatting"
|
|
3656
|
+
});
|
|
3657
|
+
case "bbbbb": return match.dayPeriod(dateString, {
|
|
3658
|
+
width: "narrow",
|
|
3659
|
+
context: "formatting"
|
|
3660
|
+
});
|
|
3661
|
+
default: return match.dayPeriod(dateString, {
|
|
3662
|
+
width: "wide",
|
|
3663
|
+
context: "formatting"
|
|
3664
|
+
}) || match.dayPeriod(dateString, {
|
|
3665
|
+
width: "abbreviated",
|
|
3666
|
+
context: "formatting"
|
|
3667
|
+
}) || match.dayPeriod(dateString, {
|
|
3668
|
+
width: "narrow",
|
|
3669
|
+
context: "formatting"
|
|
3670
|
+
});
|
|
3671
|
+
}
|
|
3672
|
+
}
|
|
3673
|
+
set(date, _flags, value) {
|
|
3674
|
+
date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
|
3675
|
+
return date;
|
|
3676
|
+
}
|
|
3677
|
+
incompatibleTokens = [
|
|
3678
|
+
"a",
|
|
3679
|
+
"B",
|
|
3680
|
+
"H",
|
|
3681
|
+
"k",
|
|
3682
|
+
"t",
|
|
3683
|
+
"T"
|
|
3684
|
+
];
|
|
3685
|
+
};
|
|
3686
|
+
//#endregion
|
|
3687
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.js
|
|
3688
|
+
var DayPeriodParser = class extends Parser {
|
|
3689
|
+
priority = 80;
|
|
3690
|
+
parse(dateString, token, match) {
|
|
3691
|
+
switch (token) {
|
|
3692
|
+
case "B":
|
|
3693
|
+
case "BB":
|
|
3694
|
+
case "BBB": return match.dayPeriod(dateString, {
|
|
3695
|
+
width: "abbreviated",
|
|
3696
|
+
context: "formatting"
|
|
3697
|
+
}) || match.dayPeriod(dateString, {
|
|
3698
|
+
width: "narrow",
|
|
3699
|
+
context: "formatting"
|
|
3700
|
+
});
|
|
3701
|
+
case "BBBBB": return match.dayPeriod(dateString, {
|
|
3702
|
+
width: "narrow",
|
|
3703
|
+
context: "formatting"
|
|
3704
|
+
});
|
|
3705
|
+
default: return match.dayPeriod(dateString, {
|
|
3706
|
+
width: "wide",
|
|
3707
|
+
context: "formatting"
|
|
3708
|
+
}) || match.dayPeriod(dateString, {
|
|
3709
|
+
width: "abbreviated",
|
|
3710
|
+
context: "formatting"
|
|
3711
|
+
}) || match.dayPeriod(dateString, {
|
|
3712
|
+
width: "narrow",
|
|
3713
|
+
context: "formatting"
|
|
3714
|
+
});
|
|
3715
|
+
}
|
|
3716
|
+
}
|
|
3717
|
+
set(date, _flags, value) {
|
|
3718
|
+
date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
|
3719
|
+
return date;
|
|
3720
|
+
}
|
|
3721
|
+
incompatibleTokens = [
|
|
3722
|
+
"a",
|
|
3723
|
+
"b",
|
|
3724
|
+
"t",
|
|
3725
|
+
"T"
|
|
3726
|
+
];
|
|
3727
|
+
};
|
|
3728
|
+
//#endregion
|
|
3729
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.js
|
|
3730
|
+
var Hour1to12Parser = class extends Parser {
|
|
3731
|
+
priority = 70;
|
|
3732
|
+
parse(dateString, token, match) {
|
|
3733
|
+
switch (token) {
|
|
3734
|
+
case "h": return parseNumericPattern(numericPatterns.hour12h, dateString);
|
|
3735
|
+
case "ho": return match.ordinalNumber(dateString, { unit: "hour" });
|
|
3736
|
+
default: return parseNDigits(token.length, dateString);
|
|
3737
|
+
}
|
|
3738
|
+
}
|
|
3739
|
+
validate(_date, value) {
|
|
3740
|
+
return value >= 1 && value <= 12;
|
|
3741
|
+
}
|
|
3742
|
+
set(date, _flags, value) {
|
|
3743
|
+
const isPM = date.getHours() >= 12;
|
|
3744
|
+
if (isPM && value < 12) date.setHours(value + 12, 0, 0, 0);
|
|
3745
|
+
else if (!isPM && value === 12) date.setHours(0, 0, 0, 0);
|
|
3746
|
+
else date.setHours(value, 0, 0, 0);
|
|
3747
|
+
return date;
|
|
3748
|
+
}
|
|
3749
|
+
incompatibleTokens = [
|
|
3750
|
+
"H",
|
|
3751
|
+
"K",
|
|
3752
|
+
"k",
|
|
3753
|
+
"t",
|
|
3754
|
+
"T"
|
|
3755
|
+
];
|
|
3756
|
+
};
|
|
3757
|
+
//#endregion
|
|
3758
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.js
|
|
3759
|
+
var Hour0to23Parser = class extends Parser {
|
|
3760
|
+
priority = 70;
|
|
3761
|
+
parse(dateString, token, match) {
|
|
3762
|
+
switch (token) {
|
|
3763
|
+
case "H": return parseNumericPattern(numericPatterns.hour23h, dateString);
|
|
3764
|
+
case "Ho": return match.ordinalNumber(dateString, { unit: "hour" });
|
|
3765
|
+
default: return parseNDigits(token.length, dateString);
|
|
3766
|
+
}
|
|
3767
|
+
}
|
|
3768
|
+
validate(_date, value) {
|
|
3769
|
+
return value >= 0 && value <= 23;
|
|
3770
|
+
}
|
|
3771
|
+
set(date, _flags, value) {
|
|
3772
|
+
date.setHours(value, 0, 0, 0);
|
|
3773
|
+
return date;
|
|
3774
|
+
}
|
|
3775
|
+
incompatibleTokens = [
|
|
3776
|
+
"a",
|
|
3777
|
+
"b",
|
|
3778
|
+
"h",
|
|
3779
|
+
"K",
|
|
3780
|
+
"k",
|
|
3781
|
+
"t",
|
|
3782
|
+
"T"
|
|
3783
|
+
];
|
|
3784
|
+
};
|
|
3785
|
+
//#endregion
|
|
3786
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.js
|
|
3787
|
+
var Hour0To11Parser = class extends Parser {
|
|
3788
|
+
priority = 70;
|
|
3789
|
+
parse(dateString, token, match) {
|
|
3790
|
+
switch (token) {
|
|
3791
|
+
case "K": return parseNumericPattern(numericPatterns.hour11h, dateString);
|
|
3792
|
+
case "Ko": return match.ordinalNumber(dateString, { unit: "hour" });
|
|
3793
|
+
default: return parseNDigits(token.length, dateString);
|
|
3794
|
+
}
|
|
3795
|
+
}
|
|
3796
|
+
validate(_date, value) {
|
|
3797
|
+
return value >= 0 && value <= 11;
|
|
3798
|
+
}
|
|
3799
|
+
set(date, _flags, value) {
|
|
3800
|
+
if (date.getHours() >= 12 && value < 12) date.setHours(value + 12, 0, 0, 0);
|
|
3801
|
+
else date.setHours(value, 0, 0, 0);
|
|
3802
|
+
return date;
|
|
3803
|
+
}
|
|
3804
|
+
incompatibleTokens = [
|
|
3805
|
+
"h",
|
|
3806
|
+
"H",
|
|
3807
|
+
"k",
|
|
3808
|
+
"t",
|
|
3809
|
+
"T"
|
|
3810
|
+
];
|
|
3811
|
+
};
|
|
3812
|
+
//#endregion
|
|
3813
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.js
|
|
3814
|
+
var Hour1To24Parser = class extends Parser {
|
|
3815
|
+
priority = 70;
|
|
3816
|
+
parse(dateString, token, match) {
|
|
3817
|
+
switch (token) {
|
|
3818
|
+
case "k": return parseNumericPattern(numericPatterns.hour24h, dateString);
|
|
3819
|
+
case "ko": return match.ordinalNumber(dateString, { unit: "hour" });
|
|
3820
|
+
default: return parseNDigits(token.length, dateString);
|
|
3821
|
+
}
|
|
3822
|
+
}
|
|
3823
|
+
validate(_date, value) {
|
|
3824
|
+
return value >= 1 && value <= 24;
|
|
3825
|
+
}
|
|
3826
|
+
set(date, _flags, value) {
|
|
3827
|
+
const hours = value <= 24 ? value % 24 : value;
|
|
3828
|
+
date.setHours(hours, 0, 0, 0);
|
|
3829
|
+
return date;
|
|
3830
|
+
}
|
|
3831
|
+
incompatibleTokens = [
|
|
3832
|
+
"a",
|
|
3833
|
+
"b",
|
|
3834
|
+
"h",
|
|
3835
|
+
"H",
|
|
3836
|
+
"K",
|
|
3837
|
+
"t",
|
|
3838
|
+
"T"
|
|
3839
|
+
];
|
|
3840
|
+
};
|
|
3841
|
+
//#endregion
|
|
3842
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/MinuteParser.js
|
|
3843
|
+
var MinuteParser = class extends Parser {
|
|
3844
|
+
priority = 60;
|
|
3845
|
+
parse(dateString, token, match) {
|
|
3846
|
+
switch (token) {
|
|
3847
|
+
case "m": return parseNumericPattern(numericPatterns.minute, dateString);
|
|
3848
|
+
case "mo": return match.ordinalNumber(dateString, { unit: "minute" });
|
|
3849
|
+
default: return parseNDigits(token.length, dateString);
|
|
3850
|
+
}
|
|
3851
|
+
}
|
|
3852
|
+
validate(_date, value) {
|
|
3853
|
+
return value >= 0 && value <= 59;
|
|
3854
|
+
}
|
|
3855
|
+
set(date, _flags, value) {
|
|
3856
|
+
date.setMinutes(value, 0, 0);
|
|
3857
|
+
return date;
|
|
3858
|
+
}
|
|
3859
|
+
incompatibleTokens = ["t", "T"];
|
|
3860
|
+
};
|
|
3861
|
+
//#endregion
|
|
3862
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/SecondParser.js
|
|
3863
|
+
var SecondParser = class extends Parser {
|
|
3864
|
+
priority = 50;
|
|
3865
|
+
parse(dateString, token, match) {
|
|
3866
|
+
switch (token) {
|
|
3867
|
+
case "s": return parseNumericPattern(numericPatterns.second, dateString);
|
|
3868
|
+
case "so": return match.ordinalNumber(dateString, { unit: "second" });
|
|
3869
|
+
default: return parseNDigits(token.length, dateString);
|
|
3870
|
+
}
|
|
3871
|
+
}
|
|
3872
|
+
validate(_date, value) {
|
|
3873
|
+
return value >= 0 && value <= 59;
|
|
3874
|
+
}
|
|
3875
|
+
set(date, _flags, value) {
|
|
3876
|
+
date.setSeconds(value, 0);
|
|
3877
|
+
return date;
|
|
3878
|
+
}
|
|
3879
|
+
incompatibleTokens = ["t", "T"];
|
|
3880
|
+
};
|
|
3881
|
+
//#endregion
|
|
3882
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.js
|
|
3883
|
+
var FractionOfSecondParser = class extends Parser {
|
|
3884
|
+
priority = 30;
|
|
3885
|
+
parse(dateString, token) {
|
|
3886
|
+
const valueCallback = (value) => Math.trunc(value * Math.pow(10, -token.length + 3));
|
|
3887
|
+
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
|
3888
|
+
}
|
|
3889
|
+
set(date, _flags, value) {
|
|
3890
|
+
date.setMilliseconds(value);
|
|
3891
|
+
return date;
|
|
3892
|
+
}
|
|
3893
|
+
incompatibleTokens = ["t", "T"];
|
|
3894
|
+
};
|
|
3895
|
+
//#endregion
|
|
3896
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js
|
|
3897
|
+
var ISOTimezoneWithZParser = class extends Parser {
|
|
3898
|
+
priority = 10;
|
|
3899
|
+
parse(dateString, token) {
|
|
3900
|
+
switch (token) {
|
|
3901
|
+
case "X": return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);
|
|
3902
|
+
case "XX": return parseTimezonePattern(timezonePatterns.basic, dateString);
|
|
3903
|
+
case "XXXX": return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);
|
|
3904
|
+
case "XXXXX": return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);
|
|
3905
|
+
default: return parseTimezonePattern(timezonePatterns.extended, dateString);
|
|
3906
|
+
}
|
|
3907
|
+
}
|
|
3908
|
+
set(date, flags, value) {
|
|
3909
|
+
if (flags.timestampIsSet) return date;
|
|
3910
|
+
return constructFrom(date, date.getTime() - getTimezoneOffsetInMilliseconds(date) - value);
|
|
3911
|
+
}
|
|
3912
|
+
incompatibleTokens = [
|
|
3913
|
+
"t",
|
|
3914
|
+
"T",
|
|
3915
|
+
"x"
|
|
3916
|
+
];
|
|
3917
|
+
};
|
|
3918
|
+
//#endregion
|
|
3919
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.js
|
|
3920
|
+
var ISOTimezoneParser = class extends Parser {
|
|
3921
|
+
priority = 10;
|
|
3922
|
+
parse(dateString, token) {
|
|
3923
|
+
switch (token) {
|
|
3924
|
+
case "x": return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);
|
|
3925
|
+
case "xx": return parseTimezonePattern(timezonePatterns.basic, dateString);
|
|
3926
|
+
case "xxxx": return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);
|
|
3927
|
+
case "xxxxx": return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);
|
|
3928
|
+
default: return parseTimezonePattern(timezonePatterns.extended, dateString);
|
|
3929
|
+
}
|
|
3930
|
+
}
|
|
3931
|
+
set(date, flags, value) {
|
|
3932
|
+
if (flags.timestampIsSet) return date;
|
|
3933
|
+
return constructFrom(date, date.getTime() - getTimezoneOffsetInMilliseconds(date) - value);
|
|
3934
|
+
}
|
|
3935
|
+
incompatibleTokens = [
|
|
3936
|
+
"t",
|
|
3937
|
+
"T",
|
|
3938
|
+
"X"
|
|
3939
|
+
];
|
|
3940
|
+
};
|
|
3941
|
+
//#endregion
|
|
3942
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.js
|
|
3943
|
+
var TimestampSecondsParser = class extends Parser {
|
|
3944
|
+
priority = 40;
|
|
3945
|
+
parse(dateString) {
|
|
3946
|
+
return parseAnyDigitsSigned(dateString);
|
|
3947
|
+
}
|
|
3948
|
+
set(date, _flags, value) {
|
|
3949
|
+
return [constructFrom(date, value * 1e3), { timestampIsSet: true }];
|
|
3950
|
+
}
|
|
3951
|
+
incompatibleTokens = "*";
|
|
3952
|
+
};
|
|
3953
|
+
//#endregion
|
|
3954
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js
|
|
3955
|
+
var TimestampMillisecondsParser = class extends Parser {
|
|
3956
|
+
priority = 20;
|
|
3957
|
+
parse(dateString) {
|
|
3958
|
+
return parseAnyDigitsSigned(dateString);
|
|
3959
|
+
}
|
|
3960
|
+
set(date, _flags, value) {
|
|
3961
|
+
return [constructFrom(date, value), { timestampIsSet: true }];
|
|
3962
|
+
}
|
|
3963
|
+
incompatibleTokens = "*";
|
|
3964
|
+
};
|
|
3965
|
+
//#endregion
|
|
3966
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers.js
|
|
3967
|
+
var parsers = {
|
|
3968
|
+
G: new EraParser(),
|
|
3969
|
+
y: new YearParser(),
|
|
3970
|
+
Y: new LocalWeekYearParser(),
|
|
3971
|
+
R: new ISOWeekYearParser(),
|
|
3972
|
+
u: new ExtendedYearParser(),
|
|
3973
|
+
Q: new QuarterParser(),
|
|
3974
|
+
q: new StandAloneQuarterParser(),
|
|
3975
|
+
M: new MonthParser(),
|
|
3976
|
+
L: new StandAloneMonthParser(),
|
|
3977
|
+
w: new LocalWeekParser(),
|
|
3978
|
+
I: new ISOWeekParser(),
|
|
3979
|
+
d: new DateParser(),
|
|
3980
|
+
D: new DayOfYearParser(),
|
|
3981
|
+
E: new DayParser(),
|
|
3982
|
+
e: new LocalDayParser(),
|
|
3983
|
+
c: new StandAloneLocalDayParser(),
|
|
3984
|
+
i: new ISODayParser(),
|
|
3985
|
+
a: new AMPMParser(),
|
|
3986
|
+
b: new AMPMMidnightParser(),
|
|
3987
|
+
B: new DayPeriodParser(),
|
|
3988
|
+
h: new Hour1to12Parser(),
|
|
3989
|
+
H: new Hour0to23Parser(),
|
|
3990
|
+
K: new Hour0To11Parser(),
|
|
3991
|
+
k: new Hour1To24Parser(),
|
|
3992
|
+
m: new MinuteParser(),
|
|
3993
|
+
s: new SecondParser(),
|
|
3994
|
+
S: new FractionOfSecondParser(),
|
|
3995
|
+
X: new ISOTimezoneWithZParser(),
|
|
3996
|
+
x: new ISOTimezoneParser(),
|
|
3997
|
+
t: new TimestampSecondsParser(),
|
|
3998
|
+
T: new TimestampMillisecondsParser()
|
|
3999
|
+
};
|
|
4000
|
+
//#endregion
|
|
4001
|
+
//#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse.js
|
|
4002
|
+
/**
|
|
4003
|
+
* The {@link parse} function options.
|
|
4004
|
+
*/
|
|
4005
|
+
var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
|
4006
|
+
var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
4007
|
+
var escapedStringRegExp = /^'([^]*?)'?$/;
|
|
4008
|
+
var doubleQuoteRegExp = /''/g;
|
|
4009
|
+
var notWhitespaceRegExp = /\S/;
|
|
4010
|
+
var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
4011
|
+
/**
|
|
4012
|
+
* @name parse
|
|
4013
|
+
* @category Common Helpers
|
|
4014
|
+
* @summary Parse the date.
|
|
4015
|
+
*
|
|
4016
|
+
* @description
|
|
4017
|
+
* Return the date parsed from string using the given format string.
|
|
4018
|
+
*
|
|
4019
|
+
* > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
|
|
4020
|
+
* > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
4021
|
+
*
|
|
4022
|
+
* The characters in the format string wrapped between two single quotes characters (') are escaped.
|
|
4023
|
+
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
|
|
4024
|
+
*
|
|
4025
|
+
* Format of the format string is based on Unicode Technical Standard #35:
|
|
4026
|
+
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
4027
|
+
* with a few additions (see note 5 below the table).
|
|
4028
|
+
*
|
|
4029
|
+
* Not all tokens are compatible. Combinations that don't make sense or could lead to bugs are prohibited
|
|
4030
|
+
* and will throw `RangeError`. For example usage of 24-hour format token with AM/PM token will throw an exception:
|
|
4031
|
+
*
|
|
4032
|
+
* ```javascript
|
|
4033
|
+
* parse('23 AM', 'HH a', new Date())
|
|
4034
|
+
* //=> RangeError: The format string mustn't contain `HH` and `a` at the same time
|
|
4035
|
+
* ```
|
|
4036
|
+
*
|
|
4037
|
+
* See the compatibility table: https://docs.google.com/spreadsheets/d/e/2PACX-1vQOPU3xUhplll6dyoMmVUXHKl_8CRDs6_ueLmex3SoqwhuolkuN3O05l4rqx5h1dKX8eb46Ul-CCSrq/pubhtml?gid=0&single=true
|
|
4038
|
+
*
|
|
4039
|
+
* Accepted format string patterns:
|
|
4040
|
+
* | Unit |Prior| Pattern | Result examples | Notes |
|
|
4041
|
+
* |---------------------------------|-----|---------|-----------------------------------|-------|
|
|
4042
|
+
* | Era | 140 | G..GGG | AD, BC | |
|
|
4043
|
+
* | | | GGGG | Anno Domini, Before Christ | 2 |
|
|
4044
|
+
* | | | GGGGG | A, B | |
|
|
4045
|
+
* | Calendar year | 130 | y | 44, 1, 1900, 2017, 9999 | 4 |
|
|
4046
|
+
* | | | yo | 44th, 1st, 1900th, 9999999th | 4,5 |
|
|
4047
|
+
* | | | yy | 44, 01, 00, 17 | 4 |
|
|
4048
|
+
* | | | yyy | 044, 001, 123, 999 | 4 |
|
|
4049
|
+
* | | | yyyy | 0044, 0001, 1900, 2017 | 4 |
|
|
4050
|
+
* | | | yyyyy | ... | 2,4 |
|
|
4051
|
+
* | Local week-numbering year | 130 | Y | 44, 1, 1900, 2017, 9000 | 4 |
|
|
4052
|
+
* | | | Yo | 44th, 1st, 1900th, 9999999th | 4,5 |
|
|
4053
|
+
* | | | YY | 44, 01, 00, 17 | 4,6 |
|
|
4054
|
+
* | | | YYY | 044, 001, 123, 999 | 4 |
|
|
4055
|
+
* | | | YYYY | 0044, 0001, 1900, 2017 | 4,6 |
|
|
4056
|
+
* | | | YYYYY | ... | 2,4 |
|
|
4057
|
+
* | ISO week-numbering year | 130 | R | -43, 1, 1900, 2017, 9999, -9999 | 4,5 |
|
|
4058
|
+
* | | | RR | -43, 01, 00, 17 | 4,5 |
|
|
4059
|
+
* | | | RRR | -043, 001, 123, 999, -999 | 4,5 |
|
|
4060
|
+
* | | | RRRR | -0043, 0001, 2017, 9999, -9999 | 4,5 |
|
|
4061
|
+
* | | | RRRRR | ... | 2,4,5 |
|
|
4062
|
+
* | Extended year | 130 | u | -43, 1, 1900, 2017, 9999, -999 | 4 |
|
|
4063
|
+
* | | | uu | -43, 01, 99, -99 | 4 |
|
|
4064
|
+
* | | | uuu | -043, 001, 123, 999, -999 | 4 |
|
|
4065
|
+
* | | | uuuu | -0043, 0001, 2017, 9999, -9999 | 4 |
|
|
4066
|
+
* | | | uuuuu | ... | 2,4 |
|
|
4067
|
+
* | Quarter (formatting) | 120 | Q | 1, 2, 3, 4 | |
|
|
4068
|
+
* | | | Qo | 1st, 2nd, 3rd, 4th | 5 |
|
|
4069
|
+
* | | | QQ | 01, 02, 03, 04 | |
|
|
4070
|
+
* | | | QQQ | Q1, Q2, Q3, Q4 | |
|
|
4071
|
+
* | | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
|
|
4072
|
+
* | | | QQQQQ | 1, 2, 3, 4 | 4 |
|
|
4073
|
+
* | Quarter (stand-alone) | 120 | q | 1, 2, 3, 4 | |
|
|
4074
|
+
* | | | qo | 1st, 2nd, 3rd, 4th | 5 |
|
|
4075
|
+
* | | | qq | 01, 02, 03, 04 | |
|
|
4076
|
+
* | | | qqq | Q1, Q2, Q3, Q4 | |
|
|
4077
|
+
* | | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
|
|
4078
|
+
* | | | qqqqq | 1, 2, 3, 4 | 3 |
|
|
4079
|
+
* | Month (formatting) | 110 | M | 1, 2, ..., 12 | |
|
|
4080
|
+
* | | | Mo | 1st, 2nd, ..., 12th | 5 |
|
|
4081
|
+
* | | | MM | 01, 02, ..., 12 | |
|
|
4082
|
+
* | | | MMM | Jan, Feb, ..., Dec | |
|
|
4083
|
+
* | | | MMMM | January, February, ..., December | 2 |
|
|
4084
|
+
* | | | MMMMM | J, F, ..., D | |
|
|
4085
|
+
* | Month (stand-alone) | 110 | L | 1, 2, ..., 12 | |
|
|
4086
|
+
* | | | Lo | 1st, 2nd, ..., 12th | 5 |
|
|
4087
|
+
* | | | LL | 01, 02, ..., 12 | |
|
|
4088
|
+
* | | | LLL | Jan, Feb, ..., Dec | |
|
|
4089
|
+
* | | | LLLL | January, February, ..., December | 2 |
|
|
4090
|
+
* | | | LLLLL | J, F, ..., D | |
|
|
4091
|
+
* | Local week of year | 100 | w | 1, 2, ..., 53 | |
|
|
4092
|
+
* | | | wo | 1st, 2nd, ..., 53th | 5 |
|
|
4093
|
+
* | | | ww | 01, 02, ..., 53 | |
|
|
4094
|
+
* | ISO week of year | 100 | I | 1, 2, ..., 53 | 5 |
|
|
4095
|
+
* | | | Io | 1st, 2nd, ..., 53th | 5 |
|
|
4096
|
+
* | | | II | 01, 02, ..., 53 | 5 |
|
|
4097
|
+
* | Day of month | 90 | d | 1, 2, ..., 31 | |
|
|
4098
|
+
* | | | do | 1st, 2nd, ..., 31st | 5 |
|
|
4099
|
+
* | | | dd | 01, 02, ..., 31 | |
|
|
4100
|
+
* | Day of year | 90 | D | 1, 2, ..., 365, 366 | 7 |
|
|
4101
|
+
* | | | Do | 1st, 2nd, ..., 365th, 366th | 5 |
|
|
4102
|
+
* | | | DD | 01, 02, ..., 365, 366 | 7 |
|
|
4103
|
+
* | | | DDD | 001, 002, ..., 365, 366 | |
|
|
4104
|
+
* | | | DDDD | ... | 2 |
|
|
4105
|
+
* | Day of week (formatting) | 90 | E..EEE | Mon, Tue, Wed, ..., Sun | |
|
|
4106
|
+
* | | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
|
|
4107
|
+
* | | | EEEEE | M, T, W, T, F, S, S | |
|
|
4108
|
+
* | | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
4109
|
+
* | ISO day of week (formatting) | 90 | i | 1, 2, 3, ..., 7 | 5 |
|
|
4110
|
+
* | | | io | 1st, 2nd, ..., 7th | 5 |
|
|
4111
|
+
* | | | ii | 01, 02, ..., 07 | 5 |
|
|
4112
|
+
* | | | iii | Mon, Tue, Wed, ..., Sun | 5 |
|
|
4113
|
+
* | | | iiii | Monday, Tuesday, ..., Sunday | 2,5 |
|
|
4114
|
+
* | | | iiiii | M, T, W, T, F, S, S | 5 |
|
|
4115
|
+
* | | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 5 |
|
|
4116
|
+
* | Local day of week (formatting) | 90 | e | 2, 3, 4, ..., 1 | |
|
|
4117
|
+
* | | | eo | 2nd, 3rd, ..., 1st | 5 |
|
|
4118
|
+
* | | | ee | 02, 03, ..., 01 | |
|
|
4119
|
+
* | | | eee | Mon, Tue, Wed, ..., Sun | |
|
|
4120
|
+
* | | | eeee | Monday, Tuesday, ..., Sunday | 2 |
|
|
4121
|
+
* | | | eeeee | M, T, W, T, F, S, S | |
|
|
4122
|
+
* | | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
4123
|
+
* | Local day of week (stand-alone) | 90 | c | 2, 3, 4, ..., 1 | |
|
|
4124
|
+
* | | | co | 2nd, 3rd, ..., 1st | 5 |
|
|
4125
|
+
* | | | cc | 02, 03, ..., 01 | |
|
|
4126
|
+
* | | | ccc | Mon, Tue, Wed, ..., Sun | |
|
|
4127
|
+
* | | | cccc | Monday, Tuesday, ..., Sunday | 2 |
|
|
4128
|
+
* | | | ccccc | M, T, W, T, F, S, S | |
|
|
4129
|
+
* | | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
4130
|
+
* | AM, PM | 80 | a..aaa | AM, PM | |
|
|
4131
|
+
* | | | aaaa | a.m., p.m. | 2 |
|
|
4132
|
+
* | | | aaaaa | a, p | |
|
|
4133
|
+
* | AM, PM, noon, midnight | 80 | b..bbb | AM, PM, noon, midnight | |
|
|
4134
|
+
* | | | bbbb | a.m., p.m., noon, midnight | 2 |
|
|
4135
|
+
* | | | bbbbb | a, p, n, mi | |
|
|
4136
|
+
* | Flexible day period | 80 | B..BBB | at night, in the morning, ... | |
|
|
4137
|
+
* | | | BBBB | at night, in the morning, ... | 2 |
|
|
4138
|
+
* | | | BBBBB | at night, in the morning, ... | |
|
|
4139
|
+
* | Hour [1-12] | 70 | h | 1, 2, ..., 11, 12 | |
|
|
4140
|
+
* | | | ho | 1st, 2nd, ..., 11th, 12th | 5 |
|
|
4141
|
+
* | | | hh | 01, 02, ..., 11, 12 | |
|
|
4142
|
+
* | Hour [0-23] | 70 | H | 0, 1, 2, ..., 23 | |
|
|
4143
|
+
* | | | Ho | 0th, 1st, 2nd, ..., 23rd | 5 |
|
|
4144
|
+
* | | | HH | 00, 01, 02, ..., 23 | |
|
|
4145
|
+
* | Hour [0-11] | 70 | K | 1, 2, ..., 11, 0 | |
|
|
4146
|
+
* | | | Ko | 1st, 2nd, ..., 11th, 0th | 5 |
|
|
4147
|
+
* | | | KK | 01, 02, ..., 11, 00 | |
|
|
4148
|
+
* | Hour [1-24] | 70 | k | 24, 1, 2, ..., 23 | |
|
|
4149
|
+
* | | | ko | 24th, 1st, 2nd, ..., 23rd | 5 |
|
|
4150
|
+
* | | | kk | 24, 01, 02, ..., 23 | |
|
|
4151
|
+
* | Minute | 60 | m | 0, 1, ..., 59 | |
|
|
4152
|
+
* | | | mo | 0th, 1st, ..., 59th | 5 |
|
|
4153
|
+
* | | | mm | 00, 01, ..., 59 | |
|
|
4154
|
+
* | Second | 50 | s | 0, 1, ..., 59 | |
|
|
4155
|
+
* | | | so | 0th, 1st, ..., 59th | 5 |
|
|
4156
|
+
* | | | ss | 00, 01, ..., 59 | |
|
|
4157
|
+
* | Seconds timestamp | 40 | t | 512969520 | |
|
|
4158
|
+
* | | | tt | ... | 2 |
|
|
4159
|
+
* | Fraction of second | 30 | S | 0, 1, ..., 9 | |
|
|
4160
|
+
* | | | SS | 00, 01, ..., 99 | |
|
|
4161
|
+
* | | | SSS | 000, 001, ..., 999 | |
|
|
4162
|
+
* | | | SSSS | ... | 2 |
|
|
4163
|
+
* | Milliseconds timestamp | 20 | T | 512969520900 | |
|
|
4164
|
+
* | | | TT | ... | 2 |
|
|
4165
|
+
* | Timezone (ISO-8601 w/ Z) | 10 | X | -08, +0530, Z | |
|
|
4166
|
+
* | | | XX | -0800, +0530, Z | |
|
|
4167
|
+
* | | | XXX | -08:00, +05:30, Z | |
|
|
4168
|
+
* | | | XXXX | -0800, +0530, Z, +123456 | 2 |
|
|
4169
|
+
* | | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
|
|
4170
|
+
* | Timezone (ISO-8601 w/o Z) | 10 | x | -08, +0530, +00 | |
|
|
4171
|
+
* | | | xx | -0800, +0530, +0000 | |
|
|
4172
|
+
* | | | xxx | -08:00, +05:30, +00:00 | 2 |
|
|
4173
|
+
* | | | xxxx | -0800, +0530, +0000, +123456 | |
|
|
4174
|
+
* | | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
|
|
4175
|
+
* | Long localized date | NA | P | 05/29/1453 | 5,8 |
|
|
4176
|
+
* | | | PP | May 29, 1453 | |
|
|
4177
|
+
* | | | PPP | May 29th, 1453 | |
|
|
4178
|
+
* | | | PPPP | Sunday, May 29th, 1453 | 2,5,8 |
|
|
4179
|
+
* | Long localized time | NA | p | 12:00 AM | 5,8 |
|
|
4180
|
+
* | | | pp | 12:00:00 AM | |
|
|
4181
|
+
* | Combination of date and time | NA | Pp | 05/29/1453, 12:00 AM | |
|
|
4182
|
+
* | | | PPpp | May 29, 1453, 12:00:00 AM | |
|
|
4183
|
+
* | | | PPPpp | May 29th, 1453 at ... | |
|
|
4184
|
+
* | | | PPPPpp | Sunday, May 29th, 1453 at ... | 2,5,8 |
|
|
4185
|
+
* Notes:
|
|
4186
|
+
* 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
|
|
4187
|
+
* are the same as "stand-alone" units, but are different in some languages.
|
|
4188
|
+
* "Formatting" units are declined according to the rules of the language
|
|
4189
|
+
* in the context of a date. "Stand-alone" units are always nominative singular.
|
|
4190
|
+
* In `format` function, they will produce different result:
|
|
4191
|
+
*
|
|
4192
|
+
* `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
|
|
4193
|
+
*
|
|
4194
|
+
* `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
|
|
4195
|
+
*
|
|
4196
|
+
* `parse` will try to match both formatting and stand-alone units interchangeably.
|
|
4197
|
+
*
|
|
4198
|
+
* 2. Any sequence of the identical letters is a pattern, unless it is escaped by
|
|
4199
|
+
* the single quote characters (see below).
|
|
4200
|
+
* If the sequence is longer than listed in table:
|
|
4201
|
+
* - for numerical units (`yyyyyyyy`) `parse` will try to match a number
|
|
4202
|
+
* as wide as the sequence
|
|
4203
|
+
* - for text units (`MMMMMMMM`) `parse` will try to match the widest variation of the unit.
|
|
4204
|
+
* These variations are marked with "2" in the last column of the table.
|
|
4205
|
+
*
|
|
4206
|
+
* 3. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
|
|
4207
|
+
* These tokens represent the shortest form of the quarter.
|
|
4208
|
+
*
|
|
4209
|
+
* 4. The main difference between `y` and `u` patterns are B.C. years:
|
|
4210
|
+
*
|
|
4211
|
+
* | Year | `y` | `u` |
|
|
4212
|
+
* |------|-----|-----|
|
|
4213
|
+
* | AC 1 | 1 | 1 |
|
|
4214
|
+
* | BC 1 | 1 | 0 |
|
|
4215
|
+
* | BC 2 | 2 | -1 |
|
|
4216
|
+
*
|
|
4217
|
+
* Also `yy` will try to guess the century of two digit year by proximity with `referenceDate`:
|
|
4218
|
+
*
|
|
4219
|
+
* `parse('50', 'yy', new Date(2018, 0, 1)) //=> Sat Jan 01 2050 00:00:00`
|
|
4220
|
+
*
|
|
4221
|
+
* `parse('75', 'yy', new Date(2018, 0, 1)) //=> Wed Jan 01 1975 00:00:00`
|
|
4222
|
+
*
|
|
4223
|
+
* while `uu` will just assign the year as is:
|
|
4224
|
+
*
|
|
4225
|
+
* `parse('50', 'uu', new Date(2018, 0, 1)) //=> Sat Jan 01 0050 00:00:00`
|
|
4226
|
+
*
|
|
4227
|
+
* `parse('75', 'uu', new Date(2018, 0, 1)) //=> Tue Jan 01 0075 00:00:00`
|
|
4228
|
+
*
|
|
4229
|
+
* The same difference is true for local and ISO week-numbering years (`Y` and `R`),
|
|
4230
|
+
* except local week-numbering years are dependent on `options.weekStartsOn`
|
|
4231
|
+
* and `options.firstWeekContainsDate` (compare [setISOWeekYear](https://date-fns.org/docs/setISOWeekYear)
|
|
4232
|
+
* and [setWeekYear](https://date-fns.org/docs/setWeekYear)).
|
|
4233
|
+
*
|
|
4234
|
+
* 5. These patterns are not in the Unicode Technical Standard #35:
|
|
4235
|
+
* - `i`: ISO day of week
|
|
4236
|
+
* - `I`: ISO week of year
|
|
4237
|
+
* - `R`: ISO week-numbering year
|
|
4238
|
+
* - `o`: ordinal number modifier
|
|
4239
|
+
* - `P`: long localized date
|
|
4240
|
+
* - `p`: long localized time
|
|
4241
|
+
*
|
|
4242
|
+
* 6. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
|
|
4243
|
+
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
4244
|
+
*
|
|
4245
|
+
* 7. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
|
|
4246
|
+
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
4247
|
+
*
|
|
4248
|
+
* 8. `P+` tokens do not have a defined priority since they are merely aliases to other tokens based
|
|
4249
|
+
* on the given locale.
|
|
4250
|
+
*
|
|
4251
|
+
* using `en-US` locale: `P` => `MM/dd/yyyy`
|
|
4252
|
+
* using `en-US` locale: `p` => `hh:mm a`
|
|
4253
|
+
* using `pt-BR` locale: `P` => `dd/MM/yyyy`
|
|
4254
|
+
* using `pt-BR` locale: `p` => `HH:mm`
|
|
4255
|
+
*
|
|
4256
|
+
* Values will be assigned to the date in the descending order of its unit's priority.
|
|
4257
|
+
* Units of an equal priority overwrite each other in the order of appearance.
|
|
4258
|
+
*
|
|
4259
|
+
* If no values of higher priority are parsed (e.g. when parsing string 'January 1st' without a year),
|
|
4260
|
+
* the values will be taken from 3rd argument `referenceDate` which works as a context of parsing.
|
|
4261
|
+
*
|
|
4262
|
+
* `referenceDate` must be passed for correct work of the function.
|
|
4263
|
+
* If you're not sure which `referenceDate` to supply, create a new instance of Date:
|
|
4264
|
+
* `parse('02/11/2014', 'MM/dd/yyyy', new Date())`
|
|
4265
|
+
* In this case parsing will be done in the context of the current date.
|
|
4266
|
+
* If `referenceDate` is `Invalid Date` or a value not convertible to valid `Date`,
|
|
4267
|
+
* then `Invalid Date` will be returned.
|
|
4268
|
+
*
|
|
4269
|
+
* The result may vary by locale.
|
|
4270
|
+
*
|
|
4271
|
+
* If `formatString` matches with `dateString` but does not provides tokens, `referenceDate` will be returned.
|
|
4272
|
+
*
|
|
4273
|
+
* If parsing failed, `Invalid Date` will be returned.
|
|
4274
|
+
* Invalid Date is a Date, whose time value is NaN.
|
|
4275
|
+
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
|
4276
|
+
*
|
|
4277
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
4278
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
4279
|
+
*
|
|
4280
|
+
* @param dateStr - The string to parse
|
|
4281
|
+
* @param formatStr - The string of tokens
|
|
4282
|
+
* @param referenceDate - defines values missing from the parsed dateString
|
|
4283
|
+
* @param options - An object with options.
|
|
4284
|
+
* see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
4285
|
+
* see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
4286
|
+
*
|
|
4287
|
+
* @returns The parsed date
|
|
4288
|
+
*
|
|
4289
|
+
* @throws `options.locale` must contain `match` property
|
|
4290
|
+
* @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
4291
|
+
* @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
4292
|
+
* @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
4293
|
+
* @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
4294
|
+
* @throws format string contains an unescaped latin alphabet character
|
|
4295
|
+
*
|
|
4296
|
+
* @example
|
|
4297
|
+
* // Parse 11 February 2014 from middle-endian format:
|
|
4298
|
+
* var result = parse('02/11/2014', 'MM/dd/yyyy', new Date())
|
|
4299
|
+
* //=> Tue Feb 11 2014 00:00:00
|
|
4300
|
+
*
|
|
4301
|
+
* @example
|
|
4302
|
+
* // Parse 28th of February in Esperanto locale in the context of 2010 year:
|
|
4303
|
+
* import eo from 'date-fns/locale/eo'
|
|
4304
|
+
* var result = parse('28-a de februaro', "do 'de' MMMM", new Date(2010, 0, 1), {
|
|
4305
|
+
* locale: eo
|
|
4306
|
+
* })
|
|
4307
|
+
* //=> Sun Feb 28 2010 00:00:00
|
|
4308
|
+
*/
|
|
4309
|
+
function parse(dateStr, formatStr, referenceDate, options) {
|
|
4310
|
+
const invalidDate = () => constructFrom(options?.in || referenceDate, NaN);
|
|
4311
|
+
const defaultOptions = getDefaultOptions();
|
|
4312
|
+
const locale = options?.locale ?? defaultOptions.locale ?? enUS;
|
|
4313
|
+
const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1;
|
|
4314
|
+
const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0;
|
|
4315
|
+
if (!formatStr) return dateStr ? invalidDate() : toDate(referenceDate, options?.in);
|
|
4316
|
+
const subFnOptions = {
|
|
4317
|
+
firstWeekContainsDate,
|
|
4318
|
+
weekStartsOn,
|
|
4319
|
+
locale
|
|
4320
|
+
};
|
|
4321
|
+
const setters = [new DateTimezoneSetter(options?.in, referenceDate)];
|
|
4322
|
+
const tokens = formatStr.match(longFormattingTokensRegExp).map((substring) => {
|
|
4323
|
+
const firstCharacter = substring[0];
|
|
4324
|
+
if (firstCharacter in longFormatters) {
|
|
4325
|
+
const longFormatter = longFormatters[firstCharacter];
|
|
4326
|
+
return longFormatter(substring, locale.formatLong);
|
|
4327
|
+
}
|
|
4328
|
+
return substring;
|
|
4329
|
+
}).join("").match(formattingTokensRegExp);
|
|
4330
|
+
const usedTokens = [];
|
|
4331
|
+
for (let token of tokens) {
|
|
4332
|
+
if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token)) warnOrThrowProtectedError(token, formatStr, dateStr);
|
|
4333
|
+
if (!options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) warnOrThrowProtectedError(token, formatStr, dateStr);
|
|
4334
|
+
const firstCharacter = token[0];
|
|
4335
|
+
const parser = parsers[firstCharacter];
|
|
4336
|
+
if (parser) {
|
|
4337
|
+
const { incompatibleTokens } = parser;
|
|
4338
|
+
if (Array.isArray(incompatibleTokens)) {
|
|
4339
|
+
const incompatibleToken = usedTokens.find((usedToken) => incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter);
|
|
4340
|
+
if (incompatibleToken) throw new RangeError(`The format string mustn't contain \`${incompatibleToken.fullToken}\` and \`${token}\` at the same time`);
|
|
4341
|
+
} else if (parser.incompatibleTokens === "*" && usedTokens.length > 0) throw new RangeError(`The format string mustn't contain \`${token}\` and any other token at the same time`);
|
|
4342
|
+
usedTokens.push({
|
|
4343
|
+
token: firstCharacter,
|
|
4344
|
+
fullToken: token
|
|
4345
|
+
});
|
|
4346
|
+
const parseResult = parser.run(dateStr, token, locale.match, subFnOptions);
|
|
4347
|
+
if (!parseResult) return invalidDate();
|
|
4348
|
+
setters.push(parseResult.setter);
|
|
4349
|
+
dateStr = parseResult.rest;
|
|
4350
|
+
} else {
|
|
4351
|
+
if (firstCharacter.match(unescapedLatinCharacterRegExp)) throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
|
|
4352
|
+
if (token === "''") token = "'";
|
|
4353
|
+
else if (firstCharacter === "'") token = cleanEscapedString(token);
|
|
4354
|
+
if (dateStr.indexOf(token) === 0) dateStr = dateStr.slice(token.length);
|
|
4355
|
+
else return invalidDate();
|
|
4356
|
+
}
|
|
4357
|
+
}
|
|
4358
|
+
if (dateStr.length > 0 && notWhitespaceRegExp.test(dateStr)) return invalidDate();
|
|
4359
|
+
const uniquePrioritySetters = setters.map((setter) => setter.priority).sort((a, b) => b - a).filter((priority, index, array) => array.indexOf(priority) === index).map((priority) => setters.filter((setter) => setter.priority === priority).sort((a, b) => b.subPriority - a.subPriority)).map((setterArray) => setterArray[0]);
|
|
4360
|
+
let date = toDate(referenceDate, options?.in);
|
|
4361
|
+
if (isNaN(+date)) return invalidDate();
|
|
4362
|
+
const flags = {};
|
|
4363
|
+
for (const setter of uniquePrioritySetters) {
|
|
4364
|
+
if (!setter.validate(date, subFnOptions)) return invalidDate();
|
|
4365
|
+
const result = setter.set(date, flags, subFnOptions);
|
|
4366
|
+
if (Array.isArray(result)) {
|
|
4367
|
+
date = result[0];
|
|
4368
|
+
Object.assign(flags, result[1]);
|
|
4369
|
+
} else date = result;
|
|
4370
|
+
}
|
|
4371
|
+
return date;
|
|
4372
|
+
}
|
|
4373
|
+
function cleanEscapedString(input) {
|
|
4374
|
+
return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
|
|
4375
|
+
}
|
|
4376
|
+
//#endregion
|
|
39
4377
|
//#region src/shared/datetime/presentationDate.ts
|
|
40
4378
|
var formatPresentationDate = (dateStr, locale) => {
|
|
41
4379
|
return format(parseDateStr(dateStr), locale.dateFormat);
|
|
@@ -355,10 +4693,10 @@ var CalendarPicker = (Base) => {
|
|
|
355
4693
|
*/
|
|
356
4694
|
_onDateKeydown(date, event) {
|
|
357
4695
|
let newDate = null;
|
|
358
|
-
if (event.key === "ArrowUp") newDate = addDays$
|
|
359
|
-
else if (event.key === "ArrowDown") newDate = addDays$
|
|
360
|
-
else if (event.key === "ArrowLeft") newDate = addDays$
|
|
361
|
-
else if (event.key === "ArrowRight") newDate = addDays$
|
|
4696
|
+
if (event.key === "ArrowUp") newDate = addDays$2(date, -7);
|
|
4697
|
+
else if (event.key === "ArrowDown") newDate = addDays$2(date, 7);
|
|
4698
|
+
else if (event.key === "ArrowLeft") newDate = addDays$2(date, -1);
|
|
4699
|
+
else if (event.key === "ArrowRight") newDate = addDays$2(date, 1);
|
|
362
4700
|
if (newDate && this._isDateInValidRange(newDate)) {
|
|
363
4701
|
if (this._adjustSelectedMonthToEnsureVisibilityOf(newDate)) Updates.process();
|
|
364
4702
|
this._dialogEl.querySelector(`[data-date="${newDate}"]`).focus();
|