# `Backpex.Fields.Date`
[🔗](https://github.com/naymspace/backpex/blob/0.18.3/lib/backpex/fields/date.ex#L3)

A field for handling a date value.

## Field-specific options

See `Backpex.Field` for general field options.

* `:format` - Format string which will be used to format the date time value or function that formats the date time.

  Can also be a function wich receives a `DateTime` and must return a string.

  The default value is `"%Y-%m-%d"`.

* `:debounce` - Timeout value (in milliseconds), "blur" or function that receives the assigns.

* `:throttle` - Timeout value (in milliseconds) or function that receives the assigns.

* `:readonly` - Sets the field to readonly. Also see the [panels](/guides/fields/readonly.md) guide.

## Examples

    @impl Backpex.LiveResource
    def fields do
      [
        created_at: %{
          module: Backpex.Fields.Date,
          label: "Created At",
          format: "%d.%m.%Y"
        }
      ]
    end

    @impl Backpex.LiveResource
    def fields do
      [
        created_at: %{
          module: Backpex.Fields.Date,
          label: "Created At",
          format: fn date -> # Takes a `Date` and returns a string
            # Timex should be installed separately, used as a reference for
            # custom formatting logic.
            Timex.format!(date, "{relative}", :relative)
          end
        }
      ]
    end

    @impl Backpex.LiveResource
    def fields do
      [
        created_at: %{
          module: Backpex.Fields.Date,
          label: "Created At",
          # If you use the same formatting logic in multiple places
          format: &MyApp.Formatters.Dates/1
        }
      ]
    end

# `config_schema`

Returns the schema of configurable options for this field.

This can be useful for reuse in other field modules.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
