-
Notifications
You must be signed in to change notification settings - Fork 554
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
Supporting normalising dates/times #1416
Comments
Okay, here's what I ended up with. It's not the worst, but a helper function would still be appreciated:
|
Other than trying to come up with an exact match for |
I'm porting a library from C to Rust which basically wraps timegm. I have to normalise the dates or I don't pass the unit tests. Rejecting invalid dates like the _opt functions probably does make more sense, but the API isn't up to me. That said, my code seems to be working, so if you want you can just close this feature request. Using libc's wrapper of timegm would be another option (albeit it's an unsafe function.) |
It sounds like #1290 might address your use case? |
I'm porting code which makes use of the normalisation features of C's
timegm
)I couldn't see anything in the current Chrono API which looks suitable for this, though it looks like I could manually do it by calling
checked_add_months
,checked_add_days
, etc (though as negative values are possible I'd need to test and call thesub
functions too.)Is there a part of the API that I missed, or does anyone know of another Rust library that can handle this?
The text was updated successfully, but these errors were encountered: