Reject an AI timestamp that has no offset before you store it
Require Z or ±HH:MM on every AI timestamp. Reject naive local times before they hit your database.
In short
- Write the instant you want before you read the chat reply: full date, time, and
Zor a numeric offset. - Parse with a real library. Keep the value only when it is timezone-aware.
- Reject date-only strings and naive
2026-12-03T09:00:00even whenfromisoformat“succeeds.”
ChatGPT and Claude will happily emit a clock reading that looks finished. RFC 3339 timestamps for internet use need a date, a time, and either Z or a numeric offset such as +07:00. A string without that offset is not an instant you can store safely.
Same family of checks as a JSON object you wrote first or a timezone conversion you already computed.
Write the expected instant first
Suppose a shop in Ho Chi Minh City schedules a pickup at 09:00 on 3 December 2026. The sheet you trust is:
2026-12-03T09:00:00+07:00
That is the same instant as 2026-12-03T02:00:00Z. Put that line in your test before you open the chat. The model’s job is to return that shape — not a vague “9am tomorrow.”

If the product needs a wall-clock recurrence (“every day at 09:00 in Asia/Ho_Chi_Minh”), that is a different type — zone + rule — not a single offset-bearing string.
What parsers accept that you must still discard
Checked on Python 3.15.2 (3 December 2026).
datetime.fromisoformat accepts several ISO-like forms. After replacing a trailing Z with +00:00, these behave as follows:
| Input | Result | Keep? |
|---|---|---|
2026-12-03T09:00:00Z |
aware, UTC | Yes (if your sheet allows Z) |
2026-12-03T09:00:00+07:00 |
aware, +07:00 | Yes |
2026-12-03T09:00:00 |
naive | No |
2026-12-03 |
date at midnight, naive | No |
Parser success is not a pass. A naive object has no offset. Calling .astimezone() on it treats the value as the machine’s local zone — which changes between CI, a laptop, and a container.
from datetime import datetime
def accept_instant(s: str) -> datetime:
raw = s.strip()
if raw.endswith("Z"):
raw = raw[:-1] + "+00:00"
dt = datetime.fromisoformat(raw)
if dt.tzinfo is None:
raise ValueError("missing offset")
return dt.astimezone() # or convert to UTC explicitly

Product policy may also reject -00:00 (RFC 3339 §4.3: UTC known, local offset unknown). Document that choice; do not silently treat it as Z.
Gate: match your sheet, then store UTC
- Ask for one timestamp string.
- Run
accept_instant. - Compare the UTC instant to the sheet (
2026-12-03T02:00:00+00:00for the example above). - Keep only on an exact match. On failure, ask again with the sheet pasted — do not “fix” the offset yourself.

A wrong offset that still parses will land the meeting four hours early. Matching the sheet catches that; “looks like ISO” does not.
Watch-outs
- Space instead of
T(2026-12-03 09:00:00+07:00) often parses in Python; still require an offset. - Leap seconds and exotic fractional precision are outside most app contracts — pick a bounded profile and reject the rest.
- Relative phrases (“next Friday”) belong in a structured extractor, then you compute the instant in code with a known IANA zone.
Share