@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
|
@@ -1,149 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import defaultLocale from 'date-fns-jalali/locale/fa-IR';
|
|
3
|
-
import getWeek from 'date-fns-jalali/getWeek';
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import longFormatters from 'date-fns-jalali/_lib/format/longFormatters';
|
|
6
|
-
const formatTokenMap = {
|
|
7
|
-
// Year
|
|
8
|
-
y: 'year',
|
|
9
|
-
yy: 'year',
|
|
10
|
-
yyy: 'year',
|
|
11
|
-
yyyy: 'year',
|
|
12
|
-
// Month
|
|
13
|
-
M: 'month',
|
|
14
|
-
MM: 'month',
|
|
15
|
-
MMMM: {
|
|
16
|
-
sectionType: 'month',
|
|
17
|
-
contentType: 'letter'
|
|
18
|
-
},
|
|
19
|
-
MMM: {
|
|
20
|
-
sectionType: 'month',
|
|
21
|
-
contentType: 'letter'
|
|
22
|
-
},
|
|
23
|
-
LLL: {
|
|
24
|
-
sectionType: 'month',
|
|
25
|
-
contentType: 'letter'
|
|
26
|
-
},
|
|
27
|
-
LLLL: {
|
|
28
|
-
sectionType: 'month',
|
|
29
|
-
contentType: 'letter'
|
|
30
|
-
},
|
|
31
|
-
// Day of the month
|
|
32
|
-
d: 'day',
|
|
33
|
-
dd: 'day',
|
|
34
|
-
do: 'day',
|
|
35
|
-
// Day of the week
|
|
36
|
-
E: {
|
|
37
|
-
sectionType: 'weekDay',
|
|
38
|
-
contentType: 'letter'
|
|
39
|
-
},
|
|
40
|
-
EE: {
|
|
41
|
-
sectionType: 'weekDay',
|
|
42
|
-
contentType: 'letter'
|
|
43
|
-
},
|
|
44
|
-
EEE: {
|
|
45
|
-
sectionType: 'weekDay',
|
|
46
|
-
contentType: 'letter'
|
|
47
|
-
},
|
|
48
|
-
EEEE: {
|
|
49
|
-
sectionType: 'weekDay',
|
|
50
|
-
contentType: 'letter'
|
|
51
|
-
},
|
|
52
|
-
EEEEE: {
|
|
53
|
-
sectionType: 'weekDay',
|
|
54
|
-
contentType: 'letter'
|
|
55
|
-
},
|
|
56
|
-
i: 'weekDay',
|
|
57
|
-
ii: 'weekDay',
|
|
58
|
-
iii: {
|
|
59
|
-
sectionType: 'weekDay',
|
|
60
|
-
contentType: 'letter'
|
|
61
|
-
},
|
|
62
|
-
iiii: {
|
|
63
|
-
sectionType: 'weekDay',
|
|
64
|
-
contentType: 'letter'
|
|
65
|
-
},
|
|
66
|
-
e: 'weekDay',
|
|
67
|
-
ee: 'weekDay',
|
|
68
|
-
eee: {
|
|
69
|
-
sectionType: 'weekDay',
|
|
70
|
-
contentType: 'letter'
|
|
71
|
-
},
|
|
72
|
-
eeee: {
|
|
73
|
-
sectionType: 'weekDay',
|
|
74
|
-
contentType: 'letter'
|
|
75
|
-
},
|
|
76
|
-
eeeee: {
|
|
77
|
-
sectionType: 'weekDay',
|
|
78
|
-
contentType: 'letter'
|
|
79
|
-
},
|
|
80
|
-
eeeeee: {
|
|
81
|
-
sectionType: 'weekDay',
|
|
82
|
-
contentType: 'letter'
|
|
83
|
-
},
|
|
84
|
-
c: 'weekDay',
|
|
85
|
-
cc: 'weekDay',
|
|
86
|
-
ccc: {
|
|
87
|
-
sectionType: 'weekDay',
|
|
88
|
-
contentType: 'letter'
|
|
89
|
-
},
|
|
90
|
-
cccc: {
|
|
91
|
-
sectionType: 'weekDay',
|
|
92
|
-
contentType: 'letter'
|
|
93
|
-
},
|
|
94
|
-
ccccc: {
|
|
95
|
-
sectionType: 'weekDay',
|
|
96
|
-
contentType: 'letter'
|
|
97
|
-
},
|
|
98
|
-
cccccc: {
|
|
99
|
-
sectionType: 'weekDay',
|
|
100
|
-
contentType: 'letter'
|
|
101
|
-
},
|
|
102
|
-
// Meridiem
|
|
103
|
-
a: 'meridiem',
|
|
104
|
-
aa: 'meridiem',
|
|
105
|
-
aaa: 'meridiem',
|
|
106
|
-
// Hours
|
|
107
|
-
H: 'hours',
|
|
108
|
-
HH: 'hours',
|
|
109
|
-
h: 'hours',
|
|
110
|
-
hh: 'hours',
|
|
111
|
-
// Minutes
|
|
112
|
-
mm: 'minutes',
|
|
113
|
-
// Seconds
|
|
114
|
-
ss: 'seconds'
|
|
115
|
-
};
|
|
116
|
-
export class AdapterDateFnsJalali extends BaseAdapterDateFnsJalali {
|
|
117
|
-
constructor(...args) {
|
|
118
|
-
super(...args);
|
|
119
|
-
this.isMUIAdapter = true;
|
|
120
|
-
this.formatTokenMap = formatTokenMap;
|
|
121
|
-
this.escapedCharacters = {
|
|
122
|
-
start: "'",
|
|
123
|
-
end: "'"
|
|
124
|
-
};
|
|
125
|
-
this.expandFormat = format => {
|
|
126
|
-
var _this$locale;
|
|
127
|
-
// @see https://github.com/date-fns/date-fns/blob/master/src/format/index.js#L31
|
|
128
|
-
const longFormatRegexp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
129
|
-
const locale = (_this$locale = this.locale) != null ? _this$locale : defaultLocale;
|
|
130
|
-
return format.match(longFormatRegexp).map(token => {
|
|
131
|
-
const firstCharacter = token[0];
|
|
132
|
-
if (firstCharacter === 'p' || firstCharacter === 'P') {
|
|
133
|
-
const longFormatter = longFormatters[firstCharacter];
|
|
134
|
-
return longFormatter(token, locale.formatLong, {});
|
|
135
|
-
}
|
|
136
|
-
return token;
|
|
137
|
-
}).join('');
|
|
138
|
-
};
|
|
139
|
-
// Redefined here just to show how it can be written using expandFormat
|
|
140
|
-
this.getFormatHelperText = format => {
|
|
141
|
-
return this.expandFormat(format).replace(/(aaa|aa|a)/g, '(a|p)m').toLocaleLowerCase();
|
|
142
|
-
};
|
|
143
|
-
this.getWeekNumber = date => {
|
|
144
|
-
return getWeek(date, {
|
|
145
|
-
locale: this.locale
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
}
|
|
1
|
+
export { AdapterDateFnsJalali } from './AdapterDateFnsJalali';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import defaultDayjs, { Dayjs } from 'dayjs';
|
|
2
2
|
import { FieldFormatTokenMap, MuiPickersAdapter, AdapterFormats, AdapterUnits } from '../models';
|
|
3
|
-
interface
|
|
3
|
+
interface AdapterDayjsOptions {
|
|
4
4
|
locale?: string;
|
|
5
5
|
/** Make sure that your dayjs instance extends customParseFormat and advancedFormat */
|
|
6
6
|
instance?: typeof defaultDayjs;
|
|
@@ -34,80 +34,80 @@ type Constructor = (...args: Parameters<typeof defaultDayjs>) => Dayjs;
|
|
|
34
34
|
*/
|
|
35
35
|
export declare class AdapterDayjs implements MuiPickersAdapter<Dayjs> {
|
|
36
36
|
isMUIAdapter: boolean;
|
|
37
|
-
rawDayJsInstance: typeof defaultDayjs;
|
|
38
37
|
lib: string;
|
|
38
|
+
rawDayJsInstance: typeof defaultDayjs;
|
|
39
39
|
dayjs: Constructor;
|
|
40
40
|
locale?: string;
|
|
41
41
|
formats: AdapterFormats;
|
|
42
|
-
constructor({ locale, formats, instance }?: Opts);
|
|
43
42
|
escapedCharacters: {
|
|
44
43
|
start: string;
|
|
45
44
|
end: string;
|
|
46
45
|
};
|
|
47
46
|
formatTokenMap: FieldFormatTokenMap;
|
|
47
|
+
constructor({ locale, formats, instance }?: AdapterDayjsOptions);
|
|
48
48
|
private getLocaleFormats;
|
|
49
49
|
date: (value?: any) => defaultDayjs.Dayjs | null;
|
|
50
50
|
toJsDate: (value: Dayjs) => Date;
|
|
51
51
|
parseISO: (isoString: string) => defaultDayjs.Dayjs;
|
|
52
52
|
toISO: (value: Dayjs) => string;
|
|
53
|
-
parse: (value:
|
|
53
|
+
parse: (value: string, format: string) => defaultDayjs.Dayjs | null;
|
|
54
54
|
getCurrentLocaleCode: () => string;
|
|
55
55
|
is12HourCycleInCurrentLocale: () => boolean;
|
|
56
56
|
expandFormat: (format: string) => string;
|
|
57
57
|
getFormatHelperText: (format: string) => string;
|
|
58
|
-
isNull: (
|
|
58
|
+
isNull: (value: Dayjs | null) => boolean;
|
|
59
59
|
isValid: (value: any) => boolean;
|
|
60
|
-
format: (
|
|
61
|
-
formatByString: (
|
|
60
|
+
format: (value: Dayjs, formatKey: keyof AdapterFormats) => string;
|
|
61
|
+
formatByString: (value: Dayjs, formatString: string) => string;
|
|
62
62
|
formatNumber: (numberToFormat: string) => string;
|
|
63
|
-
getDiff: (
|
|
63
|
+
getDiff: (value: Dayjs, comparing: Dayjs | string, unit?: AdapterUnits) => number;
|
|
64
64
|
isEqual: (value: any, comparing: any) => boolean;
|
|
65
|
-
isSameYear: (
|
|
66
|
-
isSameMonth: (
|
|
67
|
-
isSameDay: (
|
|
68
|
-
isSameHour: (
|
|
69
|
-
isAfter: (
|
|
70
|
-
isAfterYear: (
|
|
71
|
-
isAfterDay: (
|
|
72
|
-
isBefore: (
|
|
73
|
-
isBeforeYear: (
|
|
74
|
-
isBeforeDay: (
|
|
75
|
-
isWithinRange: (
|
|
76
|
-
startOfYear: (
|
|
77
|
-
startOfMonth: (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
endOfMonth: (
|
|
82
|
-
endOfWeek: (
|
|
83
|
-
endOfDay: (
|
|
84
|
-
addYears: (
|
|
85
|
-
addMonths: (
|
|
86
|
-
addWeeks: (
|
|
87
|
-
addDays: (
|
|
88
|
-
addHours: (
|
|
89
|
-
addMinutes: (
|
|
90
|
-
addSeconds: (
|
|
91
|
-
getYear: (
|
|
92
|
-
getMonth: (
|
|
93
|
-
getDate: (
|
|
94
|
-
getHours: (
|
|
95
|
-
getMinutes: (
|
|
96
|
-
getSeconds: (
|
|
97
|
-
setYear: (
|
|
98
|
-
setMonth: (
|
|
99
|
-
setDate: (
|
|
100
|
-
setHours: (
|
|
101
|
-
setMinutes: (
|
|
102
|
-
setSeconds: (
|
|
103
|
-
getDaysInMonth: (
|
|
104
|
-
getNextMonth: (
|
|
105
|
-
getPreviousMonth: (
|
|
106
|
-
getMonthArray: (
|
|
107
|
-
mergeDateAndTime: (
|
|
65
|
+
isSameYear: (value: Dayjs, comparing: Dayjs) => boolean;
|
|
66
|
+
isSameMonth: (value: Dayjs, comparing: Dayjs) => boolean;
|
|
67
|
+
isSameDay: (value: Dayjs, comparing: Dayjs) => boolean;
|
|
68
|
+
isSameHour: (value: Dayjs, comparing: Dayjs) => boolean;
|
|
69
|
+
isAfter: (value: Dayjs, comparing: Dayjs) => boolean;
|
|
70
|
+
isAfterYear: (value: Dayjs, comparing: Dayjs) => boolean;
|
|
71
|
+
isAfterDay: (value: Dayjs, comparing: Dayjs) => boolean;
|
|
72
|
+
isBefore: (value: Dayjs, comparing: Dayjs) => boolean;
|
|
73
|
+
isBeforeYear: (value: Dayjs, comparing: Dayjs) => boolean;
|
|
74
|
+
isBeforeDay: (value: Dayjs, comparing: Dayjs) => boolean;
|
|
75
|
+
isWithinRange: (value: Dayjs, [start, end]: [Dayjs, Dayjs]) => boolean;
|
|
76
|
+
startOfYear: (value: Dayjs) => defaultDayjs.Dayjs;
|
|
77
|
+
startOfMonth: (value: Dayjs) => defaultDayjs.Dayjs;
|
|
78
|
+
startOfWeek: (value: Dayjs) => defaultDayjs.Dayjs;
|
|
79
|
+
startOfDay: (value: Dayjs) => defaultDayjs.Dayjs;
|
|
80
|
+
endOfYear: (value: Dayjs) => defaultDayjs.Dayjs;
|
|
81
|
+
endOfMonth: (value: Dayjs) => defaultDayjs.Dayjs;
|
|
82
|
+
endOfWeek: (value: Dayjs) => defaultDayjs.Dayjs;
|
|
83
|
+
endOfDay: (value: Dayjs) => defaultDayjs.Dayjs;
|
|
84
|
+
addYears: (value: Dayjs, amount: number) => defaultDayjs.Dayjs;
|
|
85
|
+
addMonths: (value: Dayjs, amount: number) => defaultDayjs.Dayjs;
|
|
86
|
+
addWeeks: (value: Dayjs, amount: number) => defaultDayjs.Dayjs;
|
|
87
|
+
addDays: (value: Dayjs, amount: number) => defaultDayjs.Dayjs;
|
|
88
|
+
addHours: (value: Dayjs, amount: number) => defaultDayjs.Dayjs;
|
|
89
|
+
addMinutes: (value: Dayjs, amount: number) => defaultDayjs.Dayjs;
|
|
90
|
+
addSeconds: (value: Dayjs, amount: number) => defaultDayjs.Dayjs;
|
|
91
|
+
getYear: (value: Dayjs) => number;
|
|
92
|
+
getMonth: (value: Dayjs) => number;
|
|
93
|
+
getDate: (value: Dayjs) => number;
|
|
94
|
+
getHours: (value: Dayjs) => number;
|
|
95
|
+
getMinutes: (value: Dayjs) => number;
|
|
96
|
+
getSeconds: (value: Dayjs) => number;
|
|
97
|
+
setYear: (value: Dayjs, year: number) => defaultDayjs.Dayjs;
|
|
98
|
+
setMonth: (value: Dayjs, month: number) => defaultDayjs.Dayjs;
|
|
99
|
+
setDate: (value: Dayjs, date: number) => defaultDayjs.Dayjs;
|
|
100
|
+
setHours: (value: Dayjs, hours: number) => defaultDayjs.Dayjs;
|
|
101
|
+
setMinutes: (value: Dayjs, minutes: number) => defaultDayjs.Dayjs;
|
|
102
|
+
setSeconds: (value: Dayjs, seconds: number) => defaultDayjs.Dayjs;
|
|
103
|
+
getDaysInMonth: (value: Dayjs) => number;
|
|
104
|
+
getNextMonth: (value: Dayjs) => defaultDayjs.Dayjs;
|
|
105
|
+
getPreviousMonth: (value: Dayjs) => defaultDayjs.Dayjs;
|
|
106
|
+
getMonthArray: (value: Dayjs) => defaultDayjs.Dayjs[];
|
|
107
|
+
mergeDateAndTime: (dateParam: Dayjs, timeParam: Dayjs) => defaultDayjs.Dayjs;
|
|
108
108
|
getWeekdays: () => string[];
|
|
109
|
-
getWeekArray: (
|
|
110
|
-
getWeekNumber: (
|
|
109
|
+
getWeekArray: (value: Dayjs) => defaultDayjs.Dayjs[][];
|
|
110
|
+
getWeekNumber: (value: Dayjs) => number;
|
|
111
111
|
getYearRange: (start: Dayjs, end: Dayjs) => defaultDayjs.Dayjs[];
|
|
112
112
|
getMeridiemText: (ampm: 'am' | 'pm') => "AM" | "PM";
|
|
113
113
|
}
|
|
@@ -13,9 +13,17 @@ const localeNotFoundWarning = buildWarning(['Your locale has not been found.', '
|
|
|
13
13
|
const formatTokenMap = {
|
|
14
14
|
// Year
|
|
15
15
|
YY: 'year',
|
|
16
|
-
YYYY:
|
|
16
|
+
YYYY: {
|
|
17
|
+
sectionType: 'year',
|
|
18
|
+
contentType: 'digit',
|
|
19
|
+
maxLength: 4
|
|
20
|
+
},
|
|
17
21
|
// Month
|
|
18
|
-
M:
|
|
22
|
+
M: {
|
|
23
|
+
sectionType: 'month',
|
|
24
|
+
contentType: 'digit',
|
|
25
|
+
maxLength: 2
|
|
26
|
+
},
|
|
19
27
|
MM: 'month',
|
|
20
28
|
MMM: {
|
|
21
29
|
sectionType: 'month',
|
|
@@ -26,11 +34,22 @@ const formatTokenMap = {
|
|
|
26
34
|
contentType: 'letter'
|
|
27
35
|
},
|
|
28
36
|
// Day of the month
|
|
29
|
-
D:
|
|
37
|
+
D: {
|
|
38
|
+
sectionType: 'day',
|
|
39
|
+
contentType: 'digit',
|
|
40
|
+
maxLength: 2
|
|
41
|
+
},
|
|
30
42
|
DD: 'day',
|
|
31
|
-
Do:
|
|
43
|
+
Do: {
|
|
44
|
+
sectionType: 'day',
|
|
45
|
+
contentType: 'digit-with-letter'
|
|
46
|
+
},
|
|
32
47
|
// Day of the week
|
|
33
|
-
d:
|
|
48
|
+
d: {
|
|
49
|
+
sectionType: 'weekDay',
|
|
50
|
+
contentType: 'digit',
|
|
51
|
+
maxLength: 2
|
|
52
|
+
},
|
|
34
53
|
dd: {
|
|
35
54
|
sectionType: 'weekDay',
|
|
36
55
|
contentType: 'letter'
|
|
@@ -47,15 +66,31 @@ const formatTokenMap = {
|
|
|
47
66
|
A: 'meridiem',
|
|
48
67
|
a: 'meridiem',
|
|
49
68
|
// Hours
|
|
50
|
-
H:
|
|
69
|
+
H: {
|
|
70
|
+
sectionType: 'hours',
|
|
71
|
+
contentType: 'digit',
|
|
72
|
+
maxLength: 2
|
|
73
|
+
},
|
|
51
74
|
HH: 'hours',
|
|
52
|
-
h:
|
|
75
|
+
h: {
|
|
76
|
+
sectionType: 'hours',
|
|
77
|
+
contentType: 'digit',
|
|
78
|
+
maxLength: 2
|
|
79
|
+
},
|
|
53
80
|
hh: 'hours',
|
|
54
81
|
// Minutes
|
|
55
|
-
m:
|
|
82
|
+
m: {
|
|
83
|
+
sectionType: 'minutes',
|
|
84
|
+
contentType: 'digit',
|
|
85
|
+
maxLength: 2
|
|
86
|
+
},
|
|
56
87
|
mm: 'minutes',
|
|
57
88
|
// Seconds
|
|
58
|
-
s:
|
|
89
|
+
s: {
|
|
90
|
+
sectionType: 'seconds',
|
|
91
|
+
contentType: 'digit',
|
|
92
|
+
maxLength: 2
|
|
93
|
+
},
|
|
59
94
|
ss: 'seconds'
|
|
60
95
|
};
|
|
61
96
|
const defaultFormats = {
|
|
@@ -121,8 +156,8 @@ export class AdapterDayjs {
|
|
|
121
156
|
instance
|
|
122
157
|
} = {}) {
|
|
123
158
|
this.isMUIAdapter = true;
|
|
124
|
-
this.rawDayJsInstance = void 0;
|
|
125
159
|
this.lib = 'dayjs';
|
|
160
|
+
this.rawDayJsInstance = void 0;
|
|
126
161
|
this.dayjs = void 0;
|
|
127
162
|
this.locale = void 0;
|
|
128
163
|
this.formats = void 0;
|
|
@@ -183,23 +218,23 @@ export class AdapterDayjs {
|
|
|
183
218
|
this.getFormatHelperText = format => {
|
|
184
219
|
return this.expandFormat(format).replace(/a/gi, '(a|p)m').toLocaleLowerCase();
|
|
185
220
|
};
|
|
186
|
-
this.isNull =
|
|
187
|
-
return
|
|
221
|
+
this.isNull = value => {
|
|
222
|
+
return value === null;
|
|
188
223
|
};
|
|
189
224
|
this.isValid = value => {
|
|
190
225
|
return this.dayjs(value).isValid();
|
|
191
226
|
};
|
|
192
|
-
this.format = (
|
|
193
|
-
return this.formatByString(
|
|
227
|
+
this.format = (value, formatKey) => {
|
|
228
|
+
return this.formatByString(value, this.formats[formatKey]);
|
|
194
229
|
};
|
|
195
|
-
this.formatByString = (
|
|
196
|
-
return this.dayjs(
|
|
230
|
+
this.formatByString = (value, formatString) => {
|
|
231
|
+
return this.dayjs(value).format(formatString);
|
|
197
232
|
};
|
|
198
233
|
this.formatNumber = numberToFormat => {
|
|
199
234
|
return numberToFormat;
|
|
200
235
|
};
|
|
201
|
-
this.getDiff = (
|
|
202
|
-
return
|
|
236
|
+
this.getDiff = (value, comparing, unit) => {
|
|
237
|
+
return value.diff(comparing, unit);
|
|
203
238
|
};
|
|
204
239
|
this.isEqual = (value, comparing) => {
|
|
205
240
|
if (value === null && comparing === null) {
|
|
@@ -207,131 +242,131 @@ export class AdapterDayjs {
|
|
|
207
242
|
}
|
|
208
243
|
return this.dayjs(value).isSame(comparing);
|
|
209
244
|
};
|
|
210
|
-
this.isSameYear = (
|
|
211
|
-
return
|
|
245
|
+
this.isSameYear = (value, comparing) => {
|
|
246
|
+
return value.isSame(comparing, 'year');
|
|
212
247
|
};
|
|
213
|
-
this.isSameMonth = (
|
|
214
|
-
return
|
|
248
|
+
this.isSameMonth = (value, comparing) => {
|
|
249
|
+
return value.isSame(comparing, 'month');
|
|
215
250
|
};
|
|
216
|
-
this.isSameDay = (
|
|
217
|
-
return
|
|
251
|
+
this.isSameDay = (value, comparing) => {
|
|
252
|
+
return value.isSame(comparing, 'day');
|
|
218
253
|
};
|
|
219
|
-
this.isSameHour = (
|
|
220
|
-
return
|
|
254
|
+
this.isSameHour = (value, comparing) => {
|
|
255
|
+
return value.isSame(comparing, 'hour');
|
|
221
256
|
};
|
|
222
|
-
this.isAfter = (
|
|
223
|
-
return
|
|
257
|
+
this.isAfter = (value, comparing) => {
|
|
258
|
+
return value.isAfter(comparing);
|
|
224
259
|
};
|
|
225
|
-
this.isAfterYear = (
|
|
226
|
-
return
|
|
260
|
+
this.isAfterYear = (value, comparing) => {
|
|
261
|
+
return value.isAfter(comparing, 'year');
|
|
227
262
|
};
|
|
228
|
-
this.isAfterDay = (
|
|
229
|
-
return
|
|
263
|
+
this.isAfterDay = (value, comparing) => {
|
|
264
|
+
return value.isAfter(comparing, 'day');
|
|
230
265
|
};
|
|
231
|
-
this.isBefore = (
|
|
232
|
-
return
|
|
266
|
+
this.isBefore = (value, comparing) => {
|
|
267
|
+
return value.isBefore(comparing);
|
|
233
268
|
};
|
|
234
|
-
this.isBeforeYear = (
|
|
235
|
-
return
|
|
269
|
+
this.isBeforeYear = (value, comparing) => {
|
|
270
|
+
return value.isBefore(comparing, 'year');
|
|
236
271
|
};
|
|
237
|
-
this.isBeforeDay = (
|
|
238
|
-
return
|
|
272
|
+
this.isBeforeDay = (value, comparing) => {
|
|
273
|
+
return value.isBefore(comparing, 'day');
|
|
239
274
|
};
|
|
240
|
-
this.isWithinRange = (
|
|
241
|
-
return
|
|
275
|
+
this.isWithinRange = (value, [start, end]) => {
|
|
276
|
+
return value.isBetween(start, end, null, '[]');
|
|
242
277
|
};
|
|
243
|
-
this.startOfYear =
|
|
244
|
-
return
|
|
278
|
+
this.startOfYear = value => {
|
|
279
|
+
return value.startOf('year');
|
|
245
280
|
};
|
|
246
|
-
this.startOfMonth =
|
|
247
|
-
return
|
|
281
|
+
this.startOfMonth = value => {
|
|
282
|
+
return value.startOf('month');
|
|
248
283
|
};
|
|
249
|
-
this.
|
|
250
|
-
return
|
|
284
|
+
this.startOfWeek = value => {
|
|
285
|
+
return value.startOf('week');
|
|
251
286
|
};
|
|
252
|
-
this.
|
|
253
|
-
return
|
|
287
|
+
this.startOfDay = value => {
|
|
288
|
+
return value.startOf('day');
|
|
254
289
|
};
|
|
255
|
-
this.
|
|
256
|
-
return
|
|
290
|
+
this.endOfYear = value => {
|
|
291
|
+
return value.endOf('year');
|
|
257
292
|
};
|
|
258
|
-
this.endOfMonth =
|
|
259
|
-
return
|
|
293
|
+
this.endOfMonth = value => {
|
|
294
|
+
return value.endOf('month');
|
|
260
295
|
};
|
|
261
|
-
this.endOfWeek =
|
|
262
|
-
return
|
|
296
|
+
this.endOfWeek = value => {
|
|
297
|
+
return value.endOf('week');
|
|
263
298
|
};
|
|
264
|
-
this.endOfDay =
|
|
265
|
-
return
|
|
299
|
+
this.endOfDay = value => {
|
|
300
|
+
return value.endOf('day');
|
|
266
301
|
};
|
|
267
|
-
this.addYears = (
|
|
268
|
-
return
|
|
302
|
+
this.addYears = (value, amount) => {
|
|
303
|
+
return amount < 0 ? value.subtract(Math.abs(amount), 'year') : value.add(amount, 'year');
|
|
269
304
|
};
|
|
270
|
-
this.addMonths = (
|
|
271
|
-
return
|
|
305
|
+
this.addMonths = (value, amount) => {
|
|
306
|
+
return amount < 0 ? value.subtract(Math.abs(amount), 'month') : value.add(amount, 'month');
|
|
272
307
|
};
|
|
273
|
-
this.addWeeks = (
|
|
274
|
-
return
|
|
308
|
+
this.addWeeks = (value, amount) => {
|
|
309
|
+
return amount < 0 ? value.subtract(Math.abs(amount), 'week') : value.add(amount, 'week');
|
|
275
310
|
};
|
|
276
|
-
this.addDays = (
|
|
277
|
-
return
|
|
311
|
+
this.addDays = (value, amount) => {
|
|
312
|
+
return amount < 0 ? value.subtract(Math.abs(amount), 'day') : value.add(amount, 'day');
|
|
278
313
|
};
|
|
279
|
-
this.addHours = (
|
|
280
|
-
return
|
|
314
|
+
this.addHours = (value, amount) => {
|
|
315
|
+
return amount < 0 ? value.subtract(Math.abs(amount), 'hour') : value.add(amount, 'hour');
|
|
281
316
|
};
|
|
282
|
-
this.addMinutes = (
|
|
283
|
-
return
|
|
317
|
+
this.addMinutes = (value, amount) => {
|
|
318
|
+
return amount < 0 ? value.subtract(Math.abs(amount), 'minute') : value.add(amount, 'minute');
|
|
284
319
|
};
|
|
285
|
-
this.addSeconds = (
|
|
286
|
-
return
|
|
320
|
+
this.addSeconds = (value, amount) => {
|
|
321
|
+
return amount < 0 ? value.subtract(Math.abs(amount), 'second') : value.add(amount, 'second');
|
|
287
322
|
};
|
|
288
|
-
this.getYear =
|
|
289
|
-
return
|
|
323
|
+
this.getYear = value => {
|
|
324
|
+
return value.year();
|
|
290
325
|
};
|
|
291
|
-
this.getMonth =
|
|
292
|
-
return
|
|
326
|
+
this.getMonth = value => {
|
|
327
|
+
return value.month();
|
|
293
328
|
};
|
|
294
|
-
this.getDate =
|
|
295
|
-
return
|
|
329
|
+
this.getDate = value => {
|
|
330
|
+
return value.date();
|
|
296
331
|
};
|
|
297
|
-
this.getHours =
|
|
298
|
-
return
|
|
332
|
+
this.getHours = value => {
|
|
333
|
+
return value.hour();
|
|
299
334
|
};
|
|
300
|
-
this.getMinutes =
|
|
301
|
-
return
|
|
335
|
+
this.getMinutes = value => {
|
|
336
|
+
return value.minute();
|
|
302
337
|
};
|
|
303
|
-
this.getSeconds =
|
|
304
|
-
return
|
|
338
|
+
this.getSeconds = value => {
|
|
339
|
+
return value.second();
|
|
305
340
|
};
|
|
306
|
-
this.setYear = (
|
|
307
|
-
return
|
|
341
|
+
this.setYear = (value, year) => {
|
|
342
|
+
return value.set('year', year);
|
|
308
343
|
};
|
|
309
|
-
this.setMonth = (
|
|
310
|
-
return
|
|
344
|
+
this.setMonth = (value, month) => {
|
|
345
|
+
return value.set('month', month);
|
|
311
346
|
};
|
|
312
|
-
this.setDate = (
|
|
313
|
-
return
|
|
347
|
+
this.setDate = (value, date) => {
|
|
348
|
+
return value.set('date', date);
|
|
314
349
|
};
|
|
315
|
-
this.setHours = (
|
|
316
|
-
return
|
|
350
|
+
this.setHours = (value, hours) => {
|
|
351
|
+
return value.set('hour', hours);
|
|
317
352
|
};
|
|
318
|
-
this.setMinutes = (
|
|
319
|
-
return
|
|
353
|
+
this.setMinutes = (value, minutes) => {
|
|
354
|
+
return value.set('minute', minutes);
|
|
320
355
|
};
|
|
321
|
-
this.setSeconds = (
|
|
322
|
-
return
|
|
356
|
+
this.setSeconds = (value, seconds) => {
|
|
357
|
+
return value.set('second', seconds);
|
|
323
358
|
};
|
|
324
|
-
this.getDaysInMonth =
|
|
325
|
-
return
|
|
359
|
+
this.getDaysInMonth = value => {
|
|
360
|
+
return value.daysInMonth();
|
|
326
361
|
};
|
|
327
|
-
this.getNextMonth =
|
|
328
|
-
return
|
|
362
|
+
this.getNextMonth = value => {
|
|
363
|
+
return value.add(1, 'month');
|
|
329
364
|
};
|
|
330
|
-
this.getPreviousMonth =
|
|
331
|
-
return
|
|
365
|
+
this.getPreviousMonth = value => {
|
|
366
|
+
return value.subtract(1, 'month');
|
|
332
367
|
};
|
|
333
|
-
this.getMonthArray =
|
|
334
|
-
const firstMonth =
|
|
368
|
+
this.getMonthArray = value => {
|
|
369
|
+
const firstMonth = value.startOf('year');
|
|
335
370
|
const monthArray = [firstMonth];
|
|
336
371
|
while (monthArray.length < 12) {
|
|
337
372
|
const prevMonth = monthArray[monthArray.length - 1];
|
|
@@ -339,16 +374,16 @@ export class AdapterDayjs {
|
|
|
339
374
|
}
|
|
340
375
|
return monthArray;
|
|
341
376
|
};
|
|
342
|
-
this.mergeDateAndTime = (
|
|
343
|
-
return
|
|
377
|
+
this.mergeDateAndTime = (dateParam, timeParam) => {
|
|
378
|
+
return dateParam.hour(timeParam.hour()).minute(timeParam.minute()).second(timeParam.second());
|
|
344
379
|
};
|
|
345
380
|
this.getWeekdays = () => {
|
|
346
381
|
const start = this.dayjs().startOf('week');
|
|
347
382
|
return [0, 1, 2, 3, 4, 5, 6].map(diff => this.formatByString(start.add(diff, 'day'), 'dd'));
|
|
348
383
|
};
|
|
349
|
-
this.getWeekArray =
|
|
350
|
-
const start =
|
|
351
|
-
const end =
|
|
384
|
+
this.getWeekArray = value => {
|
|
385
|
+
const start = value.startOf('month').startOf('week');
|
|
386
|
+
const end = value.endOf('month').endOf('week');
|
|
352
387
|
let count = 0;
|
|
353
388
|
let current = start;
|
|
354
389
|
const nestedWeeks = [];
|
|
@@ -361,12 +396,12 @@ export class AdapterDayjs {
|
|
|
361
396
|
}
|
|
362
397
|
return nestedWeeks;
|
|
363
398
|
};
|
|
364
|
-
this.getWeekNumber =
|
|
365
|
-
return
|
|
399
|
+
this.getWeekNumber = value => {
|
|
400
|
+
return value.week();
|
|
366
401
|
};
|
|
367
402
|
this.getYearRange = (start, end) => {
|
|
368
|
-
const startDate =
|
|
369
|
-
const endDate =
|
|
403
|
+
const startDate = start.startOf('year');
|
|
404
|
+
const endDate = end.endOf('year');
|
|
370
405
|
const years = [];
|
|
371
406
|
let current = startDate;
|
|
372
407
|
while (current.isBefore(endDate)) {
|