Skip to content

Commit

Permalink
fix date_format and time_format - they set input type and storage format
Browse files Browse the repository at this point in the history
#7166
  • Loading branch information
martinjagodic committed Aug 20, 2024
1 parent 01e54d8 commit d62a13f
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions content/docs/widgets/datetime.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,31 @@ label: DateTime

The datetime widget translates a datetime picker to a datetime string.

- **Name:** `datetime`
- **UI:** datetime picker
- **Data type:** [Day.js](https://day.js.org/)-formatted datetime string
- **Options:**
**Name:** `datetime`

**UI:** datetime-local input / date inupt / time input

**Data type:** [Day.js](https://day.js.org/)-formatted datetime string

**Options:**
- `default`: accepts a datetime string, or `'{{now}}'` to fill in the current datetime; otherwise defaults to empty string.

<small>Unitl 3.2.1 it defaults to current datetime. To get an empty field, set default to empty string.</small>
- `format`: sets storage format; accepts [Day.js formats](https://day.js.org/docs/en/display/format); defaults to ISO8601 (if supported by output format). If set, `date_format` and `time_format` are not used.
- `date_format`: sets date display format in UI; boolean or [Day.js formats](https://day.js.org/docs/en/display/format). If used without `time_format`, only the date picker is displayed.
- `time_format`: sets time display format in UI; boolean or [Day.js formats](https://day.js.org/docs/en/display/format). If used without `date_format`, only the time picker is displayed.
- `format`: sets storage format, displays the full date and time input in the UI. Accepts [Day.js formats](https://day.js.org/docs/en/display/format); defaults to ISO8601 (if supported by output format). If set, `date_format` and `time_format` are not used.
- `date_format`: sets storage format and UI input type as date picker (without time). Boolean or [Day.js formats](https://day.js.org/docs/en/display/format).
- `time_format`: sets storage format and UI input type as time picker (without date). Boolean or [Day.js formats](https://day.js.org/docs/en/display/format). If used together with `date_format`, the UI input will be a full datetime 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 time zones will see the same date in the datetime picker.
- **Example:**
```yaml
- label: "Start time"
name: "start"
widget: "datetime"
default: "{{now}}"
date_format: "DD.MM.YYYY" # e.g. 24.12.2021
time_format: "HH:mm" # e.g. 21:07
format: "LLL"
picker_utc: false
```

<small>The display format of the input element depends on browser locale.</small>

**Example:**
```yaml
- label: "Start time"
name: "start"
widget: "datetime"
default: "{{now}}"
date_format: "DD.MM.YYYY" # e.g. 24.12.2021
time_format: "HH:mm" # e.g. 21:07
format: "LLL"
picker_utc: false
```

0 comments on commit d62a13f

Please sign in to comment.