View Source ExTeal.Fields.Date (ExTeal v0.28.1)

The Date field may be used to generate a calendar date select.

The date format for display on the index and detail views may be defined using the Select.with_options/2 function:

Date.make(:date)
|> Date.with_options(%{"format" => "YYYY/MM/DD"})

Summary

Functions

Callback implementation for ExTeal.Field.filterable_as/0.

Set the format that the date is rendered with on the detail and index components.

Callback implementation for ExTeal.Field.make/2.

Set the format that flatpickr will render the date in on forms.

Callback implementation for ExTeal.Field.sanitize_as/0.

Types

@type valid_format() :: :short | :med | :full | :huge

Functions

Link to this function

apply_options_for(field, model, conn, type)

View Source

Callback implementation for ExTeal.Field.apply_options_for/4.

Callback implementation for ExTeal.Field.default_sortable/0.

Callback implementation for ExTeal.Field.filterable_as/0.

@spec format(ExTeal.Field.t(), valid_format()) :: ExTeal.Field.t()

Set the format that the date is rendered with on the detail and index components.

Uses luxon's toLocaleString to display the date in a localized format:

Examples:

:short en_US -> 10/14/1983 fr -> 14/10/1983

:med en_US -> Oct 14, 1983 fr -> 14 oct. 1983

:full en_US -> October 14, 1983 fr -> 14 octobre 1983

:huge en_US -> Tuesday, October 14, 1983 fr -> vendredi 14 octobre 1983

Link to this function

make(name, label \\ nil)

View Source

Callback implementation for ExTeal.Field.make/2.

Link to this function

picker_format(field, format)

View Source

Set the format that flatpickr will render the date in on forms.

Format should be a string of flatpickr tokens

Callback implementation for ExTeal.Field.sanitize_as/0.

Link to this function

value_for(field, model, method)

View Source

Callback implementation for ExTeal.Field.value_for/3.

Link to this function

with_options(field, options)

View Source
This function is deprecated. Use Date.format/2 and Date.picker_format/2 instead.