You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|**date**| Date | new Date() | Represents the inital dateTime, this string is then parsed by moment.js |
33
-
|**dateFormat**| string |"MM/DD/YY" | Defines the format moment.js should use to parse and output the date. The default is only set if there is not `timeFormat` defined. |
34
-
|**timeFormat**| string |"MM/DD/YY" | Defines the format moment.js should use to parse and output the time. The default is only set if there is not `dateFormat` defined. |
35
+
|**dateFormat**| string |Locale default| Defines the format moment.js should use to parse and output the date. The default is only set if there is not `timeFormat` defined. |
36
+
|**timeFormat**| string |Locale default| Defines the format moment.js should use to parse and output the time. The default is only set if there is not `dateFormat` defined. |
35
37
|**input**| boolean | true | Wether to show an input field to edit the date manually. |
36
38
| **locale** | string | null | Manually set the locale for the react-datetime instance. Moment.js locale needs to be loaded to be used, see [i18n docs](#i18n).
37
39
|**onChange**| function | x => console.log(x) | Callback trigger when the date changes |
38
40
|**viewMode**| string or number | 'days' | The default view to display when the picker is shown. ('years', 'months', 'days', 'time') |
39
41
|**inputProps**| object | undefined | Defines additional attributes for the input element of the component. |
40
42
|**minDate**| moment | undefined | The earliest date allowed for entry in the calendar view. |
41
43
|**maxDate**| moment | undefined | The latest date allowed for entry in the calendar view. |
44
+
|**renderDay**| function | DOM.td( day ) | Customize the way that the days are shown in the day picker. The accepted function has the `selectedDate`, the current date and the default calculated `props` for the cell, and must return a React component. See [appearance customization](#appearance_customization)|
45
+
|**renderMonth**| function | DOM.td( month ) | Customize the way that the months are shown in the month picker. The accepted function has the `selectedDate`, the current date and the default calculated `props` for the cell, and must return a React component. See [appearance customization](#appearance_customization)|
46
+
|**renderYear**| function | DOM.td( year ) | Customize the way that the years are shown in the year picker. The accepted function has the `selectedDate`, the current date and the default calculated `props` for the cell, and must return a React component. See [appearance customization](#appearance_customization)|
42
47
43
48
## i18n
44
49
Different language and date formats are supported by react-datetime. React uses [moment.js](http://momentjs.com/) to format the dates, and the easiest way of changing the language of the calendar is [changing the moment.js locale](http://momentjs.com/docs/#/i18n/changing-locale/).
@@ -56,6 +61,34 @@ If there are multiple locales loaded, you can use the prop `locale` to define wh
56
61
```
57
62
[Here you can see the i18n example working](http://codepen.io/arqex/pen/PqJMQV).
58
63
64
+
## Appearance customization
65
+
It is possible to customize the way that the datetime picker display the days, months and years in the calendar. To adapt the calendar to every need it is possible to use the props `renderDay( props, currentDate, selectedDate )`, `renderMonth( props, month, year, selectedDate )` and `renderYear( props, year, selectedDate )` of react-datetime.
*`props` is the object that react-date picker has calculated for this object. It is convenient to use this object as the props for your custom component, since it knows how to handle the click event and its `className` attribute is used by the default styles.
89
+
*`selectedDate` and `currentDate` are Moment.js objects and can be used to change the output depending on the selected date, or the date for the current day.
90
+
*`month` and `year` are the numeric representation of the current month and year to be displayed. Notice that the possible `month` values go from `0` to `11`.
0 commit comments