diff --git a/chrono-tz-build/Cargo.toml b/chrono-tz-build/Cargo.toml index 17b5f03..7c9004c 100644 --- a/chrono-tz-build/Cargo.toml +++ b/chrono-tz-build/Cargo.toml @@ -6,12 +6,15 @@ rust-version = "1.60" description = "internal build script for chrono-tz" readme = "README.md" license = "MIT OR Apache-2.0" +keywords = ["script", "chrono-tz", "timezone", "iana"] +categories = ["development-tools::build-utils"] repository = "https://github.com/chronotope/chrono-tz" documentation = "https://docs.rs/chrono-tz-build" [features] filter-by-regex = ["regex"] case-insensitive = ["uncased", "phf/uncased"] +regex = ["dep:regex"] [dependencies] parse-zoneinfo = { version = "0.3" } diff --git a/chrono-tz/Cargo.toml b/chrono-tz/Cargo.toml index af97800..28e7ec4 100644 --- a/chrono-tz/Cargo.toml +++ b/chrono-tz/Cargo.toml @@ -5,7 +5,8 @@ edition = "2021" rust-version = "1.60" build = "build.rs" description = "TimeZone implementations for chrono from the IANA database" -keywords = ["date", "time", "timezone", "zone", "calendar"] +keywords = ["date", "time", "timezone", "zone", "iana"] +categories = ["date-and-time"] repository = "https://github.com/chronotope/chrono-tz" documentation = "https://docs.rs/chrono-tz" readme = "../README.md" @@ -29,8 +30,8 @@ include = [ [dependencies] arbitrary = { version = "1.2", optional = true, features = ["derive"] } -chrono = { version = "0.4.24", default-features = false } -serde = { version = "1", optional = true, default-features = false } +chrono = { version = "0.4.25", default-features = false } +serde = { version = "1.0.99", optional = true, default-features = false } phf = { version = "0.11", default-features = false } uncased = { version = "0.9", optional = true, default-features = false } diff --git a/chrono-tz/src/timezone_impl.rs b/chrono-tz/src/timezone_impl.rs index e6c35ee..4c1e3f4 100644 --- a/chrono-tz/src/timezone_impl.rs +++ b/chrono-tz/src/timezone_impl.rs @@ -328,7 +328,7 @@ impl TimeZone for Tz { // First search for a timespan that the local datetime falls into, then, if it exists, // check the two surrounding timespans (if they exist) to see if there is any ambiguity. fn offset_from_local_datetime(&self, local: &NaiveDateTime) -> LocalResult { - let timestamp = local.timestamp(); + let timestamp = local.and_utc().timestamp(); let timespans = self.timespans(); let index = binary_search(0, timespans.len(), |i| timespans.local_span(i).cmp(timestamp)); TzOffset::map_localresult( @@ -360,8 +360,8 @@ impl TimeZone for Tz { // Binary search for the required timespan. Any i64 is guaranteed to fall within // exactly one timespan, no matter what (so the `unwrap` is safe). - fn offset_from_utc_datetime(&self, utc: &NaiveDateTime) -> Self::Offset { - let timestamp = utc.timestamp(); + fn offset_from_utc_datetime(&self, dt: &NaiveDateTime) -> Self::Offset { + let timestamp = dt.and_utc().timestamp(); let timespans = self.timespans(); let index = binary_search(0, timespans.len(), |i| timespans.utc_span(i).cmp(timestamp)).unwrap(); diff --git a/chrono-tz/tests/check-regex-filtering/src/lib.rs b/chrono-tz/tests/check-regex-filtering/src/lib.rs index c8d169a..9db6010 100644 --- a/chrono-tz/tests/check-regex-filtering/src/lib.rs +++ b/chrono-tz/tests/check-regex-filtering/src/lib.rs @@ -19,7 +19,7 @@ mod tests { fn london_compiles() { // This line will be a compilation failure if the code generation // mistakenly excluded Europe::London. - let _london_time = London.ymd(2013, 12, 25).and_hms(14, 0, 0); + let _london_time = London.with_ymd_and_hms(2013, 12, 25, 14, 0, 0); assert_eq!("Europe/London", London.name()); // Since London is included, converting from the corresponding