Edit this page

Configuration

Below is the full configuration available with defaults values:

"example" => [
    "type"   => "anomaly.field_type.datetime",
    "config" => [
        "default_value" => null,
        "mode"          => "datetime",
        "date_format"   => "j F, Y",
        "year_range"    => "-50:+50",
        "time_format"   => "g:i A",
        "timezone"      => null,
        "picker"        => true,
        "step"          => 15,
        "min"           => null,
        "max"           => null
    ]
]
Configuration
Key Example Description
default `now` The default value.
mode time The input mode. Valid options are `datetime`, `date`, and `time`.
date_format `l jS \\of F Y` A PHP date format. Only used in `datetime` and `date` modes.
year_range `-5:+50` A range of valid years to choose from.
time_format `h:i:s A` A PHP date format. Only used in `datetime` and `time` modes.
timezone `America/Chicago` The timezone for the input and output. Defaults to system configured timezone.
picker `false` Enables and disables the datetime picker UI.
step 30 The minute step detail. Only used in `datetime` and `time` modes.
min -1w A valid number or string option accepted by [jQuery Datepicker](https://api.jqueryui.com/datepicker/#option-minDate)
max +1w A valid number or string option accepted by [jQuery Datepicker](https://api.jqueryui.com/datepicker/#option-maxDate)

Addon Configuration

The datetime configuration options are controlled by the field type's formats.php configuration file.

You can override these options by publishing the addon and modifying the resulting configuration file:

php artisan addon:publish anomaly.field_type.datetime

The field type will be published to /resources/{application}/addons/anomaly/datetime-field_type.

If you have options to add or have found an error, submit a pull request to https://github.com/anomalylabs/datetime-field_type