Skip to content

improve Date.add and Date.sub - #392

Open
Joshix-1 wants to merge 10 commits into
printfn:mainfrom
Joshix-1:date-add-performance
Open

improve Date.add and Date.sub#392
Joshix-1 wants to merge 10 commits into
printfn:mainfrom
Joshix-1:date-add-performance

Conversation

@Joshix-1

@Joshix-1 Joshix-1 commented Aug 6, 2026

Copy link
Copy Markdown

Changes

builds on top of #391

  • Improve speed for both when adding many years worth of days/weeks
  • Date.add now works with the same units Date.sub supports
  • Prevent Year.prev and Year.next from wrapping around or panicing
  • add Year.add and Year.sub to more quickly advance by many months
  • fix panic/overflow when subbing too many years ("@1970-01-01 - (2^63) years" was 1970-01-01)
  • correctly display 2147483648 BC
  • add some more tests

Checklist

  • I used LLMs or similar AI tools when creating this pull request

Joshix-1 added 10 commits August 4, 2026 18:00
- Improve speed for both when adding many years worth of days/weeks
- Date.add now works with the same units Date.sub supports
- Prevent Year.prev and Year.next from wrapping around or panicing
- fix panic/overflow when subbing too many years ("@1970-01-01 - (2^63) years" was 1970-01-01)
- add some more tests
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