-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Date fixes #3947
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
Merged
Merged
Date fixes #3947
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
621a840
Clean up docstrings (convert several single-quote string comments to …
pganssle 504044e
Small expansions to docstrings in the date library.
pganssle 390c1f4
Moved all the "magic numbers" into some centrally defined constants f…
pganssle 5af753c
Replace hard-coded conversion logic in _to_ordinalf with functions fr…
pganssle ee7931c
Make `from_ordinalf` use mostly functions from `datetime` for time co…
pganssle 4b0d94b
Fix issue causing failed builds.
pganssle ba623a7
Fix problem with inconsistent time zones. This now also fixes Issue #…
pganssle 9f66ae2
Didn't realize that `_to_ordinalf` needs to support datetime.date obj…
pganssle d61397d
PEP8 fix.
pganssle 0a5fbc6
Fix timezone issue, update code to coding standards.
pganssle 72ef748
Fix timezone problem, clarify docstring for timezones.
pganssle 7fd2d36
Fixed issue with `_to_ordinalf()`, should work fine now. Build will s…
pganssle 2f80916
Change behavior of `get_locator` to accurately calculate number of da…
pganssle ca284d1
Absolute value must apply to timedelta object as well as reslative de…
pganssle 68f3018
Adjust calculation of `numSeconds` and `numMicroseconds`, since the `…
pganssle 88e6e1e
Another adjustment to allow external libraries to do the calcs for us.
pganssle 0de1e84
Adjusted test_dates to account for the minor change in behavior of th…
pganssle f585a17
Adjusted rounding logic in `_from_ordinalf` to be consistent with pre…
2a0865b
Add alias for total_seconds() to support Python 2.6
f1f6d8f
Cleaner way to test for existence of `total_seconds()`.
46a4a0a
Tighten up `_total_seconds()` alias.
35b93d2
Support numpy arrays in DayLocator, WeekdayLocator and MonthLocator w…
ad55256
Modified strftime code so it only falls back to this other routine wh…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Adjusted test_dates to account for the minor change in behavior of th…
…e date locator. Signed-off-by: Paul G <p.ganssle@gmail.com>
- Loading branch information
commit 0de1e848635a497b116e154742b647ae7fe8524a
There are no files selected for viewing
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember talking about this before, but not the conclusion. Why is it OK that the tests were changed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tacaswell It's an expected (minor) behavior change caused by an increase in the accuracy of the way marker locations are calculated. I think the change was in this commit; previously if the beginning and end dates were January 3rd, 2000 and June 10th, 2015,
relativedelta
object returns(years=15, months=5, days=7)
, and whenget_locator()
is called, it calculated the number of days between the dates assuming that the number of days per year is 365 and the number of days per month is 30, so the number of days calculated would be 5632 rather than the true value of 5637.It's a small inaccuracy, but it's easy to fix by holding on to a
timedelta
object and using that when calculating days from years or months. As a result, some of the date range calculations are slightly different (though not to a degree that anyone would really notice), so at least one of the tests had to be updated (I vaguely remember updating one that was around 3 months and one that was around 3 weeks).(Oops, responded to this in the PR not the line)