feat(form): native date, time and date-time fields - #680
Open
kozmaadrian wants to merge 5 commits into
Open
Conversation
Single form-date component parameterized by type, wrapping a native <input> (date / time / datetime-local). Stores date as YYYY-MM-DD and time as HH:MM (floating), and date-time as canonical UTC (...:00Z), converting the author's local wall-clock to UTC on save and back to the viewer's local zone on load. Minute-rounds to keep pre-1900 (Local Mean Time) values canonical, and 4-digit-pads early-CE years.
Map schema format (date | time | date-time) to the form-date widget type, and add form-date to the editor's field-spacing rules so date fields align with the other fields.
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.
TODO
da-sc-sdkwith date/time format validation PR and re-vendor the published version — this PR currently vendors a dev build of the SDK innx/deps/da-sc-sdk/dist/. The SDK source changes (format extraction, value-shape validation, docs) live on a separateda-sc-sdkbranch.Summary
Adds native date, time, and date-time field support to the SC form editor, driven entirely by the JSON Schema
formatkeyword. A singleform-datecomponent wraps the browser's native<input>(date/time/datetime-local), so authors get real pickers and keyboard entry — including on mobile — instead of a plain text box.Test URL: https://da.live/form?nx=formdate#/exp-workspace/frescopa/forms/date-input-test
Before: the time, date, and date-time inputs are simply text inputs.
After: the time, date, and date-time fields use native HTML input elements.
format: date (floating date)

format: date-time (the UI displays the users local time, however saves the same time in UTC always)

format: time (float time, no timezone)

How it works
The editor maps the schema
formatto one parameterized component:formatdatedateYYYY-MM-DD(floating, no timezone)timetimeHH:MM(floating, no timezone)date-timedatetime-localYYYY-MM-DDTHH:MM:00Z(absolute instant, UTC)date/timeare floating — they mean the same everywhere (a publish date, store opening hours).date-timeis store-UTC / display-local — the picker shows and edits the value in the viewer's local zone and converts back to UTC on save, so the instant stays stable no matter which zone an author edits from.Validation
Validation is owned by the SDK (the trust boundary — a script writing directly can't bypass it), not the widget:
date/timeare checked for real calendar/clock validity (2026-02-30,24:00are rejected).date-timeis deliberately stricter than RFC 3339: only UTCZwith zero seconds is accepted, so the editor and any SDK-only writer produce one identical, comparable value (offsets, non-zero seconds, and sub-minute precision are rejected).formatis not enforced on an empty value.Edge cases
Compatibility
format: date | time | date-timenow render as pickers and get validated. Existing documents whose values aren't canonical (especially date-times with an offset or non-zero seconds) would surface a validation error, so it's worth a quick audit of existing date-time data. Validation is not gated on save, so this surfaces an error rather than blocking.Testing