@zimyo/ui 1.0.1 → 1.1.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/package.json +79 -80
- package/dist/_virtual/_rollupPluginBabelHelpers.js +0 -11
- package/dist/components/index.d.ts +0 -59
- package/dist/components/ui/accordion.d.ts +0 -9
- package/dist/components/ui/accordion.js +0 -53
- package/dist/components/ui/alert-dialog.d.ts +0 -16
- package/dist/components/ui/alert-dialog.js +0 -107
- package/dist/components/ui/alert.d.ts +0 -12
- package/dist/components/ui/alert.js +0 -53
- package/dist/components/ui/aspect-ratio.d.ts +0 -6
- package/dist/components/ui/aspect-ratio.js +0 -12
- package/dist/components/ui/avatar.d.ts +0 -8
- package/dist/components/ui/avatar.js +0 -38
- package/dist/components/ui/badge.d.ts +0 -12
- package/dist/components/ui/badge.js +0 -37
- package/dist/components/ui/breadcrumb.d.ts +0 -13
- package/dist/components/ui/breadcrumb.js +0 -90
- package/dist/components/ui/button.d.ts +0 -13
- package/dist/components/ui/button.js +0 -49
- package/dist/components/ui/calendar.d.ts +0 -12
- package/dist/components/ui/calendar.js +0 -134
- package/dist/components/ui/card.d.ts +0 -11
- package/dist/components/ui/card.js +0 -77
- package/dist/components/ui/carousel.d.ts +0 -24
- package/dist/components/ui/carousel.js +0 -163
- package/dist/components/ui/chart.d.ts +0 -43
- package/dist/components/ui/chart.js +0 -187
- package/dist/components/ui/checkbox.d.ts +0 -6
- package/dist/components/ui/checkbox.js +0 -24
- package/dist/components/ui/collapsible.d.ts +0 -8
- package/dist/components/ui/collapsible.js +0 -24
- package/dist/components/ui/command.d.ts +0 -21
- package/dist/components/ui/command.js +0 -110
- package/dist/components/ui/context-menu.d.ts +0 -27
- package/dist/components/ui/context-menu.js +0 -158
- package/dist/components/ui/dialog.d.ts +0 -17
- package/dist/components/ui/dialog.js +0 -102
- package/dist/components/ui/drawer.d.ts +0 -15
- package/dist/components/ui/drawer.js +0 -97
- package/dist/components/ui/dropdown-menu.d.ts +0 -27
- package/dist/components/ui/dropdown-menu.js +0 -160
- package/dist/components/ui/form.d.ts +0 -26
- package/dist/components/ui/form.js +0 -125
- package/dist/components/ui/hover-card.d.ts +0 -8
- package/dist/components/ui/hover-card.js +0 -36
- package/dist/components/ui/input-otp.d.ts +0 -13
- package/dist/components/ui/input-otp.js +0 -61
- package/dist/components/ui/input.d.ts +0 -5
- package/dist/components/ui/input.js +0 -19
- package/dist/components/ui/label.d.ts +0 -6
- package/dist/components/ui/label.js +0 -18
- package/dist/components/ui/menubar.d.ts +0 -28
- package/dist/components/ui/menubar.js +0 -178
- package/dist/components/ui/navigation-menu.d.ts +0 -17
- package/dist/components/ui/navigation-menu.js +0 -102
- package/dist/components/ui/pagination.d.ts +0 -17
- package/dist/components/ui/pagination.js +0 -95
- package/dist/components/ui/popover.d.ts +0 -9
- package/dist/components/ui/popover.js +0 -40
- package/dist/components/ui/progress.d.ts +0 -6
- package/dist/components/ui/progress.js +0 -25
- package/dist/components/ui/radio-group.d.ts +0 -7
- package/dist/components/ui/radio-group.js +0 -34
- package/dist/components/ui/resizable.d.ts +0 -10
- package/dist/components/ui/resizable.js +0 -40
- package/dist/components/ui/scroll-area.d.ts +0 -7
- package/dist/components/ui/scroll-area.js +0 -37
- package/dist/components/ui/select.d.ts +0 -17
- package/dist/components/ui/select.js +0 -118
- package/dist/components/ui/separator.d.ts +0 -6
- package/dist/components/ui/separator.js +0 -22
- package/dist/components/ui/sheet.d.ts +0 -15
- package/dist/components/ui/sheet.js +0 -101
- package/dist/components/ui/sidebar.d.ts +0 -73
- package/dist/components/ui/sidebar.js +0 -484
- package/dist/components/ui/skeleton.d.ts +0 -5
- package/dist/components/ui/skeleton.js +0 -16
- package/dist/components/ui/slider.d.ts +0 -6
- package/dist/components/ui/slider.js +0 -39
- package/dist/components/ui/sonner.d.ts +0 -6
- package/dist/components/ui/sonner.js +0 -18
- package/dist/components/ui/switch.d.ts +0 -6
- package/dist/components/ui/switch.js +0 -21
- package/dist/components/ui/table.d.ts +0 -12
- package/dist/components/ui/table.js +0 -90
- package/dist/components/ui/tabs.d.ts +0 -9
- package/dist/components/ui/tabs.js +0 -48
- package/dist/components/ui/textarea.d.ts +0 -5
- package/dist/components/ui/textarea.js +0 -17
- package/dist/components/ui/toggle-group.d.ts +0 -10
- package/dist/components/ui/toggle-group.js +0 -52
- package/dist/components/ui/toggle.d.ts +0 -12
- package/dist/components/ui/toggle.js +0 -42
- package/dist/components/ui/tooltip.d.ts +0 -9
- package/dist/components/ui/tooltip.js +0 -45
- package/dist/index.d.ts +0 -61
- package/dist/index.js +0 -47
- package/dist/lib/utils.d.ts +0 -5
- package/dist/lib/utils.js +0 -8
- package/dist/node_modules/@date-fns/tz/date/index.js +0 -101
- package/dist/node_modules/@date-fns/tz/date/mini.js +0 -207
- package/dist/node_modules/@date-fns/tz/tzOffset/index.js +0 -43
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +0 -11
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -39
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +0 -79
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +0 -321
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +0 -211
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +0 -29
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +0 -207
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +0 -15
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +0 -17
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +0 -130
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +0 -43
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +0 -89
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +0 -12
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -70
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -18
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -7
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +0 -137
- package/dist/node_modules/class-variance-authority/dist/index.js +0 -44
- package/dist/node_modules/clsx/dist/clsx.js +0 -3
- package/dist/node_modules/cmdk/dist/chunk-NZJY6EH4.js +0 -3
- package/dist/node_modules/cmdk/dist/index.js +0 -10
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +0 -7
- package/dist/node_modules/date-fns/_lib/defaultOptions.js +0 -7
- package/dist/node_modules/date-fns/_lib/format/formatters.js +0 -775
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +0 -94
- package/dist/node_modules/date-fns/_lib/format/longFormatters.js +0 -66
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +0 -31
- package/dist/node_modules/date-fns/_lib/normalizeDates.js +0 -11
- package/dist/node_modules/date-fns/_lib/normalizeInterval.js +0 -8
- package/dist/node_modules/date-fns/_lib/protectedTokens.js +0 -25
- package/dist/node_modules/date-fns/addDays.js +0 -41
- package/dist/node_modules/date-fns/addMonths.js +0 -75
- package/dist/node_modules/date-fns/addWeeks.js +0 -33
- package/dist/node_modules/date-fns/addYears.js +0 -33
- package/dist/node_modules/date-fns/constants.js +0 -46
- package/dist/node_modules/date-fns/constructFrom.js +0 -49
- package/dist/node_modules/date-fns/differenceInCalendarDays.js +0 -62
- package/dist/node_modules/date-fns/differenceInCalendarMonths.js +0 -42
- package/dist/node_modules/date-fns/eachMonthOfInterval.js +0 -65
- package/dist/node_modules/date-fns/endOfISOWeek.js +0 -35
- package/dist/node_modules/date-fns/endOfMonth.js +0 -37
- package/dist/node_modules/date-fns/endOfWeek.js +0 -53
- package/dist/node_modules/date-fns/endOfYear.js +0 -37
- package/dist/node_modules/date-fns/format.js +0 -423
- package/dist/node_modules/date-fns/getDayOfYear.js +0 -34
- package/dist/node_modules/date-fns/getDaysInMonth.js +0 -36
- package/dist/node_modules/date-fns/getISOWeek.js +0 -40
- package/dist/node_modules/date-fns/getISOWeekYear.js +0 -52
- package/dist/node_modules/date-fns/getMonth.js +0 -29
- package/dist/node_modules/date-fns/getWeek.js +0 -54
- package/dist/node_modules/date-fns/getWeekYear.js +0 -75
- package/dist/node_modules/date-fns/getYear.js +0 -29
- package/dist/node_modules/date-fns/isAfter.js +0 -25
- package/dist/node_modules/date-fns/isBefore.js +0 -25
- package/dist/node_modules/date-fns/isDate.js +0 -41
- package/dist/node_modules/date-fns/isSameDay.js +0 -46
- package/dist/node_modules/date-fns/isSameMonth.js +0 -43
- package/dist/node_modules/date-fns/isSameYear.js +0 -35
- package/dist/node_modules/date-fns/isValid.js +0 -39
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +0 -10
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +0 -64
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +0 -59
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +0 -22
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +0 -103
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +0 -41
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +0 -13
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +0 -189
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +0 -134
- package/dist/node_modules/date-fns/locale/en-US.js +0 -28
- package/dist/node_modules/date-fns/max.js +0 -49
- package/dist/node_modules/date-fns/min.js +0 -49
- package/dist/node_modules/date-fns/setMonth.js +0 -46
- package/dist/node_modules/date-fns/setYear.js +0 -40
- package/dist/node_modules/date-fns/startOfDay.js +0 -35
- package/dist/node_modules/date-fns/startOfISOWeek.js +0 -35
- package/dist/node_modules/date-fns/startOfISOWeekYear.js +0 -42
- package/dist/node_modules/date-fns/startOfMonth.js +0 -37
- package/dist/node_modules/date-fns/startOfWeek.js +0 -53
- package/dist/node_modules/date-fns/startOfWeekYear.js +0 -64
- package/dist/node_modules/date-fns/startOfYear.js +0 -36
- package/dist/node_modules/date-fns/toDate.js +0 -46
- package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +0 -1669
- package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +0 -37
- package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +0 -38
- package/dist/node_modules/get-nonce/dist/es2015/index.js +0 -8
- package/dist/node_modules/input-otp/dist/index.js +0 -24
- package/dist/node_modules/react-day-picker/dist/esm/DayPicker.js +0 -285
- package/dist/node_modules/react-day-picker/dist/esm/UI.js +0 -122
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarDay.js +0 -30
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarMonth.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarWeek.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/classes/DateLib.js +0 -522
- package/dist/node_modules/react-day-picker/dist/esm/components/Button.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/CaptionLabel.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Chevron.js +0 -18
- package/dist/node_modules/react-day-picker/dist/esm/components/Day.js +0 -18
- package/dist/node_modules/react-day-picker/dist/esm/components/DayButton.js +0 -19
- package/dist/node_modules/react-day-picker/dist/esm/components/Dropdown.js +0 -21
- package/dist/node_modules/react-day-picker/dist/esm/components/DropdownNav.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Footer.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Month.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthCaption.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthGrid.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Months.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthsDropdown.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/Nav.js +0 -31
- package/dist/node_modules/react-day-picker/dist/esm/components/NextMonthButton.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/Option.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/PreviousMonthButton.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/Root.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/Select.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Week.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/WeekNumber.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/WeekNumberHeader.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Weekday.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Weekdays.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/Weeks.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/YearsDropdown.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/custom-components.js +0 -26
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js +0 -25
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatDay.js +0 -19
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatMonthDropdown.js +0 -18
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumber.js +0 -21
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumberHeader.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekdayName.js +0 -19
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatYearDropdown.js +0 -23
- package/dist/node_modules/react-day-picker/dist/esm/formatters/index.js +0 -7
- package/dist/node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js +0 -73
- package/dist/node_modules/react-day-picker/dist/esm/helpers/createGetModifiers.js +0 -95
- package/dist/node_modules/react-day-picker/dist/esm/helpers/endOfBroadcastWeek.js +0 -22
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getBroadcastWeeksInMonth.js +0 -28
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getClassNamesForModifiers.js +0 -33
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getComponents.js +0 -20
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDataAttributes.js +0 -27
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDates.js +0 -51
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDays.js +0 -19
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js +0 -33
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDisplayMonths.js +0 -24
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getFocusableDate.js +0 -46
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getFormatters.js +0 -24
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getInitialMonth.js +0 -28
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getMonthOptions.js +0 -33
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getMonths.js +0 -69
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNavMonth.js +0 -51
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNextFocus.js +0 -39
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNextMonth.js +0 -36
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getPreviousMonth.js +0 -37
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getStyleForModifiers.js +0 -27
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getWeekdays.js +0 -24
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getWeeks.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getYearOptions.js +0 -38
- package/dist/node_modules/react-day-picker/dist/esm/helpers/startOfBroadcastWeek.js +0 -27
- package/dist/node_modules/react-day-picker/dist/esm/helpers/useControlledValue.js +0 -31
- package/dist/node_modules/react-day-picker/dist/esm/labels/index.js +0 -11
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelDayButton.js +0 -32
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelGrid.js +0 -24
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelGridcell.js +0 -22
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelMonthDropdown.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelNav.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelNext.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelPrevious.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekNumber.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekNumberHeader.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekday.js +0 -18
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelYearDropdown.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/selection/useMulti.js +0 -57
- package/dist/node_modules/react-day-picker/dist/esm/selection/useRange.js +0 -45
- package/dist/node_modules/react-day-picker/dist/esm/selection/useSingle.js +0 -44
- package/dist/node_modules/react-day-picker/dist/esm/useAnimation.js +0 -175
- package/dist/node_modules/react-day-picker/dist/esm/useCalendar.js +0 -85
- package/dist/node_modules/react-day-picker/dist/esm/useDayPicker.js +0 -25
- package/dist/node_modules/react-day-picker/dist/esm/useFocus.js +0 -50
- package/dist/node_modules/react-day-picker/dist/esm/useSelection.js +0 -31
- package/dist/node_modules/react-day-picker/dist/esm/utils/addToRange.js +0 -92
- package/dist/node_modules/react-day-picker/dist/esm/utils/dateMatchModifiers.js +0 -62
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeContainsDayOfWeek.js +0 -30
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeContainsModifiers.js +0 -74
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeIncludesDate.js +0 -35
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeOverlaps.js +0 -21
- package/dist/node_modules/react-day-picker/dist/esm/utils/typeguards.js +0 -66
- package/dist/node_modules/react-hook-form/dist/index.esm.js +0 -507
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +0 -9
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +0 -160
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +0 -38
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +0 -21
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +0 -110
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +0 -5
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +0 -7
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +0 -56
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +0 -10
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +0 -31
- package/dist/node_modules/react-resizable-panels/dist/react-resizable-panels.js +0 -2407
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +0 -19
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +0 -25
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +0 -51
- package/dist/node_modules/sonner/dist/index.js +0 -1125
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +0 -2956
- package/dist/node_modules/tslib/tslib.es6.js +0 -56
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +0 -24
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +0 -48
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +0 -42
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +0 -21
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +0 -77
- package/dist/node_modules/vaul/dist/index.js +0 -1627
- package/dist/styles.css +0 -1
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { normalizeInterval } from './_lib/normalizeInterval.js';
|
|
2
|
-
import { constructFrom } from './constructFrom.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The {@link eachMonthOfInterval} function options.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* The {@link eachMonthOfInterval} function result type. It resolves the proper data type.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @name eachMonthOfInterval
|
|
14
|
-
* @category Interval Helpers
|
|
15
|
-
* @summary Return the array of months within the specified time interval.
|
|
16
|
-
*
|
|
17
|
-
* @description
|
|
18
|
-
* Return the array of months within the specified time interval.
|
|
19
|
-
*
|
|
20
|
-
* @typeParam IntervalType - Interval type.
|
|
21
|
-
* @typeParam Options - Options type.
|
|
22
|
-
*
|
|
23
|
-
* @param interval - The interval.
|
|
24
|
-
* @param options - An object with options.
|
|
25
|
-
*
|
|
26
|
-
* @returns The array with starts of months from the month of the interval start to the month of the interval end
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* // Each month between 6 February 2014 and 10 August 2014:
|
|
30
|
-
* const result = eachMonthOfInterval({
|
|
31
|
-
* start: new Date(2014, 1, 6),
|
|
32
|
-
* end: new Date(2014, 7, 10)
|
|
33
|
-
* })
|
|
34
|
-
* //=> [
|
|
35
|
-
* // Sat Feb 01 2014 00:00:00,
|
|
36
|
-
* // Sat Mar 01 2014 00:00:00,
|
|
37
|
-
* // Tue Apr 01 2014 00:00:00,
|
|
38
|
-
* // Thu May 01 2014 00:00:00,
|
|
39
|
-
* // Sun Jun 01 2014 00:00:00,
|
|
40
|
-
* // Tue Jul 01 2014 00:00:00,
|
|
41
|
-
* // Fri Aug 01 2014 00:00:00
|
|
42
|
-
* // ]
|
|
43
|
-
*/
|
|
44
|
-
function eachMonthOfInterval(interval, options) {
|
|
45
|
-
const { start, end } = normalizeInterval(options?.in, interval);
|
|
46
|
-
|
|
47
|
-
let reversed = +start > +end;
|
|
48
|
-
const endTime = reversed ? +start : +end;
|
|
49
|
-
const date = reversed ? end : start;
|
|
50
|
-
date.setHours(0, 0, 0, 0);
|
|
51
|
-
date.setDate(1);
|
|
52
|
-
|
|
53
|
-
let step = 1;
|
|
54
|
-
|
|
55
|
-
const dates = [];
|
|
56
|
-
|
|
57
|
-
while (+date <= endTime) {
|
|
58
|
-
dates.push(constructFrom(start, date));
|
|
59
|
-
date.setMonth(date.getMonth() + step);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return reversed ? dates.reverse() : dates;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export { eachMonthOfInterval as default, eachMonthOfInterval };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { endOfWeek } from './endOfWeek.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The {@link endOfISOWeek} function options.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @name endOfISOWeek
|
|
9
|
-
* @category ISO Week Helpers
|
|
10
|
-
* @summary Return the end of an ISO week for the given date.
|
|
11
|
-
*
|
|
12
|
-
* @description
|
|
13
|
-
* Return the end of an ISO week for the given date.
|
|
14
|
-
* The result will be in the local timezone.
|
|
15
|
-
*
|
|
16
|
-
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
17
|
-
*
|
|
18
|
-
* @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).
|
|
19
|
-
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
20
|
-
*
|
|
21
|
-
* @param date - The original date
|
|
22
|
-
* @param options - An object with options
|
|
23
|
-
*
|
|
24
|
-
* @returns The end of an ISO week
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* // The end of an ISO week for 2 September 2014 11:55:00:
|
|
28
|
-
* const result = endOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
|
|
29
|
-
* //=> Sun Sep 07 2014 23:59:59.999
|
|
30
|
-
*/
|
|
31
|
-
function endOfISOWeek(date, options) {
|
|
32
|
-
return endOfWeek(date, { ...options, weekStartsOn: 1 });
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export { endOfISOWeek as default, endOfISOWeek };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { toDate } from './toDate.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The {@link endOfMonth} function options.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @name endOfMonth
|
|
9
|
-
* @category Month Helpers
|
|
10
|
-
* @summary Return the end of a month for the given date.
|
|
11
|
-
*
|
|
12
|
-
* @description
|
|
13
|
-
* Return the end of a month for the given date.
|
|
14
|
-
* The result will be in the local timezone.
|
|
15
|
-
*
|
|
16
|
-
* @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).
|
|
17
|
-
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
18
|
-
*
|
|
19
|
-
* @param date - The original date
|
|
20
|
-
* @param options - An object with options
|
|
21
|
-
*
|
|
22
|
-
* @returns The end of a month
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* // The end of a month for 2 September 2014 11:55:00:
|
|
26
|
-
* const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
|
|
27
|
-
* //=> Tue Sep 30 2014 23:59:59.999
|
|
28
|
-
*/
|
|
29
|
-
function endOfMonth(date, options) {
|
|
30
|
-
const _date = toDate(date, options?.in);
|
|
31
|
-
const month = _date.getMonth();
|
|
32
|
-
_date.setFullYear(_date.getFullYear(), month + 1, 0);
|
|
33
|
-
_date.setHours(23, 59, 59, 999);
|
|
34
|
-
return _date;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export { endOfMonth as default, endOfMonth };
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { getDefaultOptions } from './_lib/defaultOptions.js';
|
|
2
|
-
import { toDate } from './toDate.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The {@link endOfWeek} function options.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @name endOfWeek
|
|
10
|
-
* @category Week Helpers
|
|
11
|
-
* @summary Return the end of a week for the given date.
|
|
12
|
-
*
|
|
13
|
-
* @description
|
|
14
|
-
* Return the end of a week for the given date.
|
|
15
|
-
* The result will be in the local timezone.
|
|
16
|
-
*
|
|
17
|
-
* @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).
|
|
18
|
-
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
19
|
-
*
|
|
20
|
-
* @param date - The original date
|
|
21
|
-
* @param options - An object with options
|
|
22
|
-
*
|
|
23
|
-
* @returns The end of a week
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* // The end of a week for 2 September 2014 11:55:00:
|
|
27
|
-
* const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))
|
|
28
|
-
* //=> Sat Sep 06 2014 23:59:59.999
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:
|
|
32
|
-
* const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
|
|
33
|
-
* //=> Sun Sep 07 2014 23:59:59.999
|
|
34
|
-
*/
|
|
35
|
-
function endOfWeek(date, options) {
|
|
36
|
-
const defaultOptions = getDefaultOptions();
|
|
37
|
-
const weekStartsOn =
|
|
38
|
-
options?.weekStartsOn ??
|
|
39
|
-
options?.locale?.options?.weekStartsOn ??
|
|
40
|
-
defaultOptions.weekStartsOn ??
|
|
41
|
-
defaultOptions.locale?.options?.weekStartsOn ??
|
|
42
|
-
0;
|
|
43
|
-
|
|
44
|
-
const _date = toDate(date, options?.in);
|
|
45
|
-
const day = _date.getDay();
|
|
46
|
-
const diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
|
|
47
|
-
|
|
48
|
-
_date.setDate(_date.getDate() + diff);
|
|
49
|
-
_date.setHours(23, 59, 59, 999);
|
|
50
|
-
return _date;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export { endOfWeek as default, endOfWeek };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { toDate } from './toDate.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The {@link endOfYear} function options.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @name endOfYear
|
|
9
|
-
* @category Year Helpers
|
|
10
|
-
* @summary Return the end of a year for the given date.
|
|
11
|
-
*
|
|
12
|
-
* @description
|
|
13
|
-
* Return the end of a year for the given date.
|
|
14
|
-
* The result will be in the local timezone.
|
|
15
|
-
*
|
|
16
|
-
* @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).
|
|
17
|
-
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
18
|
-
*
|
|
19
|
-
* @param date - The original date
|
|
20
|
-
* @param options - The options
|
|
21
|
-
*
|
|
22
|
-
* @returns The end of a year
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* // The end of a year for 2 September 2014 11:55:00:
|
|
26
|
-
* const result = endOfYear(new Date(2014, 8, 2, 11, 55, 0))
|
|
27
|
-
* //=> Wed Dec 31 2014 23:59:59.999
|
|
28
|
-
*/
|
|
29
|
-
function endOfYear(date, options) {
|
|
30
|
-
const _date = toDate(date, options?.in);
|
|
31
|
-
const year = _date.getFullYear();
|
|
32
|
-
_date.setFullYear(year + 1, 0, 0);
|
|
33
|
-
_date.setHours(23, 59, 59, 999);
|
|
34
|
-
return _date;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export { endOfYear as default, endOfYear };
|
|
@@ -1,423 +0,0 @@
|
|
|
1
|
-
import { getDefaultOptions } from './_lib/defaultOptions.js';
|
|
2
|
-
import { formatters } from './_lib/format/formatters.js';
|
|
3
|
-
import { longFormatters } from './_lib/format/longFormatters.js';
|
|
4
|
-
import { isProtectedWeekYearToken, isProtectedDayOfYearToken, warnOrThrowProtectedError } from './_lib/protectedTokens.js';
|
|
5
|
-
import { isValid } from './isValid.js';
|
|
6
|
-
import { toDate } from './toDate.js';
|
|
7
|
-
import { enUS } from './locale/en-US.js';
|
|
8
|
-
|
|
9
|
-
// This RegExp consists of three parts separated by `|`:
|
|
10
|
-
// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
|
|
11
|
-
// (one of the certain letters followed by `o`)
|
|
12
|
-
// - (\w)\1* matches any sequences of the same letter
|
|
13
|
-
// - '' matches two quote characters in a row
|
|
14
|
-
// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
|
|
15
|
-
// except a single quote symbol, which ends the sequence.
|
|
16
|
-
// Two quote characters do not end the sequence.
|
|
17
|
-
// If there is no matching single quote
|
|
18
|
-
// then the sequence will continue until the end of the string.
|
|
19
|
-
// - . matches any single character unmatched by previous parts of the RegExps
|
|
20
|
-
const formattingTokensRegExp =
|
|
21
|
-
/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
|
22
|
-
|
|
23
|
-
// This RegExp catches symbols escaped by quotes, and also
|
|
24
|
-
// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
|
|
25
|
-
const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
26
|
-
|
|
27
|
-
const escapedStringRegExp = /^'([^]*?)'?$/;
|
|
28
|
-
const doubleQuoteRegExp = /''/g;
|
|
29
|
-
const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* The {@link format} function options.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @name format
|
|
37
|
-
* @alias formatDate
|
|
38
|
-
* @category Common Helpers
|
|
39
|
-
* @summary Format the date.
|
|
40
|
-
*
|
|
41
|
-
* @description
|
|
42
|
-
* Return the formatted date string in the given format. The result may vary by locale.
|
|
43
|
-
*
|
|
44
|
-
* > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
|
|
45
|
-
* > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
46
|
-
*
|
|
47
|
-
* The characters wrapped between two single quotes characters (') are escaped.
|
|
48
|
-
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
|
|
49
|
-
* (see the last example)
|
|
50
|
-
*
|
|
51
|
-
* Format of the string is based on Unicode Technical Standard #35:
|
|
52
|
-
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
53
|
-
* with a few additions (see note 7 below the table).
|
|
54
|
-
*
|
|
55
|
-
* Accepted patterns:
|
|
56
|
-
* | Unit | Pattern | Result examples | Notes |
|
|
57
|
-
* |---------------------------------|---------|-----------------------------------|-------|
|
|
58
|
-
* | Era | G..GGG | AD, BC | |
|
|
59
|
-
* | | GGGG | Anno Domini, Before Christ | 2 |
|
|
60
|
-
* | | GGGGG | A, B | |
|
|
61
|
-
* | Calendar year | y | 44, 1, 1900, 2017 | 5 |
|
|
62
|
-
* | | yo | 44th, 1st, 0th, 17th | 5,7 |
|
|
63
|
-
* | | yy | 44, 01, 00, 17 | 5 |
|
|
64
|
-
* | | yyy | 044, 001, 1900, 2017 | 5 |
|
|
65
|
-
* | | yyyy | 0044, 0001, 1900, 2017 | 5 |
|
|
66
|
-
* | | yyyyy | ... | 3,5 |
|
|
67
|
-
* | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
|
|
68
|
-
* | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
|
|
69
|
-
* | | YY | 44, 01, 00, 17 | 5,8 |
|
|
70
|
-
* | | YYY | 044, 001, 1900, 2017 | 5 |
|
|
71
|
-
* | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
|
|
72
|
-
* | | YYYYY | ... | 3,5 |
|
|
73
|
-
* | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
|
|
74
|
-
* | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
|
|
75
|
-
* | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
|
|
76
|
-
* | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
|
|
77
|
-
* | | RRRRR | ... | 3,5,7 |
|
|
78
|
-
* | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
|
|
79
|
-
* | | uu | -43, 01, 1900, 2017 | 5 |
|
|
80
|
-
* | | uuu | -043, 001, 1900, 2017 | 5 |
|
|
81
|
-
* | | uuuu | -0043, 0001, 1900, 2017 | 5 |
|
|
82
|
-
* | | uuuuu | ... | 3,5 |
|
|
83
|
-
* | Quarter (formatting) | Q | 1, 2, 3, 4 | |
|
|
84
|
-
* | | Qo | 1st, 2nd, 3rd, 4th | 7 |
|
|
85
|
-
* | | QQ | 01, 02, 03, 04 | |
|
|
86
|
-
* | | QQQ | Q1, Q2, Q3, Q4 | |
|
|
87
|
-
* | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
|
|
88
|
-
* | | QQQQQ | 1, 2, 3, 4 | 4 |
|
|
89
|
-
* | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
|
|
90
|
-
* | | qo | 1st, 2nd, 3rd, 4th | 7 |
|
|
91
|
-
* | | qq | 01, 02, 03, 04 | |
|
|
92
|
-
* | | qqq | Q1, Q2, Q3, Q4 | |
|
|
93
|
-
* | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
|
|
94
|
-
* | | qqqqq | 1, 2, 3, 4 | 4 |
|
|
95
|
-
* | Month (formatting) | M | 1, 2, ..., 12 | |
|
|
96
|
-
* | | Mo | 1st, 2nd, ..., 12th | 7 |
|
|
97
|
-
* | | MM | 01, 02, ..., 12 | |
|
|
98
|
-
* | | MMM | Jan, Feb, ..., Dec | |
|
|
99
|
-
* | | MMMM | January, February, ..., December | 2 |
|
|
100
|
-
* | | MMMMM | J, F, ..., D | |
|
|
101
|
-
* | Month (stand-alone) | L | 1, 2, ..., 12 | |
|
|
102
|
-
* | | Lo | 1st, 2nd, ..., 12th | 7 |
|
|
103
|
-
* | | LL | 01, 02, ..., 12 | |
|
|
104
|
-
* | | LLL | Jan, Feb, ..., Dec | |
|
|
105
|
-
* | | LLLL | January, February, ..., December | 2 |
|
|
106
|
-
* | | LLLLL | J, F, ..., D | |
|
|
107
|
-
* | Local week of year | w | 1, 2, ..., 53 | |
|
|
108
|
-
* | | wo | 1st, 2nd, ..., 53th | 7 |
|
|
109
|
-
* | | ww | 01, 02, ..., 53 | |
|
|
110
|
-
* | ISO week of year | I | 1, 2, ..., 53 | 7 |
|
|
111
|
-
* | | Io | 1st, 2nd, ..., 53th | 7 |
|
|
112
|
-
* | | II | 01, 02, ..., 53 | 7 |
|
|
113
|
-
* | Day of month | d | 1, 2, ..., 31 | |
|
|
114
|
-
* | | do | 1st, 2nd, ..., 31st | 7 |
|
|
115
|
-
* | | dd | 01, 02, ..., 31 | |
|
|
116
|
-
* | Day of year | D | 1, 2, ..., 365, 366 | 9 |
|
|
117
|
-
* | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
|
|
118
|
-
* | | DD | 01, 02, ..., 365, 366 | 9 |
|
|
119
|
-
* | | DDD | 001, 002, ..., 365, 366 | |
|
|
120
|
-
* | | DDDD | ... | 3 |
|
|
121
|
-
* | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
|
|
122
|
-
* | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
|
|
123
|
-
* | | EEEEE | M, T, W, T, F, S, S | |
|
|
124
|
-
* | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
125
|
-
* | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
|
|
126
|
-
* | | io | 1st, 2nd, ..., 7th | 7 |
|
|
127
|
-
* | | ii | 01, 02, ..., 07 | 7 |
|
|
128
|
-
* | | iii | Mon, Tue, Wed, ..., Sun | 7 |
|
|
129
|
-
* | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
|
|
130
|
-
* | | iiiii | M, T, W, T, F, S, S | 7 |
|
|
131
|
-
* | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
|
|
132
|
-
* | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
|
|
133
|
-
* | | eo | 2nd, 3rd, ..., 1st | 7 |
|
|
134
|
-
* | | ee | 02, 03, ..., 01 | |
|
|
135
|
-
* | | eee | Mon, Tue, Wed, ..., Sun | |
|
|
136
|
-
* | | eeee | Monday, Tuesday, ..., Sunday | 2 |
|
|
137
|
-
* | | eeeee | M, T, W, T, F, S, S | |
|
|
138
|
-
* | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
139
|
-
* | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
|
|
140
|
-
* | | co | 2nd, 3rd, ..., 1st | 7 |
|
|
141
|
-
* | | cc | 02, 03, ..., 01 | |
|
|
142
|
-
* | | ccc | Mon, Tue, Wed, ..., Sun | |
|
|
143
|
-
* | | cccc | Monday, Tuesday, ..., Sunday | 2 |
|
|
144
|
-
* | | ccccc | M, T, W, T, F, S, S | |
|
|
145
|
-
* | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
146
|
-
* | AM, PM | a..aa | AM, PM | |
|
|
147
|
-
* | | aaa | am, pm | |
|
|
148
|
-
* | | aaaa | a.m., p.m. | 2 |
|
|
149
|
-
* | | aaaaa | a, p | |
|
|
150
|
-
* | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
|
|
151
|
-
* | | bbb | am, pm, noon, midnight | |
|
|
152
|
-
* | | bbbb | a.m., p.m., noon, midnight | 2 |
|
|
153
|
-
* | | bbbbb | a, p, n, mi | |
|
|
154
|
-
* | Flexible day period | B..BBB | at night, in the morning, ... | |
|
|
155
|
-
* | | BBBB | at night, in the morning, ... | 2 |
|
|
156
|
-
* | | BBBBB | at night, in the morning, ... | |
|
|
157
|
-
* | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
|
|
158
|
-
* | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
|
|
159
|
-
* | | hh | 01, 02, ..., 11, 12 | |
|
|
160
|
-
* | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
|
|
161
|
-
* | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
|
|
162
|
-
* | | HH | 00, 01, 02, ..., 23 | |
|
|
163
|
-
* | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
|
|
164
|
-
* | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
|
|
165
|
-
* | | KK | 01, 02, ..., 11, 00 | |
|
|
166
|
-
* | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
|
|
167
|
-
* | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
|
|
168
|
-
* | | kk | 24, 01, 02, ..., 23 | |
|
|
169
|
-
* | Minute | m | 0, 1, ..., 59 | |
|
|
170
|
-
* | | mo | 0th, 1st, ..., 59th | 7 |
|
|
171
|
-
* | | mm | 00, 01, ..., 59 | |
|
|
172
|
-
* | Second | s | 0, 1, ..., 59 | |
|
|
173
|
-
* | | so | 0th, 1st, ..., 59th | 7 |
|
|
174
|
-
* | | ss | 00, 01, ..., 59 | |
|
|
175
|
-
* | Fraction of second | S | 0, 1, ..., 9 | |
|
|
176
|
-
* | | SS | 00, 01, ..., 99 | |
|
|
177
|
-
* | | SSS | 000, 001, ..., 999 | |
|
|
178
|
-
* | | SSSS | ... | 3 |
|
|
179
|
-
* | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
|
|
180
|
-
* | | XX | -0800, +0530, Z | |
|
|
181
|
-
* | | XXX | -08:00, +05:30, Z | |
|
|
182
|
-
* | | XXXX | -0800, +0530, Z, +123456 | 2 |
|
|
183
|
-
* | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
|
|
184
|
-
* | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
|
|
185
|
-
* | | xx | -0800, +0530, +0000 | |
|
|
186
|
-
* | | xxx | -08:00, +05:30, +00:00 | 2 |
|
|
187
|
-
* | | xxxx | -0800, +0530, +0000, +123456 | |
|
|
188
|
-
* | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
|
|
189
|
-
* | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
|
|
190
|
-
* | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
|
|
191
|
-
* | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
|
|
192
|
-
* | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
|
|
193
|
-
* | Seconds timestamp | t | 512969520 | 7 |
|
|
194
|
-
* | | tt | ... | 3,7 |
|
|
195
|
-
* | Milliseconds timestamp | T | 512969520900 | 7 |
|
|
196
|
-
* | | TT | ... | 3,7 |
|
|
197
|
-
* | Long localized date | P | 04/29/1453 | 7 |
|
|
198
|
-
* | | PP | Apr 29, 1453 | 7 |
|
|
199
|
-
* | | PPP | April 29th, 1453 | 7 |
|
|
200
|
-
* | | PPPP | Friday, April 29th, 1453 | 2,7 |
|
|
201
|
-
* | Long localized time | p | 12:00 AM | 7 |
|
|
202
|
-
* | | pp | 12:00:00 AM | 7 |
|
|
203
|
-
* | | ppp | 12:00:00 AM GMT+2 | 7 |
|
|
204
|
-
* | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
|
|
205
|
-
* | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
|
|
206
|
-
* | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
|
|
207
|
-
* | | PPPppp | April 29th, 1453 at ... | 7 |
|
|
208
|
-
* | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
|
|
209
|
-
* Notes:
|
|
210
|
-
* 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
|
|
211
|
-
* are the same as "stand-alone" units, but are different in some languages.
|
|
212
|
-
* "Formatting" units are declined according to the rules of the language
|
|
213
|
-
* in the context of a date. "Stand-alone" units are always nominative singular:
|
|
214
|
-
*
|
|
215
|
-
* `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
|
|
216
|
-
*
|
|
217
|
-
* `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
|
|
218
|
-
*
|
|
219
|
-
* 2. Any sequence of the identical letters is a pattern, unless it is escaped by
|
|
220
|
-
* the single quote characters (see below).
|
|
221
|
-
* If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
|
|
222
|
-
* the output will be the same as default pattern for this unit, usually
|
|
223
|
-
* the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
|
|
224
|
-
* are marked with "2" in the last column of the table.
|
|
225
|
-
*
|
|
226
|
-
* `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
|
|
227
|
-
*
|
|
228
|
-
* `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
|
|
229
|
-
*
|
|
230
|
-
* `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
|
|
231
|
-
*
|
|
232
|
-
* `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
|
|
233
|
-
*
|
|
234
|
-
* `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
|
|
235
|
-
*
|
|
236
|
-
* 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
|
|
237
|
-
* The output will be padded with zeros to match the length of the pattern.
|
|
238
|
-
*
|
|
239
|
-
* `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
|
|
240
|
-
*
|
|
241
|
-
* 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
|
|
242
|
-
* These tokens represent the shortest form of the quarter.
|
|
243
|
-
*
|
|
244
|
-
* 5. The main difference between `y` and `u` patterns are B.C. years:
|
|
245
|
-
*
|
|
246
|
-
* | Year | `y` | `u` |
|
|
247
|
-
* |------|-----|-----|
|
|
248
|
-
* | AC 1 | 1 | 1 |
|
|
249
|
-
* | BC 1 | 1 | 0 |
|
|
250
|
-
* | BC 2 | 2 | -1 |
|
|
251
|
-
*
|
|
252
|
-
* Also `yy` always returns the last two digits of a year,
|
|
253
|
-
* while `uu` pads single digit years to 2 characters and returns other years unchanged:
|
|
254
|
-
*
|
|
255
|
-
* | Year | `yy` | `uu` |
|
|
256
|
-
* |------|------|------|
|
|
257
|
-
* | 1 | 01 | 01 |
|
|
258
|
-
* | 14 | 14 | 14 |
|
|
259
|
-
* | 376 | 76 | 376 |
|
|
260
|
-
* | 1453 | 53 | 1453 |
|
|
261
|
-
*
|
|
262
|
-
* The same difference is true for local and ISO week-numbering years (`Y` and `R`),
|
|
263
|
-
* except local week-numbering years are dependent on `options.weekStartsOn`
|
|
264
|
-
* and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear)
|
|
265
|
-
* and [getWeekYear](https://date-fns.org/docs/getWeekYear)).
|
|
266
|
-
*
|
|
267
|
-
* 6. Specific non-location timezones are currently unavailable in `date-fns`,
|
|
268
|
-
* so right now these tokens fall back to GMT timezones.
|
|
269
|
-
*
|
|
270
|
-
* 7. These patterns are not in the Unicode Technical Standard #35:
|
|
271
|
-
* - `i`: ISO day of week
|
|
272
|
-
* - `I`: ISO week of year
|
|
273
|
-
* - `R`: ISO week-numbering year
|
|
274
|
-
* - `t`: seconds timestamp
|
|
275
|
-
* - `T`: milliseconds timestamp
|
|
276
|
-
* - `o`: ordinal number modifier
|
|
277
|
-
* - `P`: long localized date
|
|
278
|
-
* - `p`: long localized time
|
|
279
|
-
*
|
|
280
|
-
* 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
|
|
281
|
-
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
282
|
-
*
|
|
283
|
-
* 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
|
|
284
|
-
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
285
|
-
*
|
|
286
|
-
* @param date - The original date
|
|
287
|
-
* @param format - The string of tokens
|
|
288
|
-
* @param options - An object with options
|
|
289
|
-
*
|
|
290
|
-
* @returns The formatted date string
|
|
291
|
-
*
|
|
292
|
-
* @throws `date` must not be Invalid Date
|
|
293
|
-
* @throws `options.locale` must contain `localize` property
|
|
294
|
-
* @throws `options.locale` must contain `formatLong` property
|
|
295
|
-
* @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
|
|
296
|
-
* @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
|
|
297
|
-
* @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
|
|
298
|
-
* @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
|
|
299
|
-
* @throws format string contains an unescaped latin alphabet character
|
|
300
|
-
*
|
|
301
|
-
* @example
|
|
302
|
-
* // Represent 11 February 2014 in middle-endian format:
|
|
303
|
-
* const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
|
|
304
|
-
* //=> '02/11/2014'
|
|
305
|
-
*
|
|
306
|
-
* @example
|
|
307
|
-
* // Represent 2 July 2014 in Esperanto:
|
|
308
|
-
* import { eoLocale } from 'date-fns/locale/eo'
|
|
309
|
-
* const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
|
|
310
|
-
* locale: eoLocale
|
|
311
|
-
* })
|
|
312
|
-
* //=> '2-a de julio 2014'
|
|
313
|
-
*
|
|
314
|
-
* @example
|
|
315
|
-
* // Escape string by single quote characters:
|
|
316
|
-
* const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
|
|
317
|
-
* //=> "3 o'clock"
|
|
318
|
-
*/
|
|
319
|
-
function format(date, formatStr, options) {
|
|
320
|
-
const defaultOptions = getDefaultOptions();
|
|
321
|
-
const locale = options?.locale ?? defaultOptions.locale ?? enUS;
|
|
322
|
-
|
|
323
|
-
const firstWeekContainsDate =
|
|
324
|
-
options?.firstWeekContainsDate ??
|
|
325
|
-
options?.locale?.options?.firstWeekContainsDate ??
|
|
326
|
-
defaultOptions.firstWeekContainsDate ??
|
|
327
|
-
defaultOptions.locale?.options?.firstWeekContainsDate ??
|
|
328
|
-
1;
|
|
329
|
-
|
|
330
|
-
const weekStartsOn =
|
|
331
|
-
options?.weekStartsOn ??
|
|
332
|
-
options?.locale?.options?.weekStartsOn ??
|
|
333
|
-
defaultOptions.weekStartsOn ??
|
|
334
|
-
defaultOptions.locale?.options?.weekStartsOn ??
|
|
335
|
-
0;
|
|
336
|
-
|
|
337
|
-
const originalDate = toDate(date, options?.in);
|
|
338
|
-
|
|
339
|
-
if (!isValid(originalDate)) {
|
|
340
|
-
throw new RangeError("Invalid time value");
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
let parts = formatStr
|
|
344
|
-
.match(longFormattingTokensRegExp)
|
|
345
|
-
.map((substring) => {
|
|
346
|
-
const firstCharacter = substring[0];
|
|
347
|
-
if (firstCharacter === "p" || firstCharacter === "P") {
|
|
348
|
-
const longFormatter = longFormatters[firstCharacter];
|
|
349
|
-
return longFormatter(substring, locale.formatLong);
|
|
350
|
-
}
|
|
351
|
-
return substring;
|
|
352
|
-
})
|
|
353
|
-
.join("")
|
|
354
|
-
.match(formattingTokensRegExp)
|
|
355
|
-
.map((substring) => {
|
|
356
|
-
// Replace two single quote characters with one single quote character
|
|
357
|
-
if (substring === "''") {
|
|
358
|
-
return { isToken: false, value: "'" };
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
const firstCharacter = substring[0];
|
|
362
|
-
if (firstCharacter === "'") {
|
|
363
|
-
return { isToken: false, value: cleanEscapedString(substring) };
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
if (formatters[firstCharacter]) {
|
|
367
|
-
return { isToken: true, value: substring };
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
|
|
371
|
-
throw new RangeError(
|
|
372
|
-
"Format string contains an unescaped latin alphabet character `" +
|
|
373
|
-
firstCharacter +
|
|
374
|
-
"`",
|
|
375
|
-
);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
return { isToken: false, value: substring };
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
// invoke localize preprocessor (only for french locales at the moment)
|
|
382
|
-
if (locale.localize.preprocessor) {
|
|
383
|
-
parts = locale.localize.preprocessor(originalDate, parts);
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
const formatterOptions = {
|
|
387
|
-
firstWeekContainsDate,
|
|
388
|
-
weekStartsOn,
|
|
389
|
-
locale,
|
|
390
|
-
};
|
|
391
|
-
|
|
392
|
-
return parts
|
|
393
|
-
.map((part) => {
|
|
394
|
-
if (!part.isToken) return part.value;
|
|
395
|
-
|
|
396
|
-
const token = part.value;
|
|
397
|
-
|
|
398
|
-
if (
|
|
399
|
-
(!options?.useAdditionalWeekYearTokens &&
|
|
400
|
-
isProtectedWeekYearToken(token)) ||
|
|
401
|
-
(!options?.useAdditionalDayOfYearTokens &&
|
|
402
|
-
isProtectedDayOfYearToken(token))
|
|
403
|
-
) {
|
|
404
|
-
warnOrThrowProtectedError(token, formatStr, String(date));
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
const formatter = formatters[token[0]];
|
|
408
|
-
return formatter(originalDate, token, locale.localize, formatterOptions);
|
|
409
|
-
})
|
|
410
|
-
.join("");
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
function cleanEscapedString(input) {
|
|
414
|
-
const matched = input.match(escapedStringRegExp);
|
|
415
|
-
|
|
416
|
-
if (!matched) {
|
|
417
|
-
return input;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
return matched[1].replace(doubleQuoteRegExp, "'");
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
export { format as default, format, format as formatDate, formatters, longFormatters };
|