class DateTimeControl extends BaseControl

Date, time, or date-time input returning DateTimeImmutable (or string/timestamp based on format).

Constants

TypeDate

TypeTime

TypeDateTime

FormatObject

FormatTimestamp

Methods

__construct(string|Stringable|null $label = null, int $type = self::TypeDate, bool $withSeconds = false)

No description

setFormat(string $format)

Format of returned value. Allowed values are string (ie 'Y-m-d'), DateTimeControl::FormatObject and DateTimeControl::FormatTimestamp.

setValue(DateTimeInterface|string|int|null $value)

No description

DateTimeImmutable|string|int|null
getValue()

No description

void
loadHttpData()

No description

Html
getControl()

No description

string
formatHtmlValue(DateTimeInterface|string|int $value)

Formats a date/time for HTML attributes.

string
formatLocaleText(DateTimeInterface|string|int $value)

Formats a date/time according to the locale and formatting options.

bool
validateMinMax(mixed $min, mixed $max)

Checks whether the control's value falls within the given date/time range.

Details

at line 35
__construct(string|Stringable|null $label = null, int $type = self::TypeDate, bool $withSeconds = false)

No description

Parameters

string|Stringable|null $label
int $type
bool $withSeconds

at line 49
DateTimeControl setFormat(string $format)

Format of returned value. Allowed values are string (ie 'Y-m-d'), DateTimeControl::FormatObject and DateTimeControl::FormatTimestamp.

Parameters

string $format

Return Value

DateTimeControl

at line 59
DateTimeControl setValue(DateTimeInterface|string|int|null $value)

No description

Parameters

DateTimeInterface|string|int|null $value

Return Value

DateTimeControl

at line 68
DateTimeImmutable|string|int|null getValue()

No description

Return Value

DateTimeImmutable|string|int|null

at line 99
void loadHttpData()

No description

Return Value

void

at line 109
Html getControl()

No description

Return Value

Html

at line 124
string formatHtmlValue(DateTimeInterface|string|int $value)

Formats a date/time for HTML attributes.

Parameters

DateTimeInterface|string|int $value

Return Value

string

at line 137
string formatLocaleText(DateTimeInterface|string|int $value)

Formats a date/time according to the locale and formatting options.

Parameters

DateTimeInterface|string|int $value

Return Value

string

at line 175
bool validateMinMax(mixed $min, mixed $max)

Checks whether the control's value falls within the given date/time range.

For TypeTime, wraps around midnight (e.g. 22:00–02:00) if min > max.

Parameters

mixed $min
mixed $max

Return Value

bool