Implement [ZN] timezone name modifier for format-dateTime#6092
Open
joewiz wants to merge 1 commit intoeXist-db:developfrom
Open
Implement [ZN] timezone name modifier for format-dateTime#6092joewiz wants to merge 1 commit intoeXist-db:developfrom
joewiz wants to merge 1 commit intoeXist-db:developfrom
Conversation
duncdrum
approved these changes
Mar 3, 2026
Implement the [ZN] presentation modifier for the Z timezone component in format-dateTime, format-date, and format-time, per the W3C XPath Functions 3.1 spec (section 9.8.4.7). Changes to FnFormatDates.java: - When $place is a recognized IANA timezone name (e.g., "America/New_York"), adjust the datetime to the applicable timezone offset before formatting, taking daylight savings time into account. This affects all components (H, M, Z, etc.), not just the timezone display. - Implement formatTimeZoneName() for the [ZN] modifier: uses java.time DateTimeFormatter to resolve timezone abbreviations (e.g., "EST", "EDT"), with a generic offset-based lookup preferring shorter abbreviations (e.g., "HST" over "HAST"), a fallback to well-known legacy abbreviation IDs (e.g., "IST" for +05:30 which CLDR doesn't abbreviate), and a final numeric fallback (e.g., "+13:00"). - Support [Zn] (lowercase) and [ZNn] (title case) variants. Changes to format-dates.xql: - Remove 11 %test:pending annotations for [ZN] tests. - Fix incorrect test expectations for $place="America/New_York" tests: the original tests had wrong time values (place only affects Z component) and wrong timezone names (EST instead of EDT for June dates). Corrected to show datetime adjusted to NY timezone with EDT. The $place timezone adjustment approach is similar to the one used by BaseX (BSD 3-Clause license). Closes eXist-db#1024 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d6f7075 to
46a9735
Compare
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.
Summary
[ZN]presentation modifier for theZtimezone component informat-dateTime/format-date/format-time, per the W3C XPath Functions 3.1 spec (section 9.8.4.7)$placeis a recognized IANA timezone name (e.g.,America/New_York), adjust the datetime to the applicable timezone offset before formatting, taking daylight savings time into account — this affects all components (H,M,Z, etc.), per the spec: "the date or time being formatted is adjusted to the timezone offset applicable in that timezone"java.time.DateTimeFormatter, with fallbacks for CLDR gaps (e.g.,ISTfor+05:30) and a final numeric fallback (e.g.,+13:00)[Zn](lowercase) and[ZNn](title case) variants%test:pendingannotations and fix incorrect test expectationsThe
$placetimezone adjustment approach is similar to the one used by BaseX (BSD 3-Clause license).Closes #1024
Test plan
format-dates.xqltest suite: 121/121 pass (0 failures)fn-format-dateTime: 53/78 pass (25 pre-existing failures unrelated to[ZN])fn-format-date: 52/95 pass (43 pre-existing failures)fn-format-time: 25/37 pass (12 pre-existing failures)🤖 Generated with Claude Code