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
Copy file name to clipboardExpand all lines: README.md
+18Lines changed: 18 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -32,12 +32,30 @@ API
32
32
|**date**| Date | new Date() | Represents the inital dateTime, this string is then parsed by moment.js |
33
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
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
+
|**input**| boolean | true | Wether to show an input field to edit the date manually. |
36
+
| **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).
35
37
|**onChange**| function | x => console.log(x) | Callback trigger when the date changes |
36
38
|**viewMode**| string or number | 'days' | The default view to display when the picker is shown. ('years', 'months', 'days', 'time') |
37
39
|**inputProps**| object | undefined | Defines additional attributes for the input element of the component. |
38
40
|**minDate**| moment | undefined | The earliest date allowed for entry in the calendar view. |
39
41
|**maxDate**| moment | undefined | The latest date allowed for entry in the calendar view. |
40
42
43
+
## i18n
44
+
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/).
45
+
46
+
```js
47
+
var moment =require('moment');
48
+
require('moment/locale/fr');
49
+
// Now react-datetime will be in french
50
+
```
51
+
52
+
If there are multiple locales loaded, you can use the prop `locale` to define what language should be used by the instance:
53
+
```js
54
+
<Datetime locale="fr"/>
55
+
<Datetime locale="de"/>
56
+
```
57
+
[Here you can see the i18n example working](http://codepen.io/arqex/pen/PqJMQV).
0 commit comments