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

Add DateTime::<Utc>::from_timestamp_opt #1278

Closed

Commits on Sep 10, 2023

  1. Add DateTime::<Utc>::from_timestamp_opt

    This commit adds the new constructor `from_timestamp_opt` to build a `DateTime<Utc>` from a UNIX timestamp.
    
    Figuring out how to convert a timestamp into a `DateTime<Utc>` was a common issue:
    - chronotope#88
    - chronotope#200
    - chronotope#832
    
    This commit should make `DateTime<Utc>` creation more discoverable and intuitive.
    
    This commit respects the current convention of using the `_opt` suffix for fallible functions. As panicking variants on invalid input are deprecated, no panicking variant is provided. See [this issue](chronotope#815) for discussion about error handling and panics.
    
    Closes chronotope#832
    demurgos committed Sep 10, 2023
    Configuration menu
    Copy the full SHA
    990a4e3 View commit details
    Browse the repository at this point in the history