Date
+ Inheritance diagram for Date:

Description

A custom-field's selected date-time.

Public Methods

 __construct (Data|Api $caller, $spec)
 
string __toString ()
 ISO-8601. More...
 
DateTimeImmutable asDT ()
 A date-time object, either in the true timezone if a time was selected, or the runtime's timezone if only a date was selected. More...
 
magic string getDate ()
 YYYY-MM-DD. More...
 
magic null string getDateTime ()
 ISO-8601, or null when there is no time selected. More...
 
magic bool hasDateTime ()
 
- Public Methods inherited from Data
mixed __call (string $method, array $args)
 Magic method handler. More...
 
 __construct (Api|self $caller, array $data=[])
 
array __serialize ()
 
void __unserialize (array $data)
 
bool isDiff ()
 Whether the instance has changes. More...
 
array jsonSerialize ()
 
bool offsetExists (mixed $offset)
 
mixed offsetGet (mixed $offset)
 
void offsetSet (mixed $offset, mixed $value)
 
void offsetUnset (mixed $offset)
 
array toArray (bool $diff=false)
 Dehydrated data. More...
 

Additional Inherited Members

- Protected Properties inherited from Data
readonly Api Api $api
 
array array self[] AbstractEntity[] $data = []
 
array bool[] $diff = []
 
const MAP = []
 
- Protected Methods inherited from Data
mixed _get (string $field)
 Magic method: getField() More...
 
bool _has (string $field)
 Magic method: hasField() More...
 
_hydrate (string $class, $item)
 Sub-data factory that draws from the entity pool. More...
 
bool _is (string $field)
 Magic method: isField() More...
 
bool _of (string $resourceSubtype)
 Magic method: ofResourceSubtypeValue() More...
 
array _select (string|iterable $subject, callable $filter,... $args)
 Magic method: selectField(callable $filter) More...
 
$this _set (string $field, $value)
 Magic method: setField(mixed $value) More...
 
void _setData (array $data)
 Clears all diffs and sets all data, hydrating mapped fields. More...
 
void _setField (string $field, $value)
 Sets a value, hydrating if mapped, and clears the diff. More...
 

Constructor

◆ __construct()

__construct ( Data|Api  $caller,
  $spec 
)
Parameters
Data | Api$caller
string | DateTimeInterface | array$specDate-like, or data from Asana.

Methods

◆ __toString()

string __toString ( )

ISO-8601.

Returns
string

◆ asDT()

DateTimeImmutable asDT ( )

A date-time object, either in the true timezone if a time was selected, or the runtime's timezone if only a date was selected.

Returns
DateTimeImmutable

◆ getDate()

magic string getDate ( )

YYYY-MM-DD.

Returns
string

◆ getDateTime()

magic null string getDateTime ( )

ISO-8601, or null when there is no time selected.

Returns
null|string

◆ hasDateTime()

magic bool hasDateTime ( )
Returns
bool