feat(core): time-add, time-before?, time-after?#132
Merged
Conversation
Calendar/duration arithmetic and ordering over the epoch-millisecond
ints that time-ms/time-format already use:
- (time-add ms {:years .. :months .. :days .. :hours .. :minutes ..
:seconds .. :milliseconds ..}) — years/months/days go through
time.AddDate (calendar-aware, overflow normalised like Go: Jan 31 +
1 month -> March 2); the rest add a fixed duration. Missing keys are
0, negatives shift backwards. Unknown key or non-integer value errors.
The deltas map is read, never mutated.
- (time-before? t1 t2) / (time-after? t1 t2) — strict ordering.
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.
Adds calendar/duration arithmetic and ordering over the epoch-millisecond ints that
time-ms/time-formatalready use.(time-add ms deltas)deltasis a hash-map;:years :months :daysare calendar-aware (viatime.AddDate, in UTC),:hours :minutes :seconds :millisecondsadd a fixed duration. Missing keys are0, negatives shift backwards. An unknown key or a non-integer value is a catchable error. The map is read, never mutated.Overflow normalises like Go's
AddDate(Jan 31 + 1 month → March 2, Feb 29 + 1 year → March 1) — documented on the builtin and covered by tests.(time-before? t1 t2)/(time-after? t1 t2)Strict ordering of two epoch-millisecond ints.
Docs (
docs.go, regeneratedLANGUAGE.md) and tests updated; both the untagged and-tags debuggersuites pass locally.🤖 Generated with Claude Code