chrono
chrono copied to clipboard
Date and time library for Rust
This example is documented as failing when parsing a `NaiveDate`: ```rust assert!(parse_from_str("2015/9", "%Y/%m").is_err()); ``` However, it would be more useful if unspecified fields defaulted to the lowest valid value. This...
# Steps to Reproduce Run the following code ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=7d68c09621c2a8ccbd9d8a06722edbec)) ```rust use std::str::FromStr; use chrono::{DateTime, Utc}; fn main() { let max_dt = chrono::MAX_DATETIME; let str = max_dt.to_rfc3339(); // This works fine...
Function [`chrono::Local.datetime_from_str`](https://docs.rs/chrono/0.4.9/chrono/offset/trait.TimeZone.html#method.datetime_from_str) ignores leading or trailing whitespace in the passed variable `fmt`. [Given code](https://play.rust-lang.org/?version=beta&mode=debug&edition=2021&gist=53b8ea30e3f6f1477e994f09d7dbba70) ```rust extern crate chrono; use chrono::{Local, TimeZone}; fn main() { let a = Local.datetime_from_str("2000-01-01 02:03:01", "%Y-%m-%d...
#661 was just merged however the stubs implementation doesn't seem to have changed `pub` to `pub(super)` causing the following on the `wasm32-unknown-emscripten` target: ``` error[E0446]: crate-private type `Tm` in public...
Hello and thank you for this useful crate :+1: According to RFC3339 https://datatracker.ietf.org/doc/html/rfc3339#section-5 Months should be zero-padded to the left for up to 2 digits. Current stable version 0.4.19 will...
Just like in #318, this sample code can be used to explain the problem. ```rust use chrono::NaiveDateTime; use chrono::TimeZone; use chrono::{DateTime, Duration}; use chrono_tz::US::Eastern; use chrono_tz::Tz; fn main() { let...
In GTFS, arrival time at stops is indicated as seconds from midnight. In this case, to generate the correct DateTime in chrono, I had to do ``` Local::today().and_hms((*arrival.0)/3600, (*arrival.0/60)%60, *arrival.0%60)...
utc_tm_to_time isn't memory-safe on nacl/solaris/illumos targets because it uses `std::env::set_var`
As discussed in #499, `std::env::set_var` isn't memory-safe, and should not be used. The code in question is https://github.com/chronotope/chrono/blob/3467172c31188006147585f6ed3727629d642fed/src/sys/unix.rs#L55-L75 I don't know of a good solution but we should have a...
Hello. I have a problem with chrono on CI runner (Permission Denied), on local PC is ok. **Example code:** ``` // let ts_option : Option = ... (any code) let...
I have the following Date string: ``` "2020-04-12 22:10 ACST" ``` And I do the following: ```rust let datetime = chrono::DateTime::parse_from_str(date_str, "%Y-%m-%d %H:%M %Z").unwrap(); ``` And I get a panic:...