Skip to content

Commit 445a48c

Browse files
fix: change datetime widget value format (#7072)
- from 12-hour to 24-hour format - replace moment references in the docs #7066 Co-authored-by: Anze Demsar <[email protected]>
1 parent 4f419dd commit 445a48c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/decap-cms-widget-datetime/src/DateTimeControl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export default class DateTimeControl extends React.Component {
119119
<input
120120
id={forID}
121121
type="datetime-local"
122-
value={dayjs(value).format('YYYY-MM-DDThh:mm')}
122+
value={dayjs(value).format('YYYY-MM-DDTHH:mm')}
123123
onChange={e => this.handleChange(dayjs(e.target.value))}
124124
onFocus={setActiveStyle}
125125
onBlur={setInactiveStyle}

website/content/docs/widgets/datetime.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ The datetime widget translates a datetime picker to a datetime string.
77

88
- **Name:** `datetime`
99
- **UI:** datetime picker
10-
- **Data type:** Moment.js-formatted datetime string
10+
- **Data type:** [Day.js](https://day.js.org/)-formatted datetime string
1111
- **Options:**
1212
- `default`: accepts a datetime string, or an empty string to accept blank input; otherwise defaults to current datetime
13-
- `format`: sets storage format; accepts Moment.js [tokens](https://momentjs.com/docs/#/parsing/string-format/); defaults to raw Date object (if supported by output format)
14-
- `date_format`: sets date display format in UI; boolean or Moment.js [tokens](https://momentjs.com/docs/#/parsing/string-format/). If `true` use default locale format.
15-
- `time_format`: sets time display format in UI; boolean or Moment.js [tokens](https://momentjs.com/docs/#/parsing/string-format/). If `true` use default locale format, `false` hides time-picker.
13+
- `format`: sets storage format; accepts [Day.js formats](https://day.js.org/docs/en/display/format); defaults to ISO8601 (if supported by output format)
14+
- `date_format`: sets date display format in UI; boolean or [Day.js formats](https://day.js.org/docs/en/display/format). If `true` use default locale format.
15+
- `time_format`: sets time display format in UI; boolean or [Day.js formats](https://day.js.org/docs/en/display/format). If `true` use default locale format, `false` hides time-picker.
1616
- `picker_utc`: _(default: `false`)_ when set to `true`, the datetime picker will display times in UTC. When `false`, the datetime picker will display times in the user's local timezone. When using date-only formats, it can be helpful to set this to `true` so users in all timezones will see the same date in the datetime picker.
1717
- **Example:**
1818
```yaml

0 commit comments

Comments
 (0)