Date Picker is created following the principles of Lexicon, Internationalization and Extension Points by default is integrated with Time Picker that offers the minimum of features to set a time.
By default Date Picker does not handle input masking, letting you take control so you can take care of internationalization. Date Picker will update the Calendar only when the value entered in the input is a valid date, respecting the
For mobile viewing mode, Lexicon encourages you to use the native Date Picker, they are many robust and more accessible in the mobile view, Clay offers the
useNative API to replace the Date Picker view mode with the native and continue to get the features of the component.
years, which can be displayed in the Date Picker, if the user enters a year that is not within the range will be treated as an invalid date.
To set internationalization of the component, you need to configure the props according to the language. Date Picker offers low level APIs to configure
dateFormat, you can follow the example below to set up a Date Picker for Russian.
firstDayOfWeekby default the value by default the value is 0 (Sunday) and its values are the days of the week, 1 (Monday), 2 (Tuesday), 3 (Wednesday), 4 (Thursday), 5 (Friday), 6 (Saturday).
timeFormatis defined according to the formatting rules of date-fns which is an implementation of the unicode technical standards.
Array<string>with available months starting January to December.
Array<string>with the names of the days of the week in short form, starting from Sunday to Saturday.
weekdaysShortthe definition of the API
firstDayOfWeekwill take care of changing this, keep the order from Sunday to Saturday.
To customize the Date Picker content footer you can use the
footerElement API, its type is a Function that should return an element (Read more about renders props), this personalization point is treated as an extension point in the Lexicon language.
Programatically Expand Dropdown
If you want to expand or close the picker from outside of the component, use the props
Note about Moment.js
In version 3.4.0, we made the decision to switch to use date-fns instead of Moment.js due to dependency size. Making this changed help reduce the size of @clayui/date-picker by almost 50 KB.