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

Deprecated from_timestamp method used in example for DateTime #931

Closed
greg-el opened this issue Jan 5, 2023 · 2 comments
Closed

Deprecated from_timestamp method used in example for DateTime #931

greg-el opened this issue Jan 5, 2023 · 2 comments

Comments

@greg-el
Copy link
Contributor

greg-el commented Jan 5, 2023

The example given in https://docs.rs/chrono/latest/chrono/struct.DateTime.html#example appears to use the deprecated from_timestamp:

warning: use of deprecated associated function `chrono::NaiveDateTime::from_timestamp`: use `from_timestamp_opt()` instead
  --> src/main.rs:60:60
   |
60 |             date: DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp(61, 0), Utc),
   |                                                            ^^^^^^^^^^^^^^
   |
   = note: `#[warn(deprecated)]` on by default

I figure this should be as simple as replacing NaiveDateTime::from_timestamp(61, 0) with NaiveDateTime::from_timestamp_opt(61, 0).unwrap(), happy to open a PR to do so!

@greg-el greg-el changed the title Deprecated from_timestamp method used in example for NaiveDateTime Deprecated from_timestamp method used in example for NaiveDateTime Jan 5, 2023
@greg-el greg-el changed the title Deprecated from_timestamp method used in example for NaiveDateTime Deprecated from_timestamp method used in example for DateTime Jan 5, 2023
@djc
Copy link
Member

djc commented Jan 5, 2023

Would be great to have a PR for this! Be sure to target the 0.4.x branch, thanks!

@pitdicker
Copy link
Collaborator

This issue is fixed by #939.

@djc djc closed this as completed Apr 22, 2023
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

No branches or pull requests

3 participants