fix(driver-sql): present Field.time as a wall-clock time-of-day on read (SQLite)#2347
Merged
Conversation
…ad (SQLite) Field.time is a tz-naive time-of-day, not an instant (#2004). A defaultValue:'NOW()' time column historically took the full SQLite CURRENT_TIMESTAMP default, so a defaulted/legacy row read back a full 'YYYY-MM-DD HH:MM:SS' timestamp instead of a time-of-day. formatOutput now repairs a Field.time value to just its time portion (toTimeOnly): a legacy full timestamp (or a full ISO value that leaked into the column) is sliced to HH:MM[:SS[.fff]], while a value already stored as a bare time-of-day is left untouched. Deliberately NARROW + read-only (no write/filter counterpart) so it introduces no write/read asymmetry and preserves exact round-trips for bare time-of-day values (the field-zoo f_time guard). Runs for every dialect (a native TIME column already returns a time-of-day → no-op). Adds a timeFields registry + registration mirroring dateFields/datetimeFields. Completes the temporal read normalization alongside #2346: datetime -> ISO-8601-Z, date -> YYYY-MM-DD, time -> wall-clock time-of-day. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 8 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes the one residual from #2346:
Field.time.Field.timeis a tz-naive wall-clock time-of-day, not an instant (established in #2004). AdefaultValue: 'NOW()'time column historically took the full SQLiteCURRENT_TIMESTAMPdefault, so a defaulted/legacy row read back a full'YYYY-MM-DD HH:MM:SS'timestamp instead of a time-of-day.Fix
formatOutputnow repairs aField.timevalue to just its time portion viatoTimeOnly:HH:MM[:SS[.fff]];Deliberately narrow and read-only (no
formatInput/coerceFilterValuecounterpart): it only transforms legacy full-timestamp values that were already filter-broken, and never touches a bare time-of-day — so it introduces no write/read asymmetry and preserves exact round-trips for bare time-of-day values, including the field-zoof_timeguard ('14:30:00', #2022). Runs for every dialect (a native PG/MySQLTIMEcolumn already returns a time-of-day → no-op). Adds atimeFieldsregistry + registration mirroringdateFields/datetimeFields.Why not full canonicalization (write + filter)? That would impose a single canonical form #2004 deliberately left lenient and risk the field-zoo round-trip — out of proportion for this niche type. The narrow read-repair closes the actual gap without that cost.
Testing
@objectstack/driver-sql: 233 passed (+6 new insql-driver-time-of-day.test.ts: legacy full-timestamp repair, full-ISO repair, bare time-of-day untouched (field-zoo parity), NOW()-default reads a time-of-day, list-path parity, null).@objectstack/service-analytics: 164 passed (CRM cube time dimensions unaffected).Completes the temporal-field read normalization:
datetime→ canonical ISO-8601-Z,date→YYYY-MM-DD,time→ wall-clock time-of-day.🤖 Generated with Claude Code