feat(vm): Time/Date standard formatters — Time#iso8601/xmlschema/rfc2822/httpdate - #343
Merged
Conversation
Horodate: 2026-08-09 22:47 CEST WIP: adds the require "time" instance formatters to Time, built on the existing strftime engine (Date/DateTime already carried theirs via #340). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Horodate: 2026-08-09 22:53 CEST Time standard formatters lift passing to 12381; lock in at N-30. Co-Authored-By: Claude Opus 4.8 <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.
Horodate: 2026-08-09 22:54 CEST
What
Implements the deferred
require "time"instance formatters onTime, built on the VM's existing strftime engine (Date/DateTime already shipped theirs in #340):Time#iso8601(fraction_digits=0)and its aliasTime#xmlschema—%Y-%m-%dT%H:%M:%S, optional.NNNfractional part (n truncated digits), thenZfor a UTC instant or%:z(+HH:MM) for a fixed-offset one.Time#rfc2822/Time#rfc822—%a, %d %b %Y %H:%M:%S %z, where a UTC instant reports RFC 2822's-0000unknown-local-zone marker (MRI quirk), a fixed offset its+HHMM.Time#httpdate— the instant converted to GMT as%a, %d %b %Y %H:%M:%S GMT.Every output was verified byte-for-byte against
ruby 4.0.5(ruby -rtime -e …), including the UTC-Zvs+00:00distinction, the-0000vs+0000rfc2822 distinction, fraction-digit variants, and the httpdate GMT reconversion.Deferred (noted, not implemented)
Time.iso8601/Time.xmlschema/Time.rfc2822/Time.httpdate. MRI's are strict (each rejects the other formats withArgumentError), so they need real format-specific parsers rather than routing through the existing lenientTime.parse(gotime.ParseAny) — out of scope for a clean, 100%-coverable change.Time.parse/Time.strptimeare untouched.Time#rfc3339— does not exist in MRI (Time.respond_to?(:rfc3339)→ false;NoMethodErroron instances), so nothing to add. Date/DateTime already have#rfc3339.Verification
internal/vm/time_test.goasserting literal MRI outputs on fixed deterministic instants (UTC ++02:00++00:00, fraction variants).go test ./internal/vm -run TestTimegreen.GOWORK=off go test ./...— exit 0, no regressions.grep -vE '100.0%'minus the tolerated pre-existing partials) — empty;iso8601Str/rfc2822Str/httpdateStreach 100.0%.gofmt+go vet ./internal/vm/clean (pre-existing builtins.go delta untouched).🤖 Generated with Claude Code