Dates and time zones
A calendar date without a time is kept apart from a moment in time with a zone. The adapter turns the grid's zone-less strings into typed values using the field's declared type and the zone of the request, never the zone of the server. No compiler guesses a zone.
Rule. The IR distinguishes a local date ($defs/dateValue — a calendar date, no time-of-day, no zone) from an instant ($defs/datetimeValue — a point in time plus the IANA zone used to resolve it). AG Grid emits date/datetime filter values as zone-less "YYYY-MM-DD HH:mm:ss" (or "YYYY-MM-DD") strings; resolving one of those strings into a dateValue or datetimeValue is exclusively the frontend adapter's job, using both the field's schema-declared type and the request context's zone — never the server process's local timezone, and never a zone guessed from the string itself (it doesn't carry one).
A set filter's values follow the same rule (pinned). The values of a set filter (in, wire shape {filterType:'set', values:[...]}) on a date or datetime field take the comparison filter's two wire spellings per field type (plus, on a datetime field only, an ISO-8601 instant, because a Set Filter's key for a datetime-string column is the raw data string), and the adapter resolves them with the request's zone (requestContext.zone, else the adapter's default zone). datetime: an ISO-8601 instant with Z or an offset passes unchanged; otherwise YYYY-MM-DD HH:mm:ss or YYYY-MM-DD is read as a wall-clock time in that zone and resolved to the absolute instant (datetimeValue, zone = the zone used). date: YYYY-MM-DD, or YYYY-MM-DD HH:mm:ss with a midnight time only, becomes a dateValue (no zone); a non-midnight time, or an ISO instant, is rejected, never truncated (a local date is never conflated with an instant). Any other text is a request error (malformed-request) raised by the adapter, not a later coercion error. A parse without a schema keeps the verbatim string. The customFilters typed-value path (notIn) is already typed and unaffected.
Compilers never emit a zone clause for a datetimeValue (pinned). By the time a datetimeValue reaches a compiler, value is already an absolute instant (an ISO-8601 timestamp with an explicit offset/Z) — a fixed point on the universal timeline that means the same thing regardless of any zone. The compiler compares/stores it as that absolute instant and nothing else: no AT TIME ZONE, no $dateTrunc-with-timezone, no ES time_zone parameter, ever, for a plain comparison against a datetimeValue. datetimeValue.zone is provenance metadata — it records which zone the adapter used to resolve the original wire string into that absolute instant (needed for audit/debugging and for the adapter's own resolution step) — it is not an instruction for the compiler to act on. (Zone-aware date-math — grouping rows by "day in the user's zone", for example — is a post-v1 aggregation feature, not part of comparing a datetimeValue in a filter; if and when it ships, it will need its own IR shape carrying the target zone explicitly on the aggregation, not a compiler quietly reaching into a comparison node's provenance field.) For inRange, per-boundary inclusivity (fromInclusive/toInclusive) is carried explicitly on the IR node and the compiler MUST read it from there — never assume a fixed default.
A datetime read back from a result is an absolute UTC instant (pinned; Bug #2511). Everything above is about the value going in; an execution adapter that reads a result row back must hand a datetime cell to its caller as the same kind of thing: an absolute instant, expressed in UTC. In a language whose date-time type records a kind or an offset (C#'s DateTime, a zone-aware value elsewhere), the value carries UTC, so that serialising it yields the trailing Z and nothing in between can reinterpret it. Three cases, by what the driver returns:
| The driver returns | The adapter delivers |
|---|---|
a value that already denotes UTC (a UTC kind, an offset of zero, an ISO text ending in Z; PostgreSQL's timestamptz through a driver that returns UTC) | that instant, unchanged |
a value with an offset, or a local kind the driver produced by converting a zoned value (SQL Server's datetimeoffset) | the same instant converted to UTC; never the offset-local wall-clock reading |
a value with no zone (SQL Server's datetime2, MySQL's DATETIME, a zone-less text) | that wall-clock reading as UTC |
The last row is the host obligation stated for the SQL arm above, seen from the other end: a column with no zone type stores the UTC wall-clock reading (the seed of every execution-equality fixture is UTC, XEQ-2), so reading it as UTC is the only reading under which what went in is what comes out. A driver option that merely labels a zone-less value as local without converting it (MySqlConnector's DateTimeKind=Local) does not make it a zoned value: the host leaves such an option at the driver's default or at UTC, or the adapter would shift the value by the server's offset. Must NOT: deliver a zone-less value with an unspecified kind (a serialiser then drops the Z, and a consumer is left to guess), reinterpret it in the server process's local zone (SEM-4 already forbids that for the way in), or treat it as local and convert it to UTC (that would shift every instant by the server's offset). A date cell is unaffected (a local date has no zone). This rule is checked by each execution adapter's own tests, not by compile fixtures: a compiler never reads a result. Today Craticula.Dapper (DapperValueReaderDatetimeTests) and Craticula.EntityFrameworkCore (Bug #2798, EfCoreDatetimeKindTests) are covered by such tests; MongoDB's and OpenSearch's readers return UTC by construction. EF Core: the adapter has no reader of its own, so it applies the same table to every DateTime or DateTimeOffset cell of a page or an export row after EF has materialised it, whatever the provider; a host therefore needs no UTC value converter for the result side. The comparison side stays the host's obligation as above. For SQLite that obligation includes the binding: EF binds a DateTime in its own yyyy-MM-dd HH:mm:ss form, so the host maps every datetime to and from the stored yyyy-MM-ddTHH:mm:ss.fffZ text on its DbContext, or an eq, a range bound and a datetime-sorted export return wrong rows without an error (a walk that meets the row its previous chunk ended on stops with an exception) (Bug #2805, EfCoreHostObligationTests).
MongoDB representation of dateValue (pinned): a plain ISO date string, never a BSON Date. MongoDB's Date type has no "calendar date, no time-of-day" concept — every BSON Date is an instant. Storing/comparing a dateValue as a BSON Date therefore requires silently promoting it to some midnight instant, and "midnight in which zone?" has no answer for a value that was never an instant in the first place — exactly the conflation this rule's own second "must NOT" (below) forbids "without that promotion being an explicit, documented adapter decision." Rather than making that decision implicitly inside every Mongo compiler, the pinned mechanism sidesteps it: dateValue compiles to the ISO calendar-date string itself ("1990-05-12"), compared as a plain BSON string. Lexicographic string comparison on YYYY-MM-DD already matches chronological order, so $gte/$lt work correctly with no Date promotion, no zone, and no ambiguity. datetimeValue (an instant) still compiles to a BSON Date — extended-JSON's $date field requires a full instant string with an explicit offset/Z ("2026-01-01T00:00:00Z"), never a bare calendar date.
Not yet pinned — flagged in the TRD, stated here rather than guessed at. The TRD (§7.4) explicitly marks the exact default boundary inclusivity that AG Grid's own simple date filter uses for
inRange(its stated default is exclusive of both bounds) as "verify at implementation time and freeze" — i.e., a value to be captured from a live grid and locked into fixtures by #1630, not a certainty this document should assert today. What is pinned by this rule is the mechanism: inclusivity flags are always explicit on the IR node and always read literally by the compiler. What is not yet pinned is the specific default value the adapter should choose when AG Grid's own request doesn't make it explicit. Treat any inclusive/exclusive example below as illustrative of the mechanism, not as the frozen default.
Rationale. Three naive failure modes, all seen in hand-rolled translations: (1) treating every date as a UTC instant regardless of its declared type — a local-date field compared this way shifts by a day for any user not in UTC, the classic "date is off by one near midnight" bug; (2) parsing AG Grid's zone-less datetime string using the server process's own local timezone, which makes the exact same IR return different rows depending on the deployment environment's TZ setting — a compiler that isn't even deterministic on its own inputs; (3) hardcoding inRange boundaries as always-inclusive (SQL BETWEEN's familiar default) regardless of what the IR's explicit flags say, so a row sitting exactly on a boundary appears in the grid's client-side row model and silently disappears once the same filter is compiled for SSRM. All three are exactly the kind of "usually wrong" translation TRD §7's opening line calls out — dates and zones are where naive compilers most often diverge from what the grid itself shows the user.
Worked example — inRange on createdAt (an instant field), from 2026-01-01T00:00:00Z (inclusive) to 2026-02-01T00:00:00Z (exclusive), as resolved by the adapter for illustration:
- SQL — a local-date field needs no zone conversion at all (it never had one); a true instant field is compared against already-UTC-resolved boundary parameters. PostgreSQL's
timestamptzstores/compares in UTC internally regardless of session timezone, so noAT TIME ZONEclause is needed once the adapter has resolved the instant; a dialect without a true timezone-aware timestamp type (SQL Server'sdatetime2, MySQL'sDATETIME) is a host obligation instead: such a column stores the UTC wall-clock reading of the instant, so the same UTC-resolved boundary parameters compare against it directly, with no conversion in the statement and none on the way back (the result side of this rule reads it as UTC, below):WHERE created_at >= :from AND created_at < :to - SQLite — a fixed-width text instant, on both sides of the comparison (pinned). SQLite has no timestamp type: a
datetimecolumn holds TEXT and>,<,=compare it character by character. Text is only chronological when every value has the same width, and the two spellings of one second,...:00Zand...:00.001Z, are not the same width:.(0x2E) sorts beforeZ(0x5A), so a stored2026-01-01T00:00:00.001Zsorts before a bound spelled2026-01-01T00:00:00Z, andgton that bound silently drops a row that is later than it. The rule therefore has two halves, and neither is enough alone. Host obligation: a SQLitedatetimecolumn stores exactly three fractional digits,yyyy-MM-ddTHH:mm:ss.fffZ, UTC (the millisecond precision XEQ-2 already caps a seed at). Compiler rule: the SQLite arm binds adatetimeValuein the same form, so a whole-second instant is bound as2026-01-01T00:00:00.000Z, never...:00Z. A bound with a sub-millisecond part (a fraction finer than three digits that is not all zeros after the third) is rounded to the millisecond by its operator, because the text of...:00.0005Zsorts before the stored...:00.000Zalthough it is later. Stored valuessare always millisecond-aligned, so for a boundband its floor / ceiling to the millisecond:x > biss > floor(b),x <= biss <= floor(b),x >= biss >= ceil(b)andx < biss < ceil(b). The SQLite arm therefore bindsfloor(b)forgtandlte, andceil(b)forgteandlt; aninRangefollows its two bounds' own operators (an exclusive from-bound isgt, an inclusive onegte; an inclusive to-bound islte, an exclusive onelt).eq,neq,inandnotInkeep the full value: a finer-than-millisecond value never equals a stored one, which is the correct answer. A bound that is already millisecond-aligned is unchanged. Postgres, SQL Server, MySQL and Oracle compare a typed instant, not text, and keep the form of SEM-4 above (...:00Zfor a whole second). The obligation covers the path that sends the bound as text (Craticula.Sqland the Dapper adapter on top of it); the EF Core adapter hands its provider aDateTime, so a host that stores the form above maps every datetime to and from it on itsDbContext(SEM-4's EF paragraph, Bug #2805; the divergence without it is recorded inSqliteTypeAffinityDivergenceTestsandEfCoreHostObligationTests). That mapping writes millisecond text, so a finer-than-millisecond bound is truncated there, not floored or ceiled as above. - MongoDB — an instant field (
datetimeValue) compares against BSONDatevalues built from the full instant string (see the pinned representation above); a local-date field (dateValue) compares against the plain ISO date string instead, never aDate:// instant field: { "createdAt": { "$gte": { "$date": "2026-01-01T00:00:00Z" }, "$lt": { "$date": "2026-02-01T00:00:00Z" } } } // local-date field: { "createdOn": { "$gte": "2026-01-01", "$lt": "2026-02-01" } } - OpenSearch / Elasticsearch — a
rangequery choosinggte/gtandlt/lteper the inclusivity flags, with an explicitformat(pinning the accepted string shape) — notime_zoneparameter, because both boundaries are already-resolved absolute instants (with an explicitZ/offset) andtime_zoneonly affects unqualified date-math strings, which never occur here:{ "range": { "createdAt": { "gte": "2026-01-01T00:00:00Z", "lt": "2026-02-01T00:00:00Z", "format": "strict_date_optional_time" } } }
Must NOT.
- Must NOT assume a fixed server or database default timezone anywhere in the compiler; zone resolution happens once, in the adapter, using the request context's zone.
- Must NOT emit any dialect zone-conversion clause (
AT TIME ZONE,$dateTrunc'stimezoneoption, EStime_zone) when compiling a comparison against adatetimeValue— the value is already an absolute instant; a zone clause at that point does not "correctly interpret" it, it changes what the comparison means, silently making the compiler's output depend ondatetimeValue.zone(a provenance field) in a way no other backend's compiler does. - Must NOT conflate
dateValueanddatetimeValueat the compiler level — a local date must never be silently promoted to a midnight-UTC instant and then compared against instant semantics without that promotion being an explicit, documented adapter decision. - Must NOT hardcode
inRangeas inclusive-inclusive (or any other fixed combination) — the flags are already explicit onrangeComparisonNode; the compiler reads them, it never assumes them. - Must NOT present the exact AG Grid boundary-inclusivity default as settled fact in fixtures or documentation before it has been verified against a live grid, per the TRD's own "verify and freeze" flag on this rule.
- Must NOT represent a
dateValueas a MongoDBDate— see the pinned representation above; use the plain ISO date string.
Fixture format note. A datetimeValue fixture's expected artifacts are only reproducible if the adapter's resolved value AND the request-context zone it used are both visible in the fixture inputs — otherwise a port author must guess the zone the original fixture author assumed. agGridRequest.json fixtures needing this carry an optional requestContext: { "zone": "<IANA id>" } sibling field alongside the AG Grid wire shape (the same "documented extension beyond AG Grid's own wire format" pattern as customFilters, OQ-11) — see spec/fixtures/README.md.
requestContext carries a second, related field for the same reproducibility reason: now (an ISO-8601 instant), required by any fixture whose expected artifacts depend on what "now" was — i.e. every AG-2 date-preset fixture, since today/last7Days/... resolve relative to the current instant. The two fields differ in status, and the difference is normative: zone is read off the wire, now is not. An implementation resolves presets against its own injected clock and MUST NOT honor a client-supplied now — a request that could redefine what "last 7 days" means would let any caller move the window at will. now exists so a conformance harness can pin its clock and replay the fixture deterministically; it is a harness instruction, never a wire input. See spec/fixtures/date-presets/README.md.
Cross-links. $defs/dateValue, $defs/datetimeValue, $defs/rangeComparisonNode (fromInclusive, toInclusive), $defs/typedValue.