DateRange#
DateRange edits two properties of the entity as one period,
dateRange in the descriptor, {"from": …, "to": …} on the wire:
DateRange::between('promotion', 'promotionStartsOn', 'promotionEndsOn')->minDate('2020-01-01'),
The second and third arguments name the properties holding the first
and the last day (or instant); the field’s own name is not a property,
and make() throws, since a range needs both. The build reads their
types from the entity: both Kinetis\Orm\Date (a range of days,
YYYY-MM-DD) or both DateTimeImmutable (a range of instants,
ISO 8601 in UTC). It refuses an end that is neither, two ends of
different types, one nullable end beside one that is not, an end that
is another field of the resource, and an end another range or flag
group writes too.
Value |
Meaning |
|---|---|
|
The period, both ends included. One day is a range from and to that day. |
|
No range: both properties null. Only a range whose two properties are nullable may be empty; |
Both ends are set or neither is: one alone is refused with
range_incomplete at the missing end (promotion.to), and an end
before the start with range_reversed at to. A range of instants
compares instants, whatever zone each end was written in. minDate()
and maxDate() bound both ends, as on a Date or DateTime field (see
Date bounds), and refuse a bound of the other kind when
the resource compiles. min(), max() and placeholder() are refused.
A write sets both properties together on create, update and bulk edit,
the audit trail records the range as one value, and a revert puts both
back. A CSV export writes the range as an ISO 8601 interval in one
cell, 2026-12-01/2026-12-24 (an empty cell for none), and an import
reads that cell back: a cell with one end, such as 2026-12-01/, fails
its row. An action dialog or a settings group cannot ask for a range:
it has no entity to keep the two ends in.
A range is never sorted, filtered or summarized as one value:
sortable(), filterable() and summarize() throw a LogicException
when the field is defined, and so does unique(), since a range has no
column of its own for an import to match rows by. It is not edited inline, cannot be grouped
by, and no condition (visibleWhen() and the others) may test it. To
sort or filter by one end, declare a Date or DateTime field for that
property on a resource of its own.
The form edits a range as two native date or date-time controls side by
side, the ones the filter bar uses, the end’s starting no earlier than
the start, and a list shows Dec 1, 2026 to Dec 24, 2026 in the UI’s
language. The descriptor publishes the field’s range: its kind
(date or datetime) and the properties from and to name.