Datamanager 2 date datatype

Available configuration options:

  • string storage_type: Defines the storage format of the date. The default is 'ISO', see below for details.

Available storage formats:

  • ISO: YYYY-MM-DD HH:MM:SS
  • ISO_DATE: YYYY-MM-DD
  • ISO_EXTENDED: YYYY-MM-DDTHH:MM:SS(Z|[+-]HH:MM)
  • ISO_EXTENDED_MICROTIME: YYYY-MM-DDTHH:MM:SS.S(Z|[+-]HH:MM)
  • UNIXTIME: Unix Timestamps (seconds since epoch)
package midcom.helper.datamanager2

 Methods

_on_configuring ($config)

Initialize the value with an empty DateTime object.

Parameters

$config

_on_validate ()

convert_from_csv ($source)

CSV conversion is mapped to regular type conversion.

Parameters

$source

convert_from_storage (mixed $source)

This function uses the DateTime constructor to handle the conversion.

It should be able to deal with all three storage variants transparently.

Parameters

$source

mixedThe storage data structure.

convert_to_csv ()

CSV conversion is mapped to regular type conversion.

convert_to_html ()

convert_to_storage ()

Converts DateTime object to storage representation.

Returns

stringThe string representation of the date according to the storage_type.

is_empty ()

Tries to detect whether the date value entered is empty in terms of the Midgard core.

For this, all values are compared to zero, if all tests succeed, the date is considered empty.

Returns

booleanIndicating Emptyness state.

_get_format (string $base)

Helper function that returns the localized date format with or without time

Parameters

$base

stringThe format we want to use

_validate_date_range ()

 Properties

 

string $later_than

Possible date field that must be earlier than this date field
 

mixed $max_date

Maximum date which the $value should not exceed, can be passed in schema
 

mixed $min_date

Minimum date which the $value should not exceed, can be passed in schema
 

string $storage_type

The storage type to use, see the class introduction for details.
 

\DateTime $value

The current date encapsulated by this type.