Skip to content

Preserve escaped timezone directives in strftime - #54

Open
OskarEichler wants to merge 3 commits into
floraison:masterfrom
OskarEichler:codex/preserve-escaped-timezone-directives
Open

Preserve escaped timezone directives in strftime#54
OskarEichler wants to merge 3 commits into
floraison:masterfrom
OskarEichler:codex/preserve-escaped-timezone-directives

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Recognize %% escapes before expanding timezone directives. The current regular expression matches the second percent in %%Z, so a literal directive is replaced and then misinterpreted by Ruby's strftime.

Reproduction

For an EoTime in Asia/Kolkata:

  • strftime("%%Z %%z %%:z %%::z %%/Z") now returns the literal "%Z %z %:z %::z %/Z".
  • Checked mixed escaped/unescaped directives, including %%%Z and %%%%z.
  • Unescaped timezone directives retain the existing library-specific formats.

Verification

  • Ruby 4.0.6 via rbenv; existing Probatio suite, no test files added or modified.
  • Reviewed master baseline and this individual patch each run 270 tests / 412 assertions with exactly the same three pre-existing DST/rday failures from rday / rweek calculation is odd in time zones with DST #51. Failure identities were compared, not just counts.
  • A release-based 1.4.1 branch containing the five separately proposed fixes passes 263 existing tests / 405 assertions with TZInfo 2.0.6 in UTC, Asia/Tokyo, America/Chicago, Europe/Istanbul and the detected local zone.
  • Temporary focused before/after reproductions pass with TZInfo 2.0.6 and 1.2.11. The combined release branch also passes the existing TZInfo 1.2.11 suite at seed 36231. Seed 99751 has the same pre-existing Zulu test-order failure on both unmodified release and patched release: a test mutates the cached TZInfo object's comparison method.
  • Ruby syntax and gem packaging checks pass. Targeted Lint passes on the combined branch with the existing, unrelated AssignmentInCondition warning excluded; no lint configuration was changed.

The current master's unreleased day-delta change was not brought into the consumer branch. No live scheduler or production operations were used. Linux/Windows and other Ruby runtimes were not run locally.

Breaking changes and limitations

No intended breaking change. Escaped percent signs now follow strftime's literal-percent semantics. This does not redefine UTC formatting, timezone flag/width support, or second-resolution offsets. No overlapping current fix was found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant