-
Notifications
You must be signed in to change notification settings - Fork 527
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
Add a "DateDelta" datatype for differences in number of days #858
Conversation
This could potentially target |
Actually, upon re-reading this, I think the only thing I'd have to change is to leave |
Sorry, I've paged out my context on why we needed/wanted this as an addition. (If we want to do it, doing it on 0.4.x first seems like a great idea. Would also be nice to rewrite the commit message to have a shorter first line introduction.) |
Fair call - the main idea here is to have a proper return type for things like |
2f1eea5
to
10db47e
Compare
1678d91
to
f9c9f9a
Compare
Been thinking about this more. What if instead of all the |
This sounds reasonable to me. From the implementation, the only time What if we had the following functions: And then we would also not implement the |
Yeah, sounds good! I think I would go with |
f9c9f9a
to
2696485
Compare
* change Days to contain a u32 * changes to Iterator Implementations * minor docs fixes * add days_since function
2696485
to
04207e3
Compare
Had another thought of just using |
What's the point of changing from |
This was originally combined with the work in d086ca9 and in the implementations of |
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.
Please add attribute #[must_use]
to new and modified functions.
@@ -2673,22 +2724,22 @@ mod tests { | |||
assert_eq!(lhs.checked_add_days(rhs), sum); | |||
} | |||
|
|||
check((2014, 1, 1), Days::new(0), Some((2014, 1, 1))); | |||
check((2014, 1, 1), Days::from_u32(0), Some((2014, 1, 1))); |
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.
For backwards compatibility checks, could you add some tests cases (or statements within a test case) to compare Days::new
and Days::from_u32
result in the same values?
I know new
is the "old way", but wouldn't hurt to make sure it's still working.
change Days to take a u32 and addition of DaysDelta to NaiveDate, changes to Iterator Implementations
This has been separated out from #824