From fe529c801609ea1063d901a17adba229682405ab Mon Sep 17 00:00:00 2001 From: Kang Seonghoon Date: Thu, 22 Jun 2017 02:54:26 +0900 Subject: [PATCH] 0.4.0: Mass renaming, `IsoWeek`, `SystemTime` supports, serde utils. Starting from this version the `CHANGELOG.md` file is the canonical source for the list of significant changes. See the file for details. Fixes #146. Fixes #159. --- CHANGELOG.md | 83 +++++++++++++++++++++++++++++++++++++++++++++++ README.md | 9 +++++ src/lib.rs | 11 ++++++- src/naive/time.rs | 2 +- 4 files changed, 103 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30b7381e77..f27646d32a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,89 @@ Chrono obeys the principle of [Semantic Versioning](http://semver.org/). There were/are numerous minor versions before 1.0 due to the language changes. Versions with only mechnical changes will be omitted from the following list. +## 0.4.0 (2017-06-22) + +This was originally planned as a minor release but was pushed to a major release +due to the compatibility concern raised. + +### Added + +- `IsoWeek` has been added for the ISO week without time zone. + +- The `+=` and `-=` operators against `time::Duration` are now supported for + `NaiveDate`, `NaiveTime` and `NaiveDateTime`. (#99) + + (Note that this does not invalidate the eventual deprecation of `time::Duration`.) + +- `SystemTime` and `DateTime` types can be now converted to each other via `From`. + Due to the obvious lack of time zone information in `SystemTime`, + the forward direction is limited to `DateTime` and `DateTime` only. + +### Changed + +- Intermediate implementation modules have been flattened (#161), + and `UTC` has been renamed to `Utc` in accordance with the current convention (#148). + + The full list of changes is as follows: + + Before | After + ---------------------------------------- | ---------------------------- + `chrono::date::Date` | `chrono::Date` + `chrono::date::MIN` | `chrono::MIN_DATE` + `chrono::date::MAX` | `chrono::MAX_DATE` + `chrono::datetime::DateTime` | `chrono::DateTime` + `chrono::naive::time::NaiveTime` | `chrono::naive::NaiveTime` + `chrono::naive::date::NaiveDate` | `chrono::naive::NaiveDate` + `chrono::naive::date::MIN` | `chrono::naive::MIN_DATE` + `chrono::naive::date::MAX` | `chrono::naive::MAX_DATE` + `chrono::naive::datetime::NaiveDateTime` | `chrono::naive::NaiveDateTime` + `chrono::offset::utc::UTC` | `chrono::offset::Utc` + `chrono::offset::fixed::FixedOffset` | `chrono::offset::FixedOffset` + `chrono::offset::local::Local` | `chrono::offset::Local` + `chrono::format::parsed::Parsed` | `chrono::format::Parsed` + + With an exception of `Utc`, this change does not affect any direct usage of + `chrono::*` or `chrono::prelude::*` types. + +- `Datelike::isoweekdate` is replaced by `Datelike::iso_week` which only returns the ISO week. + + The original method used to return a tuple of year number, week number and day of the week, + but this duplicated the `Datelike::weekday` method and it had been hard to deal with + the raw year and week number for the ISO week date. + This change isolates any logic and API for the week date into a separate type. + +- `NaiveDateTime` and `DateTime` can now be deserialized from an integral UNIX timestamp. (#125) + + This turns out to be very common input for web-related usages. + The existing string representation is still supported as well. + +- `chrono::serde` and `chrono::naive::serde` modules have been added + for the serialization utilities. (#125) + + Currently they contain the `ts_seconds` modules that can be used to + serialize `NaiveDateTime` and `DateTime` values into an integral UNIX timestamp. + This can be combined with Serde's `[de]serialize_with` attributes + to fully support the (de)serialization to/from the timestamp. + + For rustc-serialize, there are separate `chrono::TsSeconds` and `chrono::naive::TsSeconds` types + that are newtype wrappers implementing different (de)serialization logics. + This is a suboptimal API, however, and it is strongly recommended to migrate to Serde. + +### Fixed + +- The major version was made to fix the broken Serde dependency issues. (#146, #156, #158, #159) + + The original intention to technically break the dependency was + to faciliate the use of Serde 1.0 at the expense of temporary breakage. + Whether this was appropriate or not is quite debatable, + but it became clear that there are several high-profile crates requiring Serde 0.9 + and it is not feasible to force them to use Serde 1.0 anyway. + + To the end, the new major release was made with some known lower-priority breaking changes. + 0.3.1 is now yanked and any remaining 0.3 users can safely roll back to 0.3.0. + +- Various documentation fixes and goodies. (#92, #131, #136) + ## 0.3.1 (2017-05-02) ### Added diff --git a/README.md b/README.md index ecf58522fd..0eca0e6648 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,9 @@ which Chrono builds upon and should acknowledge: * Dietrich Epp's [datetime-rs](https://github.com/depp/datetime-rs) * Luis de Bethencourt's [rust-datetime](https://github.com/luisbg/rust-datetime) +Any significant changes to Chrono are documented in +the [`CHANGELOG.md`](https://github.com/chronotope/chrono/blob/master/CHANGELOG.md) file. + ## Usage @@ -52,6 +55,12 @@ include the features like this: chrono = { version = "0.4", features = ["serde", "rustc-serialize"] } ``` +> Note that Chrono's support for rustc-serialize is now considered deprecated. +Starting from 0.4.0 there is no further guarantee that +the features available in Serde will be also available to rustc-serialize, +and the support can be removed in any future major version. +**Rustc-serialize users are strongly recommended to migrate to Serde.** + Then put this in your crate root: ```rust diff --git a/src/lib.rs b/src/lib.rs index cd68892c71..2606e43d0d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,7 @@ // This is a part of Chrono. // See README.md and LICENSE.txt for details. -//! # Chrono 0.4.0 (not yet released) +//! # Chrono 0.4.0 //! //! Date and time handling for Rust. //! It aims to be a feature-complete superset of @@ -20,6 +20,9 @@ //! * Dietrich Epp's [datetime-rs](https://github.com/depp/datetime-rs) //! * Luis de Bethencourt's [rust-datetime](https://github.com/luisbg/rust-datetime) //! +//! Any significant changes to Chrono are documented in +//! the [`CHANGELOG.md`](https://github.com/chronotope/chrono/blob/master/CHANGELOG.md) file. +//! //! ## Usage //! //! Put this in your `Cargo.toml`: @@ -38,6 +41,12 @@ //! chrono = { version = "0.4", features = ["serde", "rustc-serialize"] } //! ``` //! +//! > Note that Chrono's support for rustc-serialize is now considered deprecated. +//! Starting from 0.4.0 there is no further guarantee that +//! the features available in Serde will be also available to rustc-serialize, +//! and the support can be removed in any future major version. +//! **Rustc-serialize users are strongly recommended to migrate to Serde.** +//! //! Then put this in your crate root: //! //! ```rust diff --git a/src/naive/time.rs b/src/naive/time.rs index 0785b9f621..2ded525af9 100644 --- a/src/naive/time.rs +++ b/src/naive/time.rs @@ -46,7 +46,7 @@ use format::{parse, Parsed, ParseError, ParseResult, DelayedFormat, StrftimeItem /// If you cannot tolerate this behavior, /// you must use a separate `TimeZone` for the International Atomic Time (TAI). /// TAI is like UTC but has no leap seconds, and thus slightly differs from UTC. -/// Chrono 0.3 does not provide such implementation, but it is planned for 0.4. +/// Chrono does not yet provide such implementation, but it is planned. /// /// ## Representing Leap Seconds ///