Skip to content

Commit

Permalink
fix: change datetime widget value format (#7072)
Browse files Browse the repository at this point in the history
- from 12-hour to 24-hour format
- replace moment references in the docs

#7066

Co-authored-by: Anze Demsar <anze.demsar@p-m.si>
  • Loading branch information
martinjagodic and demshy authored Jan 30, 2024
1 parent 4f419dd commit 445a48c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/decap-cms-widget-datetime/src/DateTimeControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default class DateTimeControl extends React.Component {
<input
id={forID}
type="datetime-local"
value={dayjs(value).format('YYYY-MM-DDThh:mm')}
value={dayjs(value).format('YYYY-MM-DDTHH:mm')}
onChange={e => this.handleChange(dayjs(e.target.value))}
onFocus={setActiveStyle}
onBlur={setInactiveStyle}
Expand Down
8 changes: 4 additions & 4 deletions website/content/docs/widgets/datetime.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ The datetime widget translates a datetime picker to a datetime string.

- **Name:** `datetime`
- **UI:** datetime picker
- **Data type:** Moment.js-formatted datetime string
- **Data type:** [Day.js](https://day.js.org/)-formatted datetime string
- **Options:**
- `default`: accepts a datetime string, or an empty string to accept blank input; otherwise defaults to current datetime
- `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)
- `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.
- `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.
- `format`: sets storage format; accepts [Day.js formats](https://day.js.org/docs/en/display/format); defaults to ISO8601 (if supported by output format)
- `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.
- `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.
- `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.
- **Example:**
```yaml
Expand Down

0 comments on commit 445a48c

Please sign in to comment.