Maru.Params.Types.DateTime (maru_params v0.2.5)

Buildin Type: DateTime

Parser Arguments

* `:format` - how to parse a datetime value
  * `:iso8601` - parse by `DateTime.from_iso8601/2` or `NaiveDateTime.from_iso8601/2`
  * `{:unix, unit}` - parse by `DateTime.from_unix/2`
  * `:unix - parse by `DateTime.from_unix/1`
    * `:unit` - unit for unix datetime
      * `:second` (default)
      * `:millisecond`
      * `:microsecond`
      * `:nanosecond`
* `:naive` - return `DateTime` or `NaiveDateTime` struct
  * `false` (default) - return `DateTime` struct
  * `true` - return `NaiveDateTime` struct
* `:truncate` - unit to truncate the output
  * `:microsecond`
  * `:millisecond`
  * `:second`

Examples:

requires :created, DateTime, format: :iso8601, naive: true
optional :updated, DateTime, format: {:unix, :second}, truncate: :second

Link to this section Summary

Link to this section Functions

Link to this function

parse(input, args)

Link to this function

parser_arguments()

Link to this function

validator_arguments()