v1.0.0-rc.1
馃帀 Its a release candidate!
And we have added an ability to replace moment
First of all thanks to all contributors that work for this project, you are awesome 鉂わ笍
Breaking changes
Firstly we have moved all moment usages to the separate utils interface and have make it replaceable. So from now you are able to decide which library would be used by pickers to work with date.
We are providing interfaces for moment and date-fns 2.0. And if you are not already using moment for date management we suggest using date-fns, because its much more lightweight and will be correctly tree-shaked from the bundle.
You can teach the pickers which library to use with MuiPickersUtilsProvider
. Add this to the root of your component tree
import MomentUtils from 'material-ui-pickers/utils/moment-utils';
import DateFnsUtils from 'material-ui-pickers/utils/date-fns-utils'
import MuiPickersUtilsProvider from 'material-ui-pickers/utils/MuiPickersUtilsProvider';
function App() {
return (
<MuiPickersUtilsProvider utils={DateFnsUtils}>
<Root />
</MuiPickersUtilsProvider>
);
}
render(<App />, document.querySelector('#app'));
returnMoment
property was deleted, now if you are using moment utils - you will get moment object anyway in the onChange callback.
<TimePicker
- returnMoment={false}
- onChange={(date: Date) => this.setState({ date })}
+ onChange={(date:Moment) => this.setState({ date })
/>
Features
- Improved importing system. Now its possible to import components by direct component name instead of src and Wrappers. We are tree-shaking friendly!
- import TimePicker from 'material-ui-pickers/src/TimePicker/TimePickerWrapper
+ import TimePicker from 'material-ui-pickers/TimePicker
- Remove
moment-range
dependency (No more need toArray.from
pollyfill) - Support of replaceable date management lib #219
- Support of date-fns as date management lib #219
- Add
InputAdornmentProps
andinputAdornmentPosition
to keyboard adornment customization #223