Skip to content

Commit

Permalink
0.4.0: Mass renaming, IsoWeek, SystemTime supports, serde utils.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lifthrasiir committed Jun 21, 2017
1 parent 136302c commit fe529c8
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 2 deletions.
83 changes: 83 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<Tz>` 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<Utc>` and `DateTime<Local>` 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
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
11 changes: 10 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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`:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/naive/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down

0 comments on commit fe529c8

Please sign in to comment.