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: docs/DateInput.md
+12-1Lines changed: 12 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,18 @@ import { DateInput } from 'react-admin';
26
26
<DateInput source="published_at"/>
27
27
```
28
28
29
-
The field value must be a string with the pattern `YYYY-MM-DD` (ISO 8601), e.g. `'2022-04-30'`.
29
+
The field value must be a string using the pattern `YYYY-MM-DD` (ISO 8601), e.g. `'2022-04-30'`. The returned input value will also be in this format, regardless of the browser locale.
30
+
31
+
`<DateInput>` also accepts values that can be converted to a `Date` object, such as:
32
+
33
+
- a localized date string (e.g. `'30/04/2022'`),
34
+
- an ISO date string (e.g. `'2022-04-30T00:00:00.000Z'`),
35
+
- a `Date` object, or
36
+
- a Linux timestamp (e.g. `1648694400000`).
37
+
38
+
In these cases, `<DateInput>` will automatically convert the value to the `YYYY-MM-DD` format.
39
+
40
+
**Note**: This conversion may change the date because of timezones. For example, the date string `'2022-04-30T00:00:00.000Z'` in Europe may be displayed as `'2022-04-29'` in Honolulu. If this is not what you want, pass your own [`parse`](./Inputs.md#parse) function to `<DateInput>`.
0 commit comments