-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
[Maybe breaking change] Fix day of year computation #273
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
09617e2
[TDD] Add regression test for #272
ChristopherRabotin b731d18
Merge branch 'master' into 272-returns-wrong-day-of-year
ChristopherRabotin 39412e5
Breaking: fix day of year computation
ChristopherRabotin a16a0a0
Simplify computation for year() of Epoch
ChristopherRabotin 5de6fc4
Add absurd_extreme_comparisons to duration calculation because it's a…
ChristopherRabotin c63713e
Re-add feature std gate on fmt test
ChristopherRabotin e3df1de
Version bump to 3.9.0
ChristopherRabotin 401b9c9
Add tests by @gwbres
ChristopherRabotin 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
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "hifitime" | ||
version = "3.8.7" | ||
version = "3.9.0" | ||
authors = ["Christopher Rabotin <[email protected]>"] | ||
description = "Ultra-precise date and time handling in Rust for scientific applications with leap second support" | ||
homepage = "https://nyxspace.com/" | ||
|
This file contains 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,7 +90,7 @@ const MAX_TOKENS: usize = 16; | |
/// assert_eq!(fmt, consts::ISO8601_ORDINAL); | ||
/// | ||
/// let fmt_iso_ord = Formatter::new(bday, consts::ISO8601_ORDINAL); | ||
/// assert_eq!(format!("{fmt_iso_ord}"), "2000-059"); | ||
/// assert_eq!(format!("{fmt_iso_ord}"), "2000-060"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Behavior change introduced by this PR. |
||
/// | ||
/// let fmt = Format::from_str("%A, %d %B %Y %H:%M:%S").unwrap(); | ||
/// assert_eq!(fmt, consts::RFC2822_LONG); | ||
|
@@ -549,7 +549,16 @@ fn epoch_format_from_str() { | |
#[cfg(feature = "std")] | ||
#[test] | ||
fn gh_248_regression() { | ||
/* | ||
Update on 2023-12-30 to match the Python behavior: | ||
|
||
>>> from datetime import datetime | ||
>>> dt, fmt = "2023-117T12:55:26", "%Y-%jT%H:%M:%S" | ||
>>> datetime.strptime(dt, fmt) | ||
datetime.datetime(2023, 4, 27, 12, 55, 26) | ||
*/ | ||
|
||
let e = Epoch::from_format_str("2023-117T12:55:26", "%Y-%jT%H:%M:%S").unwrap(); | ||
|
||
assert_eq!(format!("{e}"), "2023-04-28T12:55:26 UTC"); | ||
assert_eq!(format!("{e}"), "2023-04-27T12:55:26 UTC"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now matches Python as per the comment. |
||
} |
This file contains 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 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
Oops, something went wrong.
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.
Prevent what clippy said was useless but actually required.