Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/2.0/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ By default, flatpickr is [disabled on mobile](https://flatpickr.js.org/mobile-su
The `DateTime` field is similar to the Date field with two new attributes. `time_24hr` tells flatpickr to use 24 hours format and `timezone` to tell it in what timezone to display the time. By default it uses your browser's timezone.

```ruby
filed :created_at, as: :date_time, name: 'User joined', picker_format: 'Y-m-d H:i', format: :db, time_24hr: true, timezone: 'PST'
field :created_at, as: :date_time, name: 'User joined', picker_format: 'Y-m-d H:i', format: :db, time_24hr: true, timezone: 'PST'
```

## External image
Expand Down Expand Up @@ -681,6 +681,17 @@ The `Textarea` field renders a `textarea` element and has the `rows` option that
field :body, as: :textarea, rows: 5
```

## Time

<!-- Replace this image with one of the Time field -->
<img :src="$withBase('/assets/img/fields/date-time.jpg')" alt="DateTime field" class="border mb-4" />

The `Time` field is similar to the DateTime field and uses the time picker of flatpickr (without the calendar). You can use the `time_24hr` option for flatpickr to use the 24-hour format. Add the option `relative: false` if you want the time to stay absolute and not change based on the browser's timezone.

```ruby
field :starting_at, as: :time, picker_format: 'H:i', format: "HH:mm", time_24hr: true
```

## Trix

<img :src="$withBase('/assets/img/fields/trix.jpg')" alt="Trix field" class="border mb-4" />
Expand Down