@mui/x-date-pickers 6.2.0 → 6.3.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/AdapterDateFns/AdapterDateFns.d.ts +109 -0
- package/AdapterDateFns/AdapterDateFns.js +598 -0
- package/AdapterDateFns/index.d.ts +1 -13
- package/AdapterDateFns/index.js +1 -149
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +109 -0
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +610 -0
- package/AdapterDateFnsJalali/index.d.ts +1 -13
- package/AdapterDateFnsJalali/index.js +1 -149
- package/AdapterDayjs/AdapterDayjs.d.ts +53 -53
- package/AdapterDayjs/AdapterDayjs.js +146 -111
- package/AdapterLuxon/AdapterLuxon.d.ts +108 -0
- package/AdapterLuxon/AdapterLuxon.js +513 -0
- package/AdapterLuxon/index.d.ts +1 -14
- package/AdapterLuxon/index.js +1 -111
- package/AdapterMoment/AdapterMoment.d.ts +110 -0
- package/AdapterMoment/AdapterMoment.js +416 -0
- package/AdapterMoment/index.d.ts +1 -21
- package/AdapterMoment/index.js +1 -99
- package/AdapterMomentHijri/AdapterMomentHijri.d.ts +67 -0
- package/AdapterMomentHijri/AdapterMomentHijri.js +269 -0
- package/AdapterMomentHijri/index.d.ts +1 -18
- package/AdapterMomentHijri/index.js +1 -74
- package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +74 -0
- package/AdapterMomentJalaali/AdapterMomentJalaali.js +276 -0
- package/AdapterMomentJalaali/index.d.ts +1 -22
- package/AdapterMomentJalaali/index.js +1 -87
- package/CHANGELOG.md +118 -1
- package/DateCalendar/DateCalendar.types.d.ts +1 -1
- package/DateCalendar/DayCalendar.d.ts +1 -1
- package/DateCalendar/DayCalendar.js +1 -1
- package/DateCalendar/PickersCalendarHeader.d.ts +1 -1
- package/DateCalendar/useCalendarState.js +1 -1
- package/DateCalendar/useIsDateDisabled.d.ts +2 -0
- package/DateCalendar/useIsDateDisabled.js +27 -0
- package/DateField/DateField.js +20 -3
- package/DateField/DateField.types.d.ts +2 -2
- package/DateField/useDateField.js +4 -2
- package/DatePicker/DatePickerToolbar.js +1 -1
- package/DateTimeField/DateTimeField.js +21 -3
- package/DateTimeField/DateTimeField.types.d.ts +3 -2
- package/DateTimeField/useDateTimeField.js +4 -2
- package/DateTimePicker/DateTimePicker.js +1 -0
- package/DateTimePicker/shared.d.ts +6 -5
- package/DesktopDatePicker/DesktopDatePicker.js +2 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -1
- package/DesktopTimePicker/DesktopTimePicker.js +51 -8
- package/DesktopTimePicker/DesktopTimePicker.types.d.ts +12 -4
- package/DigitalClock/DigitalClock.d.ts +7 -0
- package/DigitalClock/DigitalClock.js +397 -0
- package/DigitalClock/DigitalClock.types.d.ts +47 -0
- package/DigitalClock/digitalClockClasses.d.ts +11 -0
- package/DigitalClock/digitalClockClasses.js +6 -0
- package/DigitalClock/index.d.ts +4 -0
- package/DigitalClock/index.js +2 -0
- package/DigitalClock/package.json +6 -0
- package/LocalizationProvider/LocalizationProvider.d.ts +1 -1
- package/LocalizationProvider/LocalizationProvider.js +1 -1
- package/MobileDatePicker/MobileDatePicker.js +2 -1
- package/MobileDateTimePicker/MobileDateTimePicker.js +3 -1
- package/MobileTimePicker/MobileTimePicker.js +3 -1
- package/MobileTimePicker/MobileTimePicker.types.d.ts +8 -7
- package/MonthCalendar/MonthCalendar.types.d.ts +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.d.ts +7 -0
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +479 -0
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +57 -0
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.d.ts +22 -0
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +65 -0
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +28 -0
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +151 -0
- package/MultiSectionDigitalClock/index.d.ts +7 -0
- package/MultiSectionDigitalClock/index.js +3 -0
- package/MultiSectionDigitalClock/multiSectionDigitalClockClasses.d.ts +7 -0
- package/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +6 -0
- package/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.d.ts +9 -0
- package/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +6 -0
- package/MultiSectionDigitalClock/package.json +6 -0
- package/PickersDay/PickersDay.js +4 -1
- package/PickersLayout/PickersLayout.d.ts +2 -2
- package/PickersLayout/PickersLayout.js +2 -2
- package/PickersLayout/PickersLayout.types.d.ts +7 -8
- package/PickersLayout/usePickerLayout.d.ts +2 -2
- package/README.md +0 -9
- package/StaticDatePicker/StaticDatePicker.js +1 -0
- package/StaticDateTimePicker/StaticDateTimePicker.js +5 -3
- package/StaticTimePicker/StaticTimePicker.js +5 -3
- package/StaticTimePicker/StaticTimePicker.types.d.ts +1 -1
- package/TimeClock/TimeClock.js +35 -12
- package/TimeClock/TimeClock.types.d.ts +4 -67
- package/TimeField/TimeField.js +21 -3
- package/TimeField/TimeField.types.d.ts +3 -2
- package/TimeField/useTimeField.js +4 -2
- package/TimePicker/TimePicker.js +25 -2
- package/TimePicker/TimePicker.types.d.ts +4 -3
- package/TimePicker/TimePickerToolbar.d.ts +2 -2
- package/TimePicker/TimePickerToolbar.js +2 -2
- package/TimePicker/shared.d.ts +9 -7
- package/YearCalendar/YearCalendar.types.d.ts +1 -1
- package/dateViewRenderers/dateViewRenderers.d.ts +2 -2
- package/index.d.ts +2 -0
- package/index.js +4 -1
- package/internals/components/PickersToolbar.d.ts +3 -3
- package/internals/constants/dimensions.d.ts +1 -0
- package/internals/constants/dimensions.js +2 -1
- package/internals/demo/DemoContainer.js +4 -1
- package/internals/hooks/date-helpers-hooks.d.ts +3 -2
- package/internals/hooks/date-helpers-hooks.js +3 -3
- package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +2 -2
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +15 -15
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +7 -6
- package/internals/hooks/useField/useField.js +12 -11
- package/internals/hooks/useField/useField.types.d.ts +19 -5
- package/internals/hooks/useField/useField.utils.d.ts +9 -6
- package/internals/hooks/useField/useField.utils.js +60 -34
- package/internals/hooks/useField/useFieldCharacterEditing.js +18 -10
- package/internals/hooks/useField/useFieldState.js +5 -4
- package/internals/hooks/useIsLandscape.d.ts +2 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.d.ts +2 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.js +10 -10
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +7 -6
- package/internals/hooks/usePicker/usePicker.d.ts +4 -3
- package/internals/hooks/usePicker/usePicker.js +2 -0
- package/internals/hooks/usePicker/usePicker.types.d.ts +6 -5
- package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +5 -6
- package/internals/hooks/usePicker/usePickerValue.d.ts +2 -2
- package/internals/hooks/usePicker/usePickerValue.js +10 -12
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +5 -3
- package/internals/hooks/usePicker/usePickerViews.d.ts +11 -11
- package/internals/hooks/useStaticPicker/useStaticPicker.d.ts +2 -2
- package/internals/hooks/useStaticPicker/useStaticPicker.js +10 -10
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +6 -5
- package/internals/hooks/{validation/useValidation.d.ts → useValidation.d.ts} +1 -1
- package/internals/hooks/{validation/useValidation.js → useValidation.js} +1 -1
- package/internals/hooks/useViews.d.ts +8 -6
- package/internals/hooks/useViews.js +29 -13
- package/internals/index.d.ts +7 -7
- package/internals/index.js +5 -5
- package/internals/models/common.d.ts +3 -0
- package/internals/models/index.d.ts +1 -0
- package/internals/models/index.js +2 -1
- package/internals/models/props/basePickerProps.d.ts +3 -3
- package/internals/models/props/clock.d.ts +88 -0
- package/internals/models/props/tabs.d.ts +2 -2
- package/internals/models/props/toolbar.d.ts +3 -3
- package/internals/{hooks/validation/models.d.ts → models/validation.d.ts} +2 -5
- package/internals/models/validation.js +1 -0
- package/internals/utils/time-utils.d.ts +7 -7
- package/internals/utils/time-utils.js +2 -1
- package/internals/{hooks/validation/useDateValidation.d.ts → utils/validation/validateDate.d.ts} +2 -3
- package/internals/{hooks/validation/useDateValidation.js → utils/validation/validateDate.js} +1 -27
- package/internals/{hooks/validation/useDateTimeValidation.d.ts → utils/validation/validateDateTime.d.ts} +3 -3
- package/{modern/internals/hooks/validation/useDateTimeValidation.js → internals/utils/validation/validateDateTime.js} +2 -2
- package/internals/{hooks/validation/useTimeValidation.d.ts → utils/validation/validateTime.d.ts} +2 -2
- package/{modern/internals/hooks/validation/useTimeValidation.js → internals/utils/validation/validateTime.js} +1 -1
- package/internals/utils/valueManagers.js +1 -1
- package/internals/utils/views.d.ts +3 -2
- package/legacy/AdapterDateFns/AdapterDateFns.js +606 -0
- package/legacy/AdapterDateFns/index.js +1 -165
- package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +620 -0
- package/legacy/AdapterDateFnsJalali/index.js +1 -165
- package/legacy/AdapterDayjs/AdapterDayjs.js +146 -111
- package/legacy/AdapterLuxon/AdapterLuxon.js +524 -0
- package/legacy/AdapterLuxon/index.js +1 -127
- package/legacy/AdapterMoment/AdapterMoment.js +422 -0
- package/legacy/AdapterMoment/index.js +1 -115
- package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +284 -0
- package/legacy/AdapterMomentHijri/index.js +1 -90
- package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +291 -0
- package/legacy/AdapterMomentJalaali/index.js +1 -103
- package/legacy/DateCalendar/DayCalendar.js +1 -1
- package/legacy/DateCalendar/useCalendarState.js +1 -1
- package/legacy/DateCalendar/useIsDateDisabled.js +28 -0
- package/legacy/DateField/DateField.js +20 -3
- package/legacy/DateField/useDateField.js +4 -2
- package/legacy/DatePicker/DatePickerToolbar.js +1 -1
- package/legacy/DateTimeField/DateTimeField.js +21 -3
- package/legacy/DateTimeField/useDateTimeField.js +4 -2
- package/legacy/DateTimePicker/DateTimePicker.js +1 -0
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +2 -1
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -1
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +52 -8
- package/legacy/DigitalClock/DigitalClock.js +419 -0
- package/legacy/DigitalClock/DigitalClock.types.js +1 -0
- package/legacy/DigitalClock/digitalClockClasses.js +6 -0
- package/legacy/DigitalClock/index.js +2 -0
- package/legacy/LocalizationProvider/LocalizationProvider.js +1 -1
- package/legacy/MobileDatePicker/MobileDatePicker.js +2 -1
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +3 -1
- package/legacy/MobileTimePicker/MobileTimePicker.js +3 -1
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +508 -0
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.types.js +1 -0
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +65 -0
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +157 -0
- package/legacy/MultiSectionDigitalClock/index.js +3 -0
- package/legacy/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +6 -0
- package/legacy/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +6 -0
- package/legacy/PickersDay/PickersDay.js +3 -1
- package/legacy/PickersLayout/PickersLayout.js +2 -2
- package/legacy/StaticDatePicker/StaticDatePicker.js +1 -0
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +5 -3
- package/legacy/StaticTimePicker/StaticTimePicker.js +5 -3
- package/legacy/TimeClock/TimeClock.js +35 -12
- package/legacy/TimeField/TimeField.js +21 -3
- package/legacy/TimeField/useTimeField.js +4 -2
- package/legacy/TimePicker/TimePicker.js +25 -2
- package/legacy/TimePicker/TimePickerToolbar.js +2 -2
- package/legacy/index.js +4 -1
- package/legacy/internals/constants/dimensions.js +2 -1
- package/legacy/internals/demo/DemoContainer.js +4 -1
- package/legacy/internals/hooks/date-helpers-hooks.js +3 -3
- package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +10 -11
- package/legacy/internals/hooks/useField/useField.js +11 -10
- package/legacy/internals/hooks/useField/useField.utils.js +58 -34
- package/legacy/internals/hooks/useField/useFieldCharacterEditing.js +18 -10
- package/legacy/internals/hooks/useField/useFieldState.js +7 -5
- package/legacy/internals/hooks/useMobilePicker/useMobilePicker.js +5 -6
- package/legacy/internals/hooks/usePicker/usePicker.js +2 -0
- package/legacy/internals/hooks/usePicker/usePickerValue.js +10 -14
- package/legacy/internals/hooks/useStaticPicker/useStaticPicker.js +7 -8
- package/legacy/internals/hooks/{validation/useValidation.js → useValidation.js} +1 -1
- package/legacy/internals/hooks/useViews.js +30 -14
- package/legacy/internals/index.js +5 -5
- package/legacy/internals/models/index.js +2 -1
- package/legacy/internals/models/props/clock.js +1 -0
- package/legacy/internals/models/validation.js +1 -0
- package/legacy/internals/utils/time-utils.js +2 -1
- package/legacy/internals/{hooks/validation/useDateValidation.js → utils/validation/validateDate.js} +1 -28
- package/legacy/internals/{hooks/validation/useDateTimeValidation.js → utils/validation/validateDateTime.js} +2 -2
- package/legacy/internals/{hooks/validation/useTimeValidation.js → utils/validation/validateTime.js} +1 -1
- package/legacy/internals/utils/valueManagers.js +2 -2
- package/legacy/locales/beBY.js +5 -3
- package/legacy/locales/caES.js +6 -1
- package/legacy/locales/csCZ.js +6 -4
- package/legacy/locales/daDK.js +6 -2
- package/legacy/locales/deDE.js +6 -2
- package/legacy/locales/enUS.js +4 -0
- package/legacy/locales/esES.js +6 -1
- package/legacy/locales/faIR.js +11 -1
- package/legacy/locales/fiFI.js +6 -1
- package/legacy/locales/frFR.js +6 -1
- package/legacy/locales/heIL.js +6 -1
- package/legacy/locales/huHU.js +6 -2
- package/legacy/locales/index.js +1 -0
- package/legacy/locales/isIS.js +11 -1
- package/legacy/locales/itIT.js +6 -1
- package/legacy/locales/jaJP.js +6 -2
- package/legacy/locales/koKR.js +6 -1
- package/legacy/locales/kzKZ.js +6 -2
- package/legacy/locales/nbNO.js +11 -1
- package/legacy/locales/nlNL.js +11 -1
- package/legacy/locales/plPL.js +11 -1
- package/legacy/locales/ptBR.js +11 -1
- package/legacy/locales/ruRU.js +6 -2
- package/legacy/locales/svSE.js +11 -1
- package/legacy/locales/trTR.js +22 -7
- package/legacy/locales/ukUA.js +11 -1
- package/legacy/locales/urPK.js +11 -1
- package/legacy/locales/zhCN.js +44 -23
- package/legacy/models/common.js +1 -0
- package/legacy/models/index.js +2 -1
- package/legacy/tests/describeAdapters/describeAdapters.js +1 -3
- package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.js +3 -1
- package/legacy/tests/describeGregorianAdapter/testCalculations.js +29 -26
- package/legacy/tests/describeGregorianAdapter/testLocalization.js +2 -2
- package/legacy/tests/describeHijriAdapter/describeHijriAdapter.js +23 -0
- package/legacy/tests/describeHijriAdapter/describeHijriAdapter.types.js +1 -0
- package/legacy/tests/describeHijriAdapter/index.js +1 -0
- package/legacy/tests/describeHijriAdapter/testCalculations.js +94 -0
- package/legacy/tests/describeHijriAdapter/testLocalization.js +12 -0
- package/legacy/tests/describeJalaliAdapter/describeJalaliAdapter.js +25 -0
- package/legacy/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +1 -0
- package/legacy/tests/describeJalaliAdapter/index.js +1 -0
- package/legacy/tests/describeJalaliAdapter/testCalculations.js +82 -0
- package/legacy/tests/describeJalaliAdapter/testLocalization.js +12 -0
- package/legacy/tests/describePicker/describePicker.js +159 -0
- package/legacy/tests/describePicker/describePicker.types.js +1 -0
- package/legacy/tests/describePicker/index.js +1 -0
- package/legacy/tests/describeValue/describeValue.js +1 -1
- package/legacy/tests/describeValue/testControlledUnControlled.js +8 -9
- package/legacy/tests/describeValue/testPickerActionBar.js +46 -13
- package/legacy/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -5
- package/legacy/timeViewRenderers/index.js +1 -1
- package/legacy/timeViewRenderers/timeViewRenderers.js +132 -4
- package/locales/beBY.d.ts +4 -2
- package/locales/beBY.js +3 -3
- package/locales/caES.d.ts +4 -2
- package/locales/caES.js +4 -1
- package/locales/csCZ.d.ts +4 -2
- package/locales/csCZ.js +4 -4
- package/locales/daDK.d.ts +4 -2
- package/locales/daDK.js +4 -2
- package/locales/deDE.d.ts +4 -2
- package/locales/deDE.js +4 -2
- package/locales/enUS.d.ts +3 -2
- package/locales/enUS.js +2 -0
- package/locales/esES.d.ts +4 -2
- package/locales/esES.js +4 -1
- package/locales/faIR.d.ts +4 -2
- package/locales/faIR.js +9 -1
- package/locales/fiFI.d.ts +4 -2
- package/locales/fiFI.js +4 -1
- package/locales/frFR.d.ts +4 -2
- package/locales/frFR.js +4 -1
- package/locales/heIL.d.ts +4 -2
- package/locales/heIL.js +4 -1
- package/locales/huHU.d.ts +4 -2
- package/locales/huHU.js +4 -2
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/isIS.d.ts +4 -2
- package/locales/isIS.js +9 -1
- package/locales/itIT.d.ts +4 -2
- package/locales/itIT.js +4 -1
- package/locales/jaJP.d.ts +4 -2
- package/locales/jaJP.js +4 -2
- package/locales/koKR.d.ts +4 -2
- package/locales/koKR.js +4 -1
- package/locales/kzKZ.d.ts +4 -2
- package/locales/kzKZ.js +4 -2
- package/locales/nbNO.d.ts +4 -2
- package/locales/nbNO.js +9 -1
- package/locales/nlNL.d.ts +8 -7
- package/locales/nlNL.js +9 -1
- package/locales/plPL.d.ts +4 -2
- package/locales/plPL.js +9 -1
- package/locales/ptBR.d.ts +4 -2
- package/locales/ptBR.js +9 -1
- package/locales/ruRU.d.ts +4 -2
- package/locales/ruRU.js +4 -2
- package/locales/svSE.d.ts +4 -2
- package/locales/svSE.js +9 -1
- package/locales/trTR.d.ts +4 -2
- package/locales/trTR.js +14 -7
- package/locales/ukUA.d.ts +4 -2
- package/locales/ukUA.js +9 -1
- package/locales/urPK.d.ts +4 -2
- package/locales/urPK.js +9 -1
- package/locales/utils/getPickersLocalization.d.ts +3 -2
- package/locales/utils/pickersLocaleTextApi.d.ts +5 -3
- package/locales/zhCN.d.ts +4 -2
- package/locales/zhCN.js +22 -23
- package/models/adapters.d.ts +7 -6
- package/models/common.d.ts +5 -0
- package/models/common.js +1 -0
- package/models/fields.d.ts +20 -2
- package/models/index.d.ts +1 -0
- package/models/index.js +2 -1
- package/modern/AdapterDateFns/AdapterDateFns.js +597 -0
- package/modern/AdapterDateFns/index.js +1 -149
- package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +608 -0
- package/modern/AdapterDateFnsJalali/index.js +1 -148
- package/modern/AdapterDayjs/AdapterDayjs.js +146 -111
- package/modern/AdapterLuxon/AdapterLuxon.js +512 -0
- package/modern/AdapterLuxon/index.js +1 -111
- package/modern/AdapterMoment/AdapterMoment.js +416 -0
- package/modern/AdapterMoment/index.js +1 -99
- package/modern/AdapterMomentHijri/AdapterMomentHijri.js +269 -0
- package/modern/AdapterMomentHijri/index.js +1 -74
- package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +276 -0
- package/modern/AdapterMomentJalaali/index.js +1 -87
- package/modern/DateCalendar/DayCalendar.js +1 -1
- package/modern/DateCalendar/useCalendarState.js +1 -1
- package/modern/DateCalendar/useIsDateDisabled.js +27 -0
- package/modern/DateField/DateField.js +20 -3
- package/modern/DateField/useDateField.js +4 -2
- package/modern/DatePicker/DatePickerToolbar.js +1 -1
- package/modern/DateTimeField/DateTimeField.js +21 -3
- package/modern/DateTimeField/useDateTimeField.js +4 -2
- package/modern/DateTimePicker/DateTimePicker.js +1 -0
- package/modern/DesktopDatePicker/DesktopDatePicker.js +2 -1
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -1
- package/modern/DesktopTimePicker/DesktopTimePicker.js +50 -7
- package/modern/DigitalClock/DigitalClock.js +396 -0
- package/modern/DigitalClock/DigitalClock.types.js +1 -0
- package/modern/DigitalClock/digitalClockClasses.js +6 -0
- package/modern/DigitalClock/index.js +2 -0
- package/modern/LocalizationProvider/LocalizationProvider.js +1 -1
- package/modern/MobileDatePicker/MobileDatePicker.js +2 -1
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +3 -1
- package/modern/MobileTimePicker/MobileTimePicker.js +3 -1
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +479 -0
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.types.js +1 -0
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +65 -0
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +149 -0
- package/modern/MultiSectionDigitalClock/index.js +3 -0
- package/modern/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +6 -0
- package/modern/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +6 -0
- package/modern/PickersDay/PickersDay.js +4 -1
- package/modern/PickersLayout/PickersLayout.js +2 -2
- package/modern/StaticDatePicker/StaticDatePicker.js +1 -0
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +5 -3
- package/modern/StaticTimePicker/StaticTimePicker.js +5 -3
- package/modern/TimeClock/TimeClock.js +35 -12
- package/modern/TimeField/TimeField.js +21 -3
- package/modern/TimeField/useTimeField.js +4 -2
- package/modern/TimePicker/TimePicker.js +25 -2
- package/modern/TimePicker/TimePickerToolbar.js +2 -2
- package/modern/index.js +4 -1
- package/modern/internals/constants/dimensions.js +2 -1
- package/modern/internals/demo/DemoContainer.js +4 -1
- package/modern/internals/hooks/date-helpers-hooks.js +3 -3
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +15 -15
- package/modern/internals/hooks/useField/useField.js +12 -11
- package/modern/internals/hooks/useField/useField.utils.js +60 -34
- package/modern/internals/hooks/useField/useFieldCharacterEditing.js +18 -10
- package/modern/internals/hooks/useField/useFieldState.js +5 -4
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +10 -10
- package/modern/internals/hooks/usePicker/usePicker.js +2 -0
- package/modern/internals/hooks/usePicker/usePickerValue.js +10 -12
- package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +10 -10
- package/modern/internals/hooks/{validation/useValidation.js → useValidation.js} +1 -1
- package/modern/internals/hooks/useViews.js +29 -13
- package/modern/internals/index.js +5 -5
- package/modern/internals/models/index.js +2 -1
- package/modern/internals/models/props/clock.js +1 -0
- package/modern/internals/models/validation.js +1 -0
- package/modern/internals/utils/time-utils.js +2 -1
- package/modern/internals/{hooks/validation/useDateValidation.js → utils/validation/validateDate.js} +1 -27
- package/{internals/hooks/validation/useDateTimeValidation.js → modern/internals/utils/validation/validateDateTime.js} +2 -2
- package/{internals/hooks/validation/useTimeValidation.js → modern/internals/utils/validation/validateTime.js} +1 -1
- package/modern/internals/utils/valueManagers.js +1 -1
- package/modern/locales/beBY.js +3 -3
- package/modern/locales/caES.js +4 -1
- package/modern/locales/csCZ.js +4 -4
- package/modern/locales/daDK.js +4 -2
- package/modern/locales/deDE.js +4 -2
- package/modern/locales/enUS.js +2 -0
- package/modern/locales/esES.js +4 -1
- package/modern/locales/faIR.js +9 -1
- package/modern/locales/fiFI.js +4 -1
- package/modern/locales/frFR.js +4 -1
- package/modern/locales/heIL.js +4 -1
- package/modern/locales/huHU.js +4 -2
- package/modern/locales/index.js +1 -0
- package/modern/locales/isIS.js +9 -1
- package/modern/locales/itIT.js +4 -1
- package/modern/locales/jaJP.js +4 -2
- package/modern/locales/koKR.js +4 -1
- package/modern/locales/kzKZ.js +4 -2
- package/modern/locales/nbNO.js +9 -1
- package/modern/locales/nlNL.js +9 -1
- package/modern/locales/plPL.js +9 -1
- package/modern/locales/ptBR.js +9 -1
- package/modern/locales/ruRU.js +4 -2
- package/modern/locales/svSE.js +9 -1
- package/modern/locales/trTR.js +14 -7
- package/modern/locales/ukUA.js +9 -1
- package/modern/locales/urPK.js +9 -1
- package/modern/locales/zhCN.js +22 -23
- package/modern/models/common.js +1 -0
- package/modern/models/index.js +2 -1
- package/modern/tests/describeAdapters/describeAdapters.js +1 -3
- package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.js +3 -1
- package/modern/tests/describeGregorianAdapter/testCalculations.js +29 -26
- package/modern/tests/describeGregorianAdapter/testLocalization.js +2 -2
- package/modern/tests/describeHijriAdapter/describeHijriAdapter.js +23 -0
- package/modern/tests/describeHijriAdapter/describeHijriAdapter.types.js +1 -0
- package/modern/tests/describeHijriAdapter/index.js +1 -0
- package/modern/tests/describeHijriAdapter/testCalculations.js +91 -0
- package/modern/tests/describeHijriAdapter/testLocalization.js +13 -0
- package/modern/tests/describeJalaliAdapter/describeJalaliAdapter.js +25 -0
- package/modern/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +1 -0
- package/modern/tests/describeJalaliAdapter/index.js +1 -0
- package/modern/tests/describeJalaliAdapter/testCalculations.js +83 -0
- package/modern/tests/describeJalaliAdapter/testLocalization.js +13 -0
- package/modern/tests/describePicker/describePicker.js +162 -0
- package/modern/tests/describePicker/describePicker.types.js +1 -0
- package/modern/tests/describePicker/index.js +1 -0
- package/modern/tests/describeValue/describeValue.js +1 -1
- package/modern/tests/describeValue/testControlledUnControlled.js +8 -9
- package/modern/tests/describeValue/testPickerActionBar.js +46 -13
- package/modern/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -5
- package/modern/timeViewRenderers/index.js +1 -1
- package/modern/timeViewRenderers/timeViewRenderers.js +130 -2
- package/node/AdapterDateFns/AdapterDateFns.js +607 -0
- package/node/AdapterDateFns/index.js +6 -152
- package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +618 -0
- package/node/AdapterDateFnsJalali/index.js +6 -151
- package/node/AdapterDayjs/AdapterDayjs.js +146 -111
- package/node/AdapterLuxon/AdapterLuxon.js +521 -0
- package/node/AdapterLuxon/index.js +6 -114
- package/node/AdapterMoment/AdapterMoment.js +425 -0
- package/node/AdapterMoment/index.js +6 -102
- package/node/AdapterMomentHijri/AdapterMomentHijri.js +278 -0
- package/node/AdapterMomentHijri/index.js +6 -77
- package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +285 -0
- package/node/AdapterMomentJalaali/index.js +6 -90
- package/node/DateCalendar/DayCalendar.js +2 -2
- package/node/DateCalendar/useCalendarState.js +2 -2
- package/node/{internals/hooks/validation/useDateValidation.js → DateCalendar/useIsDateDisabled.js} +4 -37
- package/node/DateField/DateField.js +20 -3
- package/node/DateField/useDateField.js +5 -3
- package/node/DatePicker/DatePickerToolbar.js +1 -1
- package/node/DateTimeField/DateTimeField.js +21 -3
- package/node/DateTimeField/useDateTimeField.js +5 -3
- package/node/DateTimePicker/DateTimePicker.js +1 -0
- package/node/DesktopDatePicker/DesktopDatePicker.js +3 -2
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +4 -2
- package/node/DesktopTimePicker/DesktopTimePicker.js +51 -8
- package/node/DigitalClock/DigitalClock.js +406 -0
- package/node/DigitalClock/digitalClockClasses.js +15 -0
- package/node/DigitalClock/index.js +25 -0
- package/node/LocalizationProvider/LocalizationProvider.js +1 -1
- package/node/MobileDatePicker/MobileDatePicker.js +3 -2
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +4 -2
- package/node/MobileTimePicker/MobileTimePicker.js +4 -2
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +489 -0
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.types.js +5 -0
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +73 -0
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +159 -0
- package/node/MultiSectionDigitalClock/index.js +32 -0
- package/node/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +15 -0
- package/node/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +15 -0
- package/node/PickersDay/PickersDay.js +4 -1
- package/node/PickersLayout/PickersLayout.js +2 -2
- package/node/StaticDatePicker/StaticDatePicker.js +1 -0
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +5 -3
- package/node/StaticTimePicker/StaticTimePicker.js +5 -3
- package/node/TimeClock/TimeClock.js +35 -12
- package/node/TimeField/TimeField.js +21 -3
- package/node/TimeField/useTimeField.js +5 -3
- package/node/TimePicker/TimePicker.js +25 -2
- package/node/TimePicker/TimePickerToolbar.js +2 -2
- package/node/index.js +25 -1
- package/node/internals/constants/dimensions.js +4 -2
- package/node/internals/demo/DemoContainer.js +4 -1
- package/node/internals/hooks/date-helpers-hooks.js +3 -3
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +15 -15
- package/node/internals/hooks/useField/useField.js +12 -11
- package/node/internals/hooks/useField/useField.utils.js +63 -36
- package/node/internals/hooks/useField/useFieldCharacterEditing.js +17 -9
- package/node/internals/hooks/useField/useFieldState.js +5 -4
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +10 -10
- package/node/internals/hooks/usePicker/usePicker.js +2 -0
- package/node/internals/hooks/usePicker/usePickerValue.js +10 -12
- package/node/internals/hooks/useStaticPicker/useStaticPicker.js +10 -10
- package/node/internals/hooks/{validation/useValidation.js → useValidation.js} +1 -1
- package/node/internals/hooks/useViews.js +29 -13
- package/node/internals/index.js +9 -9
- package/node/internals/models/index.js +11 -0
- package/node/internals/models/props/clock.js +5 -0
- package/node/internals/models/validation.js +5 -0
- package/node/internals/utils/time-utils.js +2 -1
- package/node/internals/utils/validation/validateDate.js +40 -0
- package/node/internals/{hooks/validation/useDateTimeValidation.js → utils/validation/validateDateTime.js} +4 -4
- package/node/internals/{hooks/validation/useTimeValidation.js → utils/validation/validateTime.js} +1 -1
- package/node/internals/utils/valueManagers.js +1 -1
- package/node/locales/beBY.js +3 -3
- package/node/locales/caES.js +4 -1
- package/node/locales/csCZ.js +4 -2
- package/node/locales/daDK.js +4 -1
- package/node/locales/deDE.js +4 -1
- package/node/locales/enUS.js +2 -0
- package/node/locales/esES.js +4 -1
- package/node/locales/faIR.js +9 -1
- package/node/locales/fiFI.js +4 -1
- package/node/locales/frFR.js +4 -1
- package/node/locales/heIL.js +4 -1
- package/node/locales/huHU.js +4 -1
- package/node/locales/index.js +11 -0
- package/node/locales/isIS.js +9 -1
- package/node/locales/itIT.js +4 -1
- package/node/locales/jaJP.js +4 -1
- package/node/locales/koKR.js +4 -1
- package/node/locales/kzKZ.js +4 -1
- package/node/locales/nbNO.js +9 -1
- package/node/locales/nlNL.js +9 -1
- package/node/locales/plPL.js +9 -1
- package/node/locales/ptBR.js +9 -1
- package/node/locales/ruRU.js +4 -1
- package/node/locales/svSE.js +9 -1
- package/node/locales/trTR.js +14 -7
- package/node/locales/ukUA.js +9 -1
- package/node/locales/urPK.js +9 -1
- package/node/locales/zhCN.js +22 -23
- package/node/models/common.js +5 -0
- package/node/models/index.js +11 -0
- package/node/tests/describeAdapters/describeAdapters.js +1 -3
- package/node/tests/describeGregorianAdapter/describeGregorianAdapter.js +3 -1
- package/node/tests/describeGregorianAdapter/testCalculations.js +29 -26
- package/node/tests/describeGregorianAdapter/testLocalization.js +2 -2
- package/node/tests/describeHijriAdapter/describeHijriAdapter.js +31 -0
- package/node/tests/describeHijriAdapter/describeHijriAdapter.types.js +5 -0
- package/node/tests/describeHijriAdapter/index.js +12 -0
- package/node/tests/describeHijriAdapter/testCalculations.js +98 -0
- package/node/tests/describeHijriAdapter/testLocalization.js +20 -0
- package/node/tests/describeJalaliAdapter/describeJalaliAdapter.js +33 -0
- package/node/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +5 -0
- package/node/tests/describeJalaliAdapter/index.js +12 -0
- package/node/tests/describeJalaliAdapter/testCalculations.js +90 -0
- package/node/tests/describeJalaliAdapter/testLocalization.js +20 -0
- package/node/tests/describePicker/describePicker.js +173 -0
- package/node/tests/describePicker/describePicker.types.js +5 -0
- package/node/tests/describePicker/index.js +12 -0
- package/node/tests/describeValue/describeValue.js +1 -1
- package/node/tests/describeValue/testControlledUnControlled.js +8 -9
- package/node/tests/describeValue/testPickerActionBar.js +46 -13
- package/node/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -5
- package/node/timeViewRenderers/index.js +12 -0
- package/node/timeViewRenderers/timeViewRenderers.js +134 -4
- package/package.json +3 -10
- package/tests/describeAdapters/describeAdapters.js +1 -3
- package/tests/describeGregorianAdapter/describeGregorianAdapter.js +3 -1
- package/tests/describeGregorianAdapter/testCalculations.js +29 -26
- package/tests/describeGregorianAdapter/testLocalization.js +2 -2
- package/tests/describeHijriAdapter/describeHijriAdapter.js +23 -0
- package/tests/describeHijriAdapter/describeHijriAdapter.types.js +1 -0
- package/tests/describeHijriAdapter/index.js +1 -0
- package/tests/describeHijriAdapter/testCalculations.js +91 -0
- package/tests/describeHijriAdapter/testLocalization.js +13 -0
- package/tests/describeJalaliAdapter/describeJalaliAdapter.js +25 -0
- package/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +1 -0
- package/tests/describeJalaliAdapter/index.js +1 -0
- package/tests/describeJalaliAdapter/testCalculations.js +83 -0
- package/tests/describeJalaliAdapter/testLocalization.js +13 -0
- package/tests/describePicker/describePicker.js +162 -0
- package/tests/describePicker/describePicker.types.js +1 -0
- package/tests/describePicker/index.js +1 -0
- package/tests/describeValue/describeValue.js +1 -1
- package/tests/describeValue/testControlledUnControlled.js +8 -9
- package/tests/describeValue/testPickerActionBar.js +46 -13
- package/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -5
- package/themeAugmentation/components.d.ts +12 -0
- package/themeAugmentation/overrides.d.ts +8 -0
- package/themeAugmentation/props.d.ts +8 -0
- package/timeViewRenderers/index.d.ts +1 -1
- package/timeViewRenderers/index.js +1 -1
- package/timeViewRenderers/timeViewRenderers.d.ts +11 -4
- package/timeViewRenderers/timeViewRenderers.js +130 -2
- /package/{internals/hooks/validation/models.js → DigitalClock/DigitalClock.types.js} +0 -0
- /package/{legacy/internals/hooks/validation/models.js → MultiSectionDigitalClock/MultiSectionDigitalClock.types.js} +0 -0
- /package/{modern/internals/hooks/validation/models.js → internals/models/props/clock.js} +0 -0
- /package/internals/utils/{validation.d.ts → validation/extractValidationProps.d.ts} +0 -0
- /package/internals/utils/{validation.js → validation/extractValidationProps.js} +0 -0
- /package/legacy/internals/utils/{validation.js → validation/extractValidationProps.js} +0 -0
- /package/modern/internals/utils/{validation.js → validation/extractValidationProps.js} +0 -0
- /package/node/{internals/hooks/validation/models.js → DigitalClock/DigitalClock.types.js} +0 -0
- /package/node/internals/utils/{validation.js → validation/extractValidationProps.js} +0 -0
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.AdapterLuxon = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _luxon = require("luxon");
|
|
10
|
+
/* eslint-disable class-methods-use-this */
|
|
11
|
+
|
|
12
|
+
const formatTokenMap = {
|
|
13
|
+
// Year
|
|
14
|
+
y: {
|
|
15
|
+
sectionType: 'year',
|
|
16
|
+
contentType: 'digit',
|
|
17
|
+
maxLength: 4
|
|
18
|
+
},
|
|
19
|
+
yy: 'year',
|
|
20
|
+
yyyy: 'year',
|
|
21
|
+
// Month
|
|
22
|
+
L: {
|
|
23
|
+
sectionType: 'month',
|
|
24
|
+
contentType: 'digit',
|
|
25
|
+
maxLength: 2
|
|
26
|
+
},
|
|
27
|
+
LL: 'month',
|
|
28
|
+
LLL: {
|
|
29
|
+
sectionType: 'month',
|
|
30
|
+
contentType: 'letter'
|
|
31
|
+
},
|
|
32
|
+
LLLL: {
|
|
33
|
+
sectionType: 'month',
|
|
34
|
+
contentType: 'letter'
|
|
35
|
+
},
|
|
36
|
+
M: {
|
|
37
|
+
sectionType: 'month',
|
|
38
|
+
contentType: 'digit',
|
|
39
|
+
maxLength: 2
|
|
40
|
+
},
|
|
41
|
+
MM: 'month',
|
|
42
|
+
MMM: {
|
|
43
|
+
sectionType: 'month',
|
|
44
|
+
contentType: 'letter'
|
|
45
|
+
},
|
|
46
|
+
MMMM: {
|
|
47
|
+
sectionType: 'month',
|
|
48
|
+
contentType: 'letter'
|
|
49
|
+
},
|
|
50
|
+
// Day of the month
|
|
51
|
+
d: {
|
|
52
|
+
sectionType: 'day',
|
|
53
|
+
contentType: 'digit',
|
|
54
|
+
maxLength: 2
|
|
55
|
+
},
|
|
56
|
+
dd: 'day',
|
|
57
|
+
// Day of the week
|
|
58
|
+
c: {
|
|
59
|
+
sectionType: 'weekDay',
|
|
60
|
+
contentType: 'digit',
|
|
61
|
+
maxLength: 1
|
|
62
|
+
},
|
|
63
|
+
ccc: {
|
|
64
|
+
sectionType: 'weekDay',
|
|
65
|
+
contentType: 'letter'
|
|
66
|
+
},
|
|
67
|
+
cccc: {
|
|
68
|
+
sectionType: 'weekDay',
|
|
69
|
+
contentType: 'letter'
|
|
70
|
+
},
|
|
71
|
+
E: {
|
|
72
|
+
sectionType: 'weekDay',
|
|
73
|
+
contentType: 'digit',
|
|
74
|
+
maxLength: 2
|
|
75
|
+
},
|
|
76
|
+
EEE: {
|
|
77
|
+
sectionType: 'weekDay',
|
|
78
|
+
contentType: 'letter'
|
|
79
|
+
},
|
|
80
|
+
EEEE: {
|
|
81
|
+
sectionType: 'weekDay',
|
|
82
|
+
contentType: 'letter'
|
|
83
|
+
},
|
|
84
|
+
// Meridiem
|
|
85
|
+
a: 'meridiem',
|
|
86
|
+
// Hours
|
|
87
|
+
H: {
|
|
88
|
+
sectionType: 'hours',
|
|
89
|
+
contentType: 'digit',
|
|
90
|
+
maxLength: 2
|
|
91
|
+
},
|
|
92
|
+
HH: 'hours',
|
|
93
|
+
h: {
|
|
94
|
+
sectionType: 'hours',
|
|
95
|
+
contentType: 'digit',
|
|
96
|
+
maxLength: 2
|
|
97
|
+
},
|
|
98
|
+
hh: 'hours',
|
|
99
|
+
// Minutes
|
|
100
|
+
m: {
|
|
101
|
+
sectionType: 'minutes',
|
|
102
|
+
contentType: 'digit',
|
|
103
|
+
maxLength: 2
|
|
104
|
+
},
|
|
105
|
+
mm: 'minutes',
|
|
106
|
+
// Seconds
|
|
107
|
+
s: {
|
|
108
|
+
sectionType: 'seconds',
|
|
109
|
+
contentType: 'digit',
|
|
110
|
+
maxLength: 2
|
|
111
|
+
},
|
|
112
|
+
ss: 'seconds'
|
|
113
|
+
};
|
|
114
|
+
const defaultFormats = {
|
|
115
|
+
dayOfMonth: 'd',
|
|
116
|
+
fullDate: 'DD',
|
|
117
|
+
fullDateWithWeekday: 'DDDD',
|
|
118
|
+
fullDateTime: 'ff',
|
|
119
|
+
fullDateTime12h: 'DD, hh:mm a',
|
|
120
|
+
fullDateTime24h: 'DD, T',
|
|
121
|
+
fullTime: 't',
|
|
122
|
+
fullTime12h: 'hh:mm a',
|
|
123
|
+
fullTime24h: 'HH:mm',
|
|
124
|
+
hours12h: 'hh',
|
|
125
|
+
hours24h: 'HH',
|
|
126
|
+
keyboardDate: 'D',
|
|
127
|
+
keyboardDateTime: 'D t',
|
|
128
|
+
keyboardDateTime12h: 'D hh:mm a',
|
|
129
|
+
keyboardDateTime24h: 'D T',
|
|
130
|
+
minutes: 'mm',
|
|
131
|
+
seconds: 'ss',
|
|
132
|
+
month: 'LLLL',
|
|
133
|
+
monthAndDate: 'MMMM d',
|
|
134
|
+
monthAndYear: 'LLLL yyyy',
|
|
135
|
+
monthShort: 'MMM',
|
|
136
|
+
weekday: 'cccc',
|
|
137
|
+
weekdayShort: 'ccc',
|
|
138
|
+
normalDate: 'd MMMM',
|
|
139
|
+
normalDateWithWeekday: 'EEE, MMM d',
|
|
140
|
+
shortDate: 'MMM d',
|
|
141
|
+
year: 'yyyy'
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Based on `@date-io/luxon`
|
|
146
|
+
*
|
|
147
|
+
* MIT License
|
|
148
|
+
*
|
|
149
|
+
* Copyright (c) 2017 Dmitriy Kovalenko
|
|
150
|
+
*
|
|
151
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
152
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
153
|
+
* in the Software without restriction, including without limitation the rights
|
|
154
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
155
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
156
|
+
* furnished to do so, subject to the following conditions:
|
|
157
|
+
*
|
|
158
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
159
|
+
* copies or substantial portions of the Software.
|
|
160
|
+
*
|
|
161
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
162
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
163
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
164
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
165
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
166
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
167
|
+
* SOFTWARE.
|
|
168
|
+
*/
|
|
169
|
+
class AdapterLuxon {
|
|
170
|
+
constructor({
|
|
171
|
+
locale,
|
|
172
|
+
formats
|
|
173
|
+
} = {}) {
|
|
174
|
+
this.isMUIAdapter = true;
|
|
175
|
+
this.lib = 'luxon';
|
|
176
|
+
this.locale = void 0;
|
|
177
|
+
this.formats = void 0;
|
|
178
|
+
this.escapedCharacters = {
|
|
179
|
+
start: "'",
|
|
180
|
+
end: "'"
|
|
181
|
+
};
|
|
182
|
+
this.formatTokenMap = formatTokenMap;
|
|
183
|
+
this.date = value => {
|
|
184
|
+
if (typeof value === 'undefined') {
|
|
185
|
+
return _luxon.DateTime.local();
|
|
186
|
+
}
|
|
187
|
+
if (value === null) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
if (typeof value === 'string') {
|
|
191
|
+
// @ts-ignore
|
|
192
|
+
return _luxon.DateTime.fromJSDate(new Date(value), {
|
|
193
|
+
locale: this.locale
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
if (_luxon.DateTime.isDateTime(value)) {
|
|
197
|
+
return value;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// @ts-ignore
|
|
201
|
+
return _luxon.DateTime.fromJSDate(value, {
|
|
202
|
+
locale: this.locale
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
this.toJsDate = value => {
|
|
206
|
+
return value.toJSDate();
|
|
207
|
+
};
|
|
208
|
+
this.parseISO = isoString => {
|
|
209
|
+
return _luxon.DateTime.fromISO(isoString);
|
|
210
|
+
};
|
|
211
|
+
this.toISO = value => {
|
|
212
|
+
return value.toISO({
|
|
213
|
+
format: 'extended'
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
this.parse = (value, formatString) => {
|
|
217
|
+
if (value === '') {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
return _luxon.DateTime.fromFormat(value, formatString, {
|
|
221
|
+
locale: this.locale
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
this.getCurrentLocaleCode = () => {
|
|
225
|
+
return this.locale;
|
|
226
|
+
};
|
|
227
|
+
/* istanbul ignore next */
|
|
228
|
+
this.is12HourCycleInCurrentLocale = () => {
|
|
229
|
+
if (typeof Intl === 'undefined' || typeof Intl.DateTimeFormat === 'undefined') {
|
|
230
|
+
return true; // Luxon defaults to en-US if Intl not found
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return Boolean(new Intl.DateTimeFormat(this.locale, {
|
|
234
|
+
hour: 'numeric'
|
|
235
|
+
})?.resolvedOptions()?.hour12);
|
|
236
|
+
};
|
|
237
|
+
this.expandFormat = format => {
|
|
238
|
+
if (!_luxon.DateTime.expandFormat) {
|
|
239
|
+
throw Error('Your luxon version does not support `expandFormat`. Consider upgrading it to v3.0.2');
|
|
240
|
+
}
|
|
241
|
+
// Extract escaped section to avoid extending them
|
|
242
|
+
const longFormatRegexp = /''|'(''|[^'])+('|$)|[^']*/g;
|
|
243
|
+
return format.match(longFormatRegexp).map(token => {
|
|
244
|
+
const firstCharacter = token[0];
|
|
245
|
+
if (firstCharacter === "'") {
|
|
246
|
+
return token;
|
|
247
|
+
}
|
|
248
|
+
return _luxon.DateTime.expandFormat(token, {
|
|
249
|
+
locale: this.locale
|
|
250
|
+
});
|
|
251
|
+
}).join('')
|
|
252
|
+
// The returned format can contain `yyyyy` which means year between 4 and 6 digits.
|
|
253
|
+
// This value is supported by luxon parser but not luxon formatter.
|
|
254
|
+
// To avoid conflicts, we replace it by 4 digits which is enough for most use-cases.
|
|
255
|
+
.replace('yyyyy', 'yyyy');
|
|
256
|
+
};
|
|
257
|
+
this.getFormatHelperText = format => {
|
|
258
|
+
return this.expandFormat(format).replace(/(a)/g, '(a|p)m').toLocaleLowerCase();
|
|
259
|
+
};
|
|
260
|
+
this.isNull = value => {
|
|
261
|
+
return value === null;
|
|
262
|
+
};
|
|
263
|
+
this.isValid = value => {
|
|
264
|
+
if (_luxon.DateTime.isDateTime(value)) {
|
|
265
|
+
return value.isValid;
|
|
266
|
+
}
|
|
267
|
+
if (value === null) {
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
return this.isValid(this.date(value));
|
|
271
|
+
};
|
|
272
|
+
this.format = (value, formatKey) => {
|
|
273
|
+
return this.formatByString(value, this.formats[formatKey]);
|
|
274
|
+
};
|
|
275
|
+
this.formatByString = (value, format) => {
|
|
276
|
+
return value.setLocale(this.locale).toFormat(format);
|
|
277
|
+
};
|
|
278
|
+
this.formatNumber = numberToFormat => {
|
|
279
|
+
return numberToFormat;
|
|
280
|
+
};
|
|
281
|
+
this.getDiff = (value, comparing, unit) => {
|
|
282
|
+
if (typeof comparing === 'string') {
|
|
283
|
+
comparing = _luxon.DateTime.fromJSDate(new Date(comparing));
|
|
284
|
+
}
|
|
285
|
+
if (unit) {
|
|
286
|
+
return Math.floor(value.diff(comparing).as(unit));
|
|
287
|
+
}
|
|
288
|
+
return value.diff(comparing).as('millisecond');
|
|
289
|
+
};
|
|
290
|
+
this.isEqual = (value, comparing) => {
|
|
291
|
+
if (value === null && comparing === null) {
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Make sure that null will not be passed to this.date
|
|
296
|
+
if (value === null || comparing === null) {
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
299
|
+
return this.date(value).equals(this.date(comparing));
|
|
300
|
+
};
|
|
301
|
+
this.isSameYear = (value, comparing) => {
|
|
302
|
+
return value.hasSame(comparing, 'year');
|
|
303
|
+
};
|
|
304
|
+
this.isSameMonth = (value, comparing) => {
|
|
305
|
+
return value.hasSame(comparing, 'month');
|
|
306
|
+
};
|
|
307
|
+
this.isSameDay = (value, comparing) => {
|
|
308
|
+
return value.hasSame(comparing, 'day');
|
|
309
|
+
};
|
|
310
|
+
this.isSameHour = (value, comparing) => {
|
|
311
|
+
return value.hasSame(comparing, 'hour');
|
|
312
|
+
};
|
|
313
|
+
this.isAfter = (value, comparing) => {
|
|
314
|
+
return value > comparing;
|
|
315
|
+
};
|
|
316
|
+
this.isAfterYear = (value, comparing) => {
|
|
317
|
+
const diff = value.diff(comparing.endOf('year'), 'years').toObject();
|
|
318
|
+
return diff.years > 0;
|
|
319
|
+
};
|
|
320
|
+
this.isAfterDay = (value, comparing) => {
|
|
321
|
+
const diff = value.diff(comparing.endOf('day'), 'days').toObject();
|
|
322
|
+
return diff.days > 0;
|
|
323
|
+
};
|
|
324
|
+
this.isBefore = (value, comparing) => {
|
|
325
|
+
return value < comparing;
|
|
326
|
+
};
|
|
327
|
+
this.isBeforeYear = (value, comparing) => {
|
|
328
|
+
const diff = value.diff(comparing.startOf('year'), 'years').toObject();
|
|
329
|
+
return diff.years < 0;
|
|
330
|
+
};
|
|
331
|
+
this.isBeforeDay = (value, comparing) => {
|
|
332
|
+
const diff = value.diff(comparing.startOf('day'), 'days').toObject();
|
|
333
|
+
return diff.days < 0;
|
|
334
|
+
};
|
|
335
|
+
this.isWithinRange = (value, [start, end]) => {
|
|
336
|
+
return value.equals(start) || value.equals(end) || this.isAfter(value, start) && this.isBefore(value, end);
|
|
337
|
+
};
|
|
338
|
+
this.startOfYear = value => {
|
|
339
|
+
return value.startOf('year');
|
|
340
|
+
};
|
|
341
|
+
this.startOfMonth = value => {
|
|
342
|
+
return value.startOf('month');
|
|
343
|
+
};
|
|
344
|
+
this.startOfWeek = value => {
|
|
345
|
+
return value.startOf('week');
|
|
346
|
+
};
|
|
347
|
+
this.startOfDay = value => {
|
|
348
|
+
return value.startOf('day');
|
|
349
|
+
};
|
|
350
|
+
this.endOfYear = value => {
|
|
351
|
+
return value.endOf('year');
|
|
352
|
+
};
|
|
353
|
+
this.endOfMonth = value => {
|
|
354
|
+
return value.endOf('month');
|
|
355
|
+
};
|
|
356
|
+
this.endOfWeek = value => {
|
|
357
|
+
return value.endOf('week');
|
|
358
|
+
};
|
|
359
|
+
this.endOfDay = value => {
|
|
360
|
+
return value.endOf('day');
|
|
361
|
+
};
|
|
362
|
+
this.addYears = (value, amount) => {
|
|
363
|
+
return value.plus({
|
|
364
|
+
years: amount
|
|
365
|
+
});
|
|
366
|
+
};
|
|
367
|
+
this.addMonths = (value, amount) => {
|
|
368
|
+
return value.plus({
|
|
369
|
+
months: amount
|
|
370
|
+
});
|
|
371
|
+
};
|
|
372
|
+
this.addWeeks = (value, amount) => {
|
|
373
|
+
return value.plus({
|
|
374
|
+
weeks: amount
|
|
375
|
+
});
|
|
376
|
+
};
|
|
377
|
+
this.addDays = (value, amount) => {
|
|
378
|
+
return value.plus({
|
|
379
|
+
days: amount
|
|
380
|
+
});
|
|
381
|
+
};
|
|
382
|
+
this.addHours = (value, amount) => {
|
|
383
|
+
return value.plus({
|
|
384
|
+
hours: amount
|
|
385
|
+
});
|
|
386
|
+
};
|
|
387
|
+
this.addMinutes = (value, amount) => {
|
|
388
|
+
return value.plus({
|
|
389
|
+
minutes: amount
|
|
390
|
+
});
|
|
391
|
+
};
|
|
392
|
+
this.addSeconds = (value, amount) => {
|
|
393
|
+
return value.plus({
|
|
394
|
+
seconds: amount
|
|
395
|
+
});
|
|
396
|
+
};
|
|
397
|
+
this.getYear = value => {
|
|
398
|
+
return value.get('year');
|
|
399
|
+
};
|
|
400
|
+
this.getMonth = value => {
|
|
401
|
+
// See https://github.com/moment/luxon/blob/master/docs/moment.md#major-functional-differences
|
|
402
|
+
return value.get('month') - 1;
|
|
403
|
+
};
|
|
404
|
+
this.getDate = value => {
|
|
405
|
+
return value.get('day');
|
|
406
|
+
};
|
|
407
|
+
this.getHours = value => {
|
|
408
|
+
return value.get('hour');
|
|
409
|
+
};
|
|
410
|
+
this.getMinutes = value => {
|
|
411
|
+
return value.get('minute');
|
|
412
|
+
};
|
|
413
|
+
this.getSeconds = value => {
|
|
414
|
+
return value.get('second');
|
|
415
|
+
};
|
|
416
|
+
this.setYear = (value, year) => {
|
|
417
|
+
return value.set({
|
|
418
|
+
year
|
|
419
|
+
});
|
|
420
|
+
};
|
|
421
|
+
this.setMonth = (value, month) => {
|
|
422
|
+
return value.set({
|
|
423
|
+
month: month + 1
|
|
424
|
+
});
|
|
425
|
+
};
|
|
426
|
+
this.setDate = (value, date) => {
|
|
427
|
+
return value.set({
|
|
428
|
+
day: date
|
|
429
|
+
});
|
|
430
|
+
};
|
|
431
|
+
this.setHours = (value, hours) => {
|
|
432
|
+
return value.set({
|
|
433
|
+
hour: hours
|
|
434
|
+
});
|
|
435
|
+
};
|
|
436
|
+
this.setMinutes = (value, minutes) => {
|
|
437
|
+
return value.set({
|
|
438
|
+
minute: minutes
|
|
439
|
+
});
|
|
440
|
+
};
|
|
441
|
+
this.setSeconds = (value, seconds) => {
|
|
442
|
+
return value.set({
|
|
443
|
+
second: seconds
|
|
444
|
+
});
|
|
445
|
+
};
|
|
446
|
+
this.getDaysInMonth = value => {
|
|
447
|
+
return value.daysInMonth;
|
|
448
|
+
};
|
|
449
|
+
this.getNextMonth = value => {
|
|
450
|
+
return value.plus({
|
|
451
|
+
months: 1
|
|
452
|
+
});
|
|
453
|
+
};
|
|
454
|
+
this.getPreviousMonth = value => {
|
|
455
|
+
return value.minus({
|
|
456
|
+
months: 1
|
|
457
|
+
});
|
|
458
|
+
};
|
|
459
|
+
this.getMonthArray = value => {
|
|
460
|
+
const firstMonth = value.startOf('year');
|
|
461
|
+
const monthArray = [firstMonth];
|
|
462
|
+
while (monthArray.length < 12) {
|
|
463
|
+
const prevMonth = monthArray[monthArray.length - 1];
|
|
464
|
+
monthArray.push(this.getNextMonth(prevMonth));
|
|
465
|
+
}
|
|
466
|
+
return monthArray;
|
|
467
|
+
};
|
|
468
|
+
this.mergeDateAndTime = (dateParam, timeParam) => {
|
|
469
|
+
return dateParam.set({
|
|
470
|
+
second: timeParam.second,
|
|
471
|
+
hour: timeParam.hour,
|
|
472
|
+
minute: timeParam.minute
|
|
473
|
+
});
|
|
474
|
+
};
|
|
475
|
+
this.getWeekdays = () => {
|
|
476
|
+
return _luxon.Info.weekdaysFormat('narrow', {
|
|
477
|
+
locale: this.locale
|
|
478
|
+
});
|
|
479
|
+
};
|
|
480
|
+
this.getWeekArray = value => {
|
|
481
|
+
const {
|
|
482
|
+
days
|
|
483
|
+
} = value.endOf('month').endOf('week').diff(value.startOf('month').startOf('week'), 'days').toObject();
|
|
484
|
+
const weeks = [];
|
|
485
|
+
new Array(Math.round(days)).fill(0).map((_, i) => i).map(day => value.startOf('month').startOf('week').plus({
|
|
486
|
+
days: day
|
|
487
|
+
})).forEach((v, i) => {
|
|
488
|
+
if (i === 0 || i % 7 === 0 && i > 6) {
|
|
489
|
+
weeks.push([v]);
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
weeks[weeks.length - 1].push(v);
|
|
493
|
+
});
|
|
494
|
+
return weeks;
|
|
495
|
+
};
|
|
496
|
+
this.getWeekNumber = value => {
|
|
497
|
+
return value.weekNumber;
|
|
498
|
+
};
|
|
499
|
+
this.getYearRange = (start, end) => {
|
|
500
|
+
const startDate = start.startOf('year');
|
|
501
|
+
const endDate = end.endOf('year');
|
|
502
|
+
let current = startDate;
|
|
503
|
+
const years = [];
|
|
504
|
+
while (current < endDate) {
|
|
505
|
+
years.push(current);
|
|
506
|
+
current = current.plus({
|
|
507
|
+
year: 1
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
return years;
|
|
511
|
+
};
|
|
512
|
+
this.getMeridiemText = ampm => {
|
|
513
|
+
return _luxon.Info.meridiems({
|
|
514
|
+
locale: this.locale
|
|
515
|
+
}).find(v => v.toLowerCase() === ampm.toLowerCase());
|
|
516
|
+
};
|
|
517
|
+
this.locale = locale || 'en-US';
|
|
518
|
+
this.formats = (0, _extends2.default)({}, defaultFormats, formats);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
exports.AdapterLuxon = AdapterLuxon;
|
|
@@ -1,120 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const formatTokenMap = {
|
|
13
|
-
// Year
|
|
14
|
-
y: 'year',
|
|
15
|
-
yy: 'year',
|
|
16
|
-
yyyy: 'year',
|
|
17
|
-
// Month
|
|
18
|
-
L: 'month',
|
|
19
|
-
LL: 'month',
|
|
20
|
-
LLL: {
|
|
21
|
-
sectionType: 'month',
|
|
22
|
-
contentType: 'letter'
|
|
23
|
-
},
|
|
24
|
-
LLLL: {
|
|
25
|
-
sectionType: 'month',
|
|
26
|
-
contentType: 'letter'
|
|
27
|
-
},
|
|
28
|
-
M: 'month',
|
|
29
|
-
MM: 'month',
|
|
30
|
-
MMM: {
|
|
31
|
-
sectionType: 'month',
|
|
32
|
-
contentType: 'letter'
|
|
33
|
-
},
|
|
34
|
-
MMMM: {
|
|
35
|
-
sectionType: 'month',
|
|
36
|
-
contentType: 'letter'
|
|
37
|
-
},
|
|
38
|
-
// Day of the month
|
|
39
|
-
d: 'day',
|
|
40
|
-
dd: 'day',
|
|
41
|
-
// Day of the week
|
|
42
|
-
c: 'weekDay',
|
|
43
|
-
ccc: {
|
|
44
|
-
sectionType: 'weekDay',
|
|
45
|
-
contentType: 'letter'
|
|
46
|
-
},
|
|
47
|
-
cccc: {
|
|
48
|
-
sectionType: 'weekDay',
|
|
49
|
-
contentType: 'letter'
|
|
50
|
-
},
|
|
51
|
-
ccccc: {
|
|
52
|
-
sectionType: 'weekDay',
|
|
53
|
-
contentType: 'letter'
|
|
54
|
-
},
|
|
55
|
-
E: 'weekDay',
|
|
56
|
-
EEE: {
|
|
57
|
-
sectionType: 'weekDay',
|
|
58
|
-
contentType: 'letter'
|
|
59
|
-
},
|
|
60
|
-
EEEE: {
|
|
61
|
-
sectionType: 'weekDay',
|
|
62
|
-
contentType: 'letter'
|
|
63
|
-
},
|
|
64
|
-
EEEEE: {
|
|
65
|
-
sectionType: 'weekDay',
|
|
66
|
-
contentType: 'letter'
|
|
67
|
-
},
|
|
68
|
-
// Meridiem
|
|
69
|
-
a: 'meridiem',
|
|
70
|
-
// Hours
|
|
71
|
-
H: 'hours',
|
|
72
|
-
HH: 'hours',
|
|
73
|
-
h: 'hours',
|
|
74
|
-
hh: 'hours',
|
|
75
|
-
// Minutes
|
|
76
|
-
m: 'minutes',
|
|
77
|
-
mm: 'minutes',
|
|
78
|
-
// Seconds
|
|
79
|
-
s: 'seconds',
|
|
80
|
-
ss: 'seconds'
|
|
81
|
-
};
|
|
82
|
-
class AdapterLuxon extends _luxon2.default {
|
|
83
|
-
constructor(...args) {
|
|
84
|
-
super(...args);
|
|
85
|
-
this.isMUIAdapter = true;
|
|
86
|
-
this.formatTokenMap = formatTokenMap;
|
|
87
|
-
this.escapedCharacters = {
|
|
88
|
-
start: "'",
|
|
89
|
-
end: "'"
|
|
90
|
-
};
|
|
91
|
-
this.expandFormat = format => {
|
|
92
|
-
if (!_luxon.DateTime.expandFormat) {
|
|
93
|
-
throw Error('Your luxon version does not support `expandFormat`. Consider upgrading it to v3.0.2');
|
|
94
|
-
}
|
|
95
|
-
// Extract escaped section to avoid extending them
|
|
96
|
-
const longFormatRegexp = /''|'(''|[^'])+('|$)|[^']*/g;
|
|
97
|
-
return format.match(longFormatRegexp).map(token => {
|
|
98
|
-
const firstCharacter = token[0];
|
|
99
|
-
if (firstCharacter === "'") {
|
|
100
|
-
return token;
|
|
101
|
-
}
|
|
102
|
-
return _luxon.DateTime.expandFormat(token, {
|
|
103
|
-
locale: this.locale
|
|
104
|
-
});
|
|
105
|
-
}).join('')
|
|
106
|
-
// The returned format can contain `yyyyy` which means year between 4 and 6 digits.
|
|
107
|
-
// This value is supported by luxon parser but not luxon formatter.
|
|
108
|
-
// To avoid conflicts, we replace it by 4 digits which is enough for most use-cases.
|
|
109
|
-
.replace('yyyyy', 'yyyy');
|
|
110
|
-
};
|
|
111
|
-
// Redefined here just to show how it can be written using expandFormat
|
|
112
|
-
this.getFormatHelperText = format => {
|
|
113
|
-
return this.expandFormat(format).replace(/(a)/g, '(a|p)m').toLocaleLowerCase();
|
|
114
|
-
};
|
|
115
|
-
this.getWeekNumber = date => {
|
|
116
|
-
return date.weekNumber;
|
|
117
|
-
};
|
|
6
|
+
Object.defineProperty(exports, "AdapterLuxon", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _AdapterLuxon.AdapterLuxon;
|
|
118
10
|
}
|
|
119
|
-
}
|
|
120
|
-
|
|
11
|
+
});
|
|
12
|
+
var _AdapterLuxon = require("./AdapterLuxon");
|