Datetime Type

Overview

The datetime field type stores both date and time.

// streams/example.json
"fields": {
    "starts_at": {
        "type": "datetime"
    }
}

Configuration

@todo Generate config options from class::configuration

// streams/example.json
"fields": {
    "starts_at": {
        "type": "datetime",
        "config": {
            "default": "now"
        }
    }
}

Data Structure

{
    "starts_at": "2021-01-01 09:30:00"
}

Basic value access returns the stored value:

// Basic access
{{ $entry->starts_at }}

Decorator Usage

Datetime types also provide decorated values which returns a Carbon instance.

// Decorated value
{{ $entry->startsAt()->diffForHumans() }}

Methods

@todo Generate methods from @docs