-
Notifications
You must be signed in to change notification settings - Fork 546
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
Feature request: Add a Period
data structure
#380
Comments
Sounds interesting! Have you thought about the public API interface of the feature? If yes, would it be possible for you to share the same? |
Yes, a If you feel like putting in-progress work up I would be happy to review/collaborate on it before it's ready for inclusion. |
Yes. For my purposes, a https://docs.rs/chrono_period/0.1.0/chrono_period/struct.NaivePeriod.html Right now, I've only added the method implementations for
So My implementation actually uses two
Sure, I can certainly do that. I originally added it as a new |
Looks pretty neat! I am in need of something similar and going to explore if I can build off your work here. |
A NaivePeriod covers the period of time between two NaiveDateTime(s), inclusive. This data structure can be used to intersect two NaivePeriods to determine if they overlap. This is in partial fulfillment of chronotope#380, but does not provide necessary code to handle DateTime objects (with offsets). Refs chronotope#380.
@liquidscorpio @quodlibetor I've created #384 as a starting point. Would you mind giving feedback on the code and what you think it needs to be included? |
A
Period
data structure is similar to aDuration
, except that it has a specific start date. For example, one might have a period of 21 days, starting from January 1, 2020, which would have a start date/time of2020-01-01 00:00:00
and an end date/time of2020-01-22 00:00:00
. (Obviously, these don't have timezones/offsets, so they are more likely to beNaivePeriod
objects.I am working on an implementation for this in a branch of chrono. The reason I am thinking this might be useful within the chrono library itself is that, given a
NaivePeriod
object, we can then determine if there is overlap with anotherNaivePeriod
, or whether it contains aNaiveDateTime
. I personally am working on a scheduling app, and thus this is a useful use case for me. That said, I'm not sure it belongs within the chrono library - perhaps a separate, add-on library would be more useful.Thanks for your feedback!
The text was updated successfully, but these errors were encountered: