Serialize years above 9999 without chrono's leading '+'#157
Open
ajbufort wants to merge 1 commit into
Open
Conversation
string(xs:dateTime("10000-01-01T00:00:00Z")) produced
"+10000-01-01T00:00:00Z": chrono's %Y switches to a signed
representation for years above 9999, which is not part of XSD's
lexical space. The engine's own cast rejected its own output, so
xs:dateTime(string(xs:dateTime("10000-01-01T00:00:00Z"))) raised
FORG0001.
Write the year manually in canonical_date_time,
canonical_date_time_stamp and canonical_date through a
push_canonical_year helper, mirroring what canonical_g_year and
canonical_g_year_month already did. Negative years and year 0000 keep
their existing, already-canonical forms, pinned by tests along with
the round trip through the engine's own cast.
Fixes Paligo#153
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Fixes #153.
string(xs:dateTime("10000-01-01T00:00:00Z"))produced"+10000-01-01T00:00:00Z"- chrono's%Yswitches to a signed, ISO-8601-expanded representation for years above 9999, which is not valid XSD lexical form. The engine's own cast rejected its own output:xs:dateTime(string(xs:dateTime("10000-01-01T00:00:00Z")))raisedFORG0001.The fix writes the year manually in
canonical_date_time,canonical_date_time_stamp, andcanonical_datevia a smallpush_canonical_yearhelper, mirroring whatcanonical_g_year/canonical_g_year_monthalready did (those were unaffected). Negative years and year0000keep their existing (already-canonical) forms, pinned by tests.Testing
xee-xpath/tests/canonical_years.rs: the three affected types serialize five-digit years without+, the round trip through the engine's own cast now succeeds, and the already-correct forms (negative years, year 0000,xs:gYear) are pinnedcargo fmt,clippy --all-targets --all-features -- -D warnings, workspacecargo test, and both conformance suites with no regressions (XPath verified in release and debug mode, as CI runs it)Generated with Claude Code