Date & Time pickers for Material UI (support from v1 to v4)
MIT License
This is a quick release to make it easier to use the component with the latest version of React.
Published by dmtrKovalenko about 4 years ago
This is the last release of @material-ui/pickers
v4-alpha from the https://github.com/mui/material-ui-pickers repository. Starting from this point, we will work on migrating pickers to https://github.com/mui/mui-x repository π
renderDay
and for side components.<CalendarView<Dayjs>
date={dayjs()}
{...props}
/>
unknown
(by making all components generic)null
was passed to the month selection viewBig thanks to the 9 contributors who made this release possible.
@material-ui/[email protected]
inputRef
date picker customization demo (#2028) @Chee7ahautoOk
prop (#2020) @dandvPublished by dmtrKovalenko over 4 years ago
@material-ui/core
We are changed all of our internal components to use:
MuiPickers
from nowroot
which points to the root.Mui-disabled
) to improve the overriding experienceMuiPickersDay: {
&$disabled:{
// provide any disabled styles
}
}
In order to get rid of unexpected falling back to the unmasked input and warnings β we must avoid usage of localized time format (e.g. "p") and use predefined formats. We do have support for it via date-io and simply use hh:mm
for 24h clock and hh:mm
a for 12h.
reduceAnimations
provided (#1994)Published by dmtrKovalenko over 4 years ago
<Popover />
to <Popper />
for desktop components.We migrated our components to the core Popper + TrapFocus. Related to this all the components will not block scroll from now and also PopoverProps
was removed in favor of PopperProps
.
We got rid of dynamically attaching @date-io/type
module declaration for the adapter's date engine type. From now on pickers will automatically infer the type of value
or onChange
props. But it is also possible to force using pickers with generic JSX components notation.
<DatePicker<Date>
// You can pass any value right here that can be parsed
value={null}
onChange={newValue => newValue?.getDate()}
/>
onChange
when each view is filled (when the next view needs to open). This allows the developer to understand which value is already filled and also improves UX with. Cancel
button β if cancel clicked already filled part will be saved. (closes #1909)autoOk
prop was removed and now picker will automatically close after selection for Desktop mode. It is possible to control this behavior with the new disableCloseOnSelectProp
(closes #1651)shouldDisableDate
on year selection view for each year. (#1954)renderDay
prop (#1953)Published by dmtrKovalenko over 4 years ago
This release is a part of our ongoing breaking changes list implementation. We are working on making v4
stable before beta. And mostly all of out breaking changes are already done π. Hopefully the next v4-alpha.9 will be the last alpha
release
Documentation: https://v4-0-0-alpha-8.material-ui-pickers.dev/
value={null}
passed picker will not render any selected date (instead of highlighting today)ok{Label}
to ok{Text}
(okLabel => okText)onMonthChange
promise-based API in favor of loading
prop (#1829)renderInput
spreading experience for custom inputs (#1760)Published by dmtrKovalenko over 4 years ago
Hotfix for v4.0.0-alpha.6
Published by dmtrKovalenko over 4 years ago
renderInput
APIOur new API to render the text field input, that solves a lot of problems! Like spreading props down to text field, override them, override classes for the picker β and saves a lot of bundlesize for people who use custom text fields.
renderInput
prop is required for any picker. For the compatibility (no user-facing changes) it will be<DatePicker
+ renderInput={props => <TextField {...props} />}
/>
For DateRangePicker
it includes 2 arguments (startProps
and endProps
respectively)
<DateRangePicker
renderInput={(startProps, endProps) => (
<>
<TextField {...startProps} />
<DateRangeDelimiter> to </DateRangeDelimiter>
<TextField {...endProps} />
</>
)}
/>
onError
callback to return a reason why the error must be displayed. We are not displaying English error messages by default anymore.TextField
. So from now form validation with sharing internal pickers logic will look like this (reason
is well-typed string union). More info in this guide
minDateMessage
maxDateMessage
invalidDateMessage
strictCompareDates
emptyText
β it has been adding more confusing than what it's worthmaskChar
βΒ because it is not visible for your users anymore and needs only to generate and parse mask pattern.keyboardIcon
=> openPickerIcon
KeyboardButtonProps
=> OpenPickerButtonProps
onError
prop. Checkout new form integration guideline
DateRangeDelimiter
component that can be used for renderInput
of DateRangePicker
media (pointer: fine)
(#1653)shouldDisableYear
prop in order to dynamically disable years (#1743)We have changed the logic of the input mask to be more accessible and less noisy:
inputFormat
changed @vdyachenkoPublished by dmtrKovalenko over 4 years ago
This release finally introducing <DateRangePicker />
component.
Check out the live demo at https://next.material-ui-pickers.dev/demo/daterangepicker
<DateRangePicker />
componentchildren
supplied to LocalizationProvider
"<ThemeProvider />
Published by dmtrKovalenko over 4 years ago
Rename and changes in API for MuiPickersUtilsProvider
. It is renamed to LocalizationProvider
. In future this provider may be moved to the @material-ui/core
- <MuiPickersUtilsProvider utils={DateFnsUtils} />
+ <LocalizationProvider dateAdapter={DateFnsUtils} />
Also, libInstance
from now renamed to dateLibInstance
which is a more meaningful name in case of reusable LocalizationProvider
- <MuiPickersUtilsProvider utils={MomentUtils} libInstance={moment} />
+ <LocalizationProvider dateAdapter={MomentUtils} dateLibInstance={moment} />
From now all ref
s passed directly to any picker component will be automatically forwarded down to input
We did a bunch of props API changes. Hopefully, we will provide a codemod scripts closer to the stable release.
toolbarFormat
- easily customize date string displaying in toolbar (#1345)disableHighlightToday
- disable highlighting of today date with a circleshowDaysOutsideCurrentMonth
- show days outside of current month in calendardisableMargin
- (only Day
prop) disable margin between days, useful for range displaying when days are linked together with background colorlabelFunc
- completely unusable function with current keyboard input designinvalidLabel
- pretty same, unusable with keyboard input, use error
and helperText
insteadformat
=> inputFormat
emptyLabel
=> emptyInputText
initialFocusedDate
=> defaultHighlight
title
=> toolbarTitle
(+ make it accept value from label
as default)renderDay
(date: DateIOType, selectedDate: DateIOType, dayInCurrentMonth: boolean, defaultDay: React.ReactNode) => React.ReactNode
(date: DateIOType, selectedDate: DateIOType, DayComponentProps: DayProps) => React.ReactNode
Better customization of the day displaying, by allowing to spread down and override any props you need, before it was possible only by React.cloneElement
, but it was not so powerful like spreading props down. This also better from performance perspective when overriding days, because we are not rendering day by ourselves if needs to render something different.
renderDay={(day, selectedDate, DayComponentProps) => {
return (
<Badge overlap="circle" badgeContent={isSelected ? 'π' : undefined}>
<Day {...DayComponentProps} isToday disableMargin aria-label="Something" />
</Badge>
);
}}
From now it is possible to validate TimePicker
or DateTimePicker
with a help of corresponding props:
maxTime: TDate
(date part by default, will be ignored)minTime: TDate
(date part by default, will be ignored)maxDateTime: TDate
- Maximal selectable moment of time with binding to dateminDateTime: TDate
- Minimal selectable moment of time with binding to dateshouldDisableTime: (timeValue: number, clockType: "hours" | "minutes" | "seconds") => boolean
- Dynamically disable a clock valueThere is a new prop dateAdapter
in each component which allows passing configured date adapter object without context
const memoizedDateAdapter = React.useMemo(() => {
return new DateFnsAdapter({ locale });
}, [locale]);
<DatePicker
value={selectedDate}
onChange={date => handleDateChange(date)}
dateAdapter={memoizedDateAdapter}
/>;
Also, new LocalizationProvider
now accepts special dateFormats
prop that allows globally override formats used for displaying dates
const formats = {
normalDate: 'd MMM yyy',
keyboardDate: 'd MMM yyy',
};
<LocalizationProvider
dateAdapter={DateFnsAdapter}
locale={frLocale}
dateFormats={formats}
/>
Wow you read all these changelog release notes! It's impressive :)
The next release will be smaller, I promise π
Published by dmtrKovalenko over 4 years ago
This release is a part of v4 (#1293) development. v4 is in active development right now and we are planning to create more breaking changes. So please, update wisely πΈ
Checkout latest documentation π at https://next.material-ui-pickers.dev/
date-io
adapter by ourselves. So you need to import it from @material-ui/pickers/adapter/date-fns
instead of right from @date-io/date-fns
-import DateFnsUtils from '@date-io/date-fns'
+import DateFnsUtils from '@material-ui/pickers/adapter/date-fns'
<MuiPickersUtilsProvider utils={DateFnsUtils}>
Published by dmtrKovalenko over 4 years ago
This PR significantly improves pickers localization and accessibility. Documentation for this prerelease is available at https://next.material-ui-pickers.dev/
ampm
prop. Finally pickers will automatically resolve currently used locale settings and will render 12 or 24 hours clock accordingly.en-US
locale). If provided mask is not valid for the current locale we are falling back to the simple unmasked inputdisableMaskedInput
prop just to disable masking at all (force the same behavior ^)We changed literally everything related to accessibility and made pickers finally accessible. Giant thanks to @ahayes91 for help. Please read our new Accessibility guide.
But in short:
aria-label
without the need to set up it manually. Also, added a lot of props to adjust aria-label
text.Space
or Enter
)Published by dmtrKovalenko over 4 years ago
Make sure that v3 is on support right now, but actively we are working only the next v4 version. Check the first release notes of v4
Published by dmtrKovalenko almost 5 years ago
Make sure that v3 is on support right now, but actively we are working only the next v4 version. Check the first release notes of v4
Published by dmtrKovalenko almost 5 years ago
Here is the first prerelease of material-ui-pickers v4. We are going to ship all the features from the #1293. This alpha is actually the major design upgrade to new material design 2.0 pickers guidelines.
Documentation for v4: https://next.material-ui-pickers.dev/
Use npm @next
tag to install the prerelease version. Make sure that we are going to introduce new breaking changes in prerelease versions.
yarn add @material-ui/pickers@next
ampm
prop is now false
by default.@date-io/{moment/date-fns/any}
adapter to at least v2.0.0
Keyboard*
components exported (like KeyboardDatePicker
). From now any picker will allow keyboard input. For mobile, it is possible using the "pen" icon inside the dialog.variant
prop. Variant now passed right to the mui text field. To force specific wrapper you can use different exported components. Check βResponsivenessβ demo for each component.So it is required that your formats will be keyboard friendly (e.g. MM/dd/yyyy
instead of MMMM yyyy
)
<DatePicker
- format="MMMM yyyy"
+ format="MM/dd/yyyy"
/>
variant
prop. By default, the picker will adapt to the user device viewport to render the most convenient wrapper (popover or dialog). But it is possible to force this behavior importing special components. Check out this example
π π New design and UX π π
New animations, improve performance up to 30% for current calendar switching animations
Turn off animations (that are using react-transition-group) by default for Android devices. Use reduceAnimation
prop to configure this behavior.
Better formats override ability for localization. But this feature will be significantly improved in the next prereleases
New way to input am/pm value
It is now the default behavior for desktop mode and DateTimePicker
. Use ampmInClock
to enable this view on mobile.
Published by dmtrKovalenko almost 5 years ago
Published by dmtrKovalenko about 5 years ago
Hey, we are mostly started work on material-ui-pickers v4 π. We are going to significantly improve this package, but firstly we need to know how you are using pickers. Share your thoughts at our survey
We are using some stuff from Typescript v3.4. So it is required to update
This is a patch release with the following fixes:
Big thanks to 3 contributors, that make this release possible. π₯
readOnly
prop that prevents opening pickersPublished by dmtrKovalenko about 5 years ago
New patch release, with the following fixes:
onError(undefined)
if error should be clearedPublished by dmtrKovalenko about 5 years ago