Skip to content
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

Implement start_of_* and end_of_* APIs #383

Closed
liquidscorpio opened this issue Jan 4, 2020 · 2 comments
Closed

Implement start_of_* and end_of_* APIs #383

liquidscorpio opened this issue Jan 4, 2020 · 2 comments

Comments

@liquidscorpio
Copy link

Context

Back in 2015, a similar request for a date transition API was closed. I wish to re-open conversation for a more generalized API for the same. Such APIs are utilized extensively in time-series & analytical workloads and with chrono almost being the canonical date-time crate for Rust, there is value to be had by having such APIs within the library.

I am already building this and would like put forth a PR for the same. In the meanwhile, checking if the stance of the team on the issue has changed?

Public Interface

Support for following methods on a NaiveDate instance for the following APIs:

start_of_year() // Transforms 2019-07-12 to 2019-01-01
end_of_year() // Transforms 2019-07-12 to 2019-31-12
start_of_month()  // Transforms 2019-07-12 to 2019-07-01
end_of_month()  // Transforms 2019-07-12 to 2019-07-31
start_of_week()   // Transforms 2019-07-12 to 2019-07-08
end_of_week() // Transforms 2019-07-12 to 2019-07-14

All the APIs can also have start_of_pred_* / end_of_pred_* / start_of_succ_* / end_of_succ_* keeping things consistent.

While I am explicitly referring to NaiveDate, other structs can also be considered one at a time.

@quodlibetor
Copy link
Contributor

Yes, the stance has changed, I would love a PR for this!

@liquidscorpio
Copy link
Author

Work relating to this have been moved to a new crate.
See: #385 (comment) for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants