Expand description
Date helpers for the read path.
Things stores user-facing dates (startDate, deadline) as bit-packed
integers:
bit 27 0
YYYYYYYYYYYY MMMM DDDDD 0000000
↑ 12 bits ↑ 4 ↑ 5 ↑ 7 bits padding0 means “no date” (Things never writes 1970-00-00). Things stores
row-modification timestamps (creationDate, userModificationDate,
stopDate) separately as REAL Unix seconds — those go through
unix_to_iso over in queries.rs, not here.
Functions§
- decode_
things_ date - Decode a Things packed date into an ISO
YYYY-MM-DDstring. ReturnsNonefor0and for out-of-range / malformed values so a future schema change can’t surface garbage to callers. - pack_
things_ date - Pack a
(year, month, day)triple back into Things’ format. Used by query helpers that need to compare againsttodayor user-supplied date bounds without round-tripping through ISO strings. - parse_
iso_ date - Parse
YYYY-MM-DDinto(y, m, d). ReturnsNoneon any deviation from the strict 10-character ISO date form so caller validation is straightforward. - today_
packed_ utc - Today’s date (UTC), packed for direct comparison against Things’
startDate/deadlinecolumns. - ymd_
to_ unix_ utc (year, month, day)→ Unix epoch seconds (00:00 UTC of that date). Inverse ofcore::backup::unix_to_ymdhmsrounded to whole days. Used bythings_list_logbook’sfrom/tofilters which compare againststopDate(REAL Unix seconds).