-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix out of range panics in DateTime
getters and setters
#1317
Fix out of range panics in DateTime
getters and setters
#1317
Conversation
Codecov Report
@@ Coverage Diff @@
## 0.4.x #1317 +/- ##
==========================================
+ Coverage 91.25% 91.50% +0.25%
==========================================
Files 38 38
Lines 17164 17310 +146
==========================================
+ Hits 15663 15840 +177
+ Misses 1501 1470 -31
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
This does not yet fix the |
bdc574a
to
90e2607
Compare
This fixes out-of-range panics in all the `with_*` methods that use `map_local`.
90e2607
to
e002ce9
Compare
Split out from #1048.
This PR only fixes the first group of methods: those that panic on an intermediate value, but should be able to return a meaningful result. This includes formatting, and getters and setters of the
Datelike
andTimelike
traits.I made
MIN_YEAR
andMAX_YEAR
1 year smaller to have some buffer space.DateTime::overflowing_naive_local
andNaiveDateTime::overflowing_add_offset
are added to create a value in that buffer space.The rest of the PR consists of just using these methods and adding tests.