And fail CI in the future if `make readme` isn't run when it is needed.
CC conversation in #185, where the README didn't get updated for a year after
lib.rs was improved.
Unfortunately due to rust-lang/rust#39935 placing the annotation on the `impl`s
of `Encodable`/`Decodable` for the various items have no effect whatsoever, so
we need to place it on some type that chrono actually uses internally. The only
*type* that I can find that only exists for rustc-serialize only is the
`TsSeconds` struct.
So, marking TsSeconds deprecated causes Chrono's internal uses of `TsSeconds`
to emit deprecation warnings, both in our builds and for packages that specify
Chrono as a dependency with the `rustc-serialize` feature active. This means
that the current commit will cause a `warning: use of deprecated item:
RustcSerialize will be removed before chrono 1.0, use Serde instead` to appear
in `cargo build` output.
Unfortunately I don't think that it's possible for downstream crates to disable
the warning the warning in any way other than actually switching to Serde or
using an older chrono. That's the reason for all the `#[allow(deprecated)]`
through the code, it means that the warning appears almost exactly once,
instead of dozens of times.
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.
There used to be multiple modules like `chrono::datetime` which only
provide a single type `DateTime`. In retrospect, this module structure
never reflected how people use those types; with the release of 0.3.0
`chrono::prelude` is a preferred way to glob-import types, and due to
reexports `chrono::DateTime` and likes are also common enough.
Therefore this commit removes those implementation modules and
flattens the module structure. Specifically:
Before After
---------------------------------- ----------------------------
chrono:📅:Date chrono::Date
chrono:📅:MIN chrono::MIN_DATE
chrono:📅:MAX chrono::MAX_DATE
chrono::datetime::DateTime chrono::DateTime
chrono::datetime::TsSeconds chrono::TsSeconds
chrono::datetime::serde::* chrono::serde::*
chrono::naive::time::NaiveTime chrono::naive::NaiveTime
chrono::naive:📅:NaiveDate chrono::naive::NaiveDate
chrono::naive:📅:MIN chrono::naive::MIN_DATE
chrono::naive:📅:MAX chrono::naive::MAX_DATE
chrono::naive::datetime::NaiveDateTime
chrono::naive::NaiveDateTime
chrono::naive::datetime::TsSeconds chrono::naive::TsSeconds
chrono::naive::datetime::serde::* chrono::naive::serde::*
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
All internal documentation links have been updated (phew!) and
verified with LinkChecker [1]. Probably we can automate this check
in the future.
[1] https://wummel.github.io/linkchecker/Closes#161. Compared to the original proposal, `chrono::naive` is
retained as we had `TsSeconds` types duplicated for `NaiveDateTime`
and `DateTime` (legitimately).
So this is a much delayed major release, but this should not really
change how you use Chrono---only the "required" breakages have been
done (e.g. anything hindering API evolution). The "big" release used to
be 0.3, but due to the dependency changes we are forced to push that to
0.4. I've took this opportunity to push all known planned breaking
changes to 0.3, so this should be quite stable for a moment.
See `CHANGELOG.md` for the full list of changes, but most importantly:
- `chrono::prelude` module has been added for proper glob imports.
- `FixedOffset` is now the official "value" type for time zone offsets.
- Serde 0.9 support has landed, and serialization format used by
rustc-serialize and Serde has been now synchronized.
- Formatting items have been slightly adjusted to be future-proof.
Fixes#126.
- Formatting item types are no longer `Copy`.
- `Numeric` and `Fixed` items now have `Internal` variants reserved
for the future expansion. It had been hard to expand the items
without totally breaking the backward compatibility (as per
the API evolution guideline of RFC 1105).
- `Item::Owned{Literal,Space}` for the owned variant of
`Item::{Literal,Space}` has been added.
Closes#76.
Due to the backward compatibility we won't be going to remove support
for `time::Duration` in 0.3, and the initial 0.3.0 release won't have
proper `std::time::Duration` support (haven't finalized the logics).
However we will reserve proper names and signatures for the upcoming
`std::time::Duration` support---the "older" duration type will be
referred as "signed" in the names.
- Added a `chrono::prelude` module. This does not have the (old)
`Duration` type reexported, so the documentation has now correctly
replaced all occurrences of `chrono::Duration`. The existing
`chrono::Duration` reexport itself remains for the compatibility.
- Avoided using a plain `Duration` type in the signature, to avoid
any ambiguity.
- Renamed `checked_{add,sub}` to `checked_{add,sub}_signed`.
- Subtraction operator between two instants has been removed and
replaced with `signed_duration_since`. This follows the naming
chosen by `std::time::SystemTime` etc., and the version for newer
`std::time::Duration` will be named to `duration_since`.
All CI accounts are now moved to the new organization (unfortunately
Appveyor does not automatically move the build history though).
Since it's a mess to redirect everything to chronotope.github.io,
I've taken this as an opportunity to switch to docs.rs---this seems
to be better than the manual management nowadays.
Updated other files as accordingly.
- Serde 0.8 is now supported. (#86)
- The deserialization implementation for rustc-serialize now properly
verifies the input. Also tons of tests have been added. (#42)
- Tons of documentation updates! (#77, #78, #80, #82 and my own
changes as well)
- `DateTime::timestamp_subsec_{millis,micros,nanos}` methods have
been added. (#81)
- When the system time records a leap second,
the nanosecond component was mistakenly reset to zero. (#84)
- `Local` offset misbehaves in Windows for August and later,
due to the long-standing libtime bug (dates back to mid-2015).
Workaround has been implemented. (#85)
- The main documentation (`src/lib.rs` AND `README.md`) now properly
link to other types when rendered.
- The role of `TimeZone` trait is explained more thoroughly.
(Hopefully) fixes#82.
• Make what Duration is the first thing mentioned instead of project history.
• Add "magnitude" to the description to disambiguate it from Interval (in the Joda sense).
• Brush up some awkward language.
• Add a doc link and illustrate the module namespace.
- `%.6f` and `%.9f` used to print only three digits
when the nanosecond part is zero. (#71)
- The documentation for `%+` has been updated
to reflect the current status. (#71)
- Added `%.3f`, `%.6f` and `%.9f` specifier for formatting fractional seconds
up to 3, 6 or 9 decimal digits. This is a natural extension to the existing `%f`.
Note that this is (not yet) generic, no other value of precision is supported. (#45)
- Forbade unsized types from implementing `Datelike` and `Timelike`.
This does not make a big harm as any type implementing them should be already sized
to be practical, but this change still can break highly generic codes. (#46)
- Fixed a broken link in the `README.md`. (#41)
- Tons of supporting examples for the documentation have been added. More to come.
- Added padding modifiers `%_?`, `%-?` and `%0?`.
- Added new specifiers `%:z` and `%.f`.
- When `%s` specifier is used with a time zone, the time zone offset was
ignored. This has been fixed.
- Several documentation fixes including the misleading presence of
colons in the `%z` specifier. `%:z` was introduced partly due to this.
- `NaiveDateTime +/- Duration` or `NaiveTime +/- Duration` could
have gone wrong when the `Duration` to be added is negative and
has a fractional second part.
This was caused by an underflow in the conversion from `Duration`
to the parts; the lack of tests for this case allowed a bug.
A regression test has been added to avoid further bugs. (#37)
- This version is finally beta-compatible.
This introduces a slight incompatibility, namely, due to
the rewired reexport for `chrono::Duration` (which now comes
from crates.io `time` crate).
- The optional dependency on `rustc_serialize` and relevant
`Rustc{En,De}codable` implementations for supported types
has been added. You will need the `rustc-serialize` Cargo
feature to use them.