NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io, #145 most downloaded on crates.io
Procedural macros for the time crate. This crate is an implementation detail and should not be relied upon directly.
Latest stable
0.2.32
Last release 4 months ago
20 Jul 2026
Release timing varies
gaps range from 8 days to 8 months
Most releases are documented
notes for 27 of 34 stable releases
2 versions withdrawn
withdrawn after publishing
7 years old
38 releases · first in 2019
Drag across the ruler to compare, or tap a release to open it.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Nothing published for this version
Dependencies have been bumped to the latest patch version, ensuring compatibility.
Fix #309, which can cause panics in certain situations.
The implementation of OffsetDateTime::timestamp, OffsetDateTime::unix_timestamp, PrimitiveDatetime::timestamp, and OffsetDateTime::unix_timestamp have
OffsetDateTime::timestamp, OffsetDateTime::unix_timestamp,
PrimitiveDatetime::timestamp, and OffsetDateTime::unix_timestamp have been corrected. This
affects all negative timestamps with a nonzero subsecond value.Due to #293, any method that requires knowledge of the local offset will now _fail_ on Linux. For try_ methods, this means returning an error. For oth
Due to #293, any method that requires knowledge of the local offset will now
fail on Linux. For try_ methods, this means returning an error. For others,
it means assuming UTC.
UtcOffset::timestamp (moved to UtcOffset::unix_timestamp)UtcOffset::timestamp_nanos (moved to UtcOffset::unix_timestamp_nanos)date (moved to macros::date)time (moved to macros::time)offset (moved to macros::offset)OffsetDateTime::now_local (assumes UTC if unable to be determined)UtcOffset::local_offset_at (assumes UTC if unable to be determined)UtcOffset::current_local_offset (assumes UTC if unable to be determined)Solaris & Illumos now successfully build.
Duration::new could previously result in an inconsistent internal state. This led to some odd
situations where a Duration could be both positive and negative. This has been fixed such that
the internal state maintains its invariants.Implementation details of some error types have been exposed. This means that data about a component being out of range can be directly obtained, whil
const fn on rustc ≥ 1.46:
Date::try_from_iso_ywdDate::iso_year_weekDate::weekDate::sunday_based_weekDate::monday_based_weekDate::try_with_hmsDate::try_with_hms_milliDate::try_with_hms_microDate::try_with_hms_nanoPrimitiveDateTime::iso_year_weekPrimitiveDateTime::weekPrimitiveDateTime::sunday_based_weekPrimitiveDateTime::monday_based_weekutil::weeks_in_yearOffsetDateTime::timestamp_nanos
OffsetDateTime::timestamp_nanosOffsetDateTime::from_unix_timestamp_nanosA bug with far-reaching consequences has been fixed. See #276 for complete details, but the gist is
that the constructing a Date from a valid Julian day may result in an invalid value or even panic.
As a consequence of implementation details, this affects nearly all arithmetic with Dates (and as
a result also PrimitiveDateTimes and OffsetDateTimes).
OffsetDateTime from a timestamp-nanosecond pairThe build script now declares a dependency on the COMPILING_UNDER_CARGO_WEB environment variable.
COMPILING_UNDER_CARGO_WEB environment
variable.%D specifier no longer requires padding on the month. Previously,
Err(InvalidMonth) was incorrectly returned.std::time::Duration that is larger than time::Duration::max_value() now correctly returns
Ordering::Greater when compared.Sign::Zero now sets the integer to be zero. This
previously left the integer unmodified.The following functions are const fn on rustc ≥ 1.46:
const fn on rustc ≥ 1.46:
Date::try_from_ymdDate::try_from_yoTime::try_from_hmsTime::try_from_hms_milliTime::try_from_hms_microTime::try_from_hms_nanoerror module has been created where all existing error types are contained. The Error
suffix has been dropped from these types.ext module has been created where extension traits are contained.util module has been created where utility functions are contained.error::ComponentRange now implements Copy.For back-compatibility, all items that were moved to newly-contained modules have been re-exported
from their previous locations (and in the case of the error module, with their previous name).
Parsing format::Rfc3339 now correctly handles the UTC offset (#274).
The following functions are const fn on rustc ≥ 1.46:
The following functions are const fn on rustc ≥ 1.46:
Date::yearDate::monthDate::dayDate::month_dayDate::ordinalDate::as_ymdDate::as_yoDate::julian_dayDuration::checked_divPrimitiveDateTime::yearPrimitiveDateTime::monthPrimitiveDateTime::dayPrimitiveDateTime::month_dayPrimitiveDateTime::ordinalWeekday::previousWeekday::nextsize_of::<Date>() has been reduced from 8 to 4. As a consequence,
size_of::<PrimitiveDatetime>() went from 16 to 12 and size_of::<OffsetDateTime>() from 20
to 16. This change also results in a performance improvement of approximately 30% on the
Date::year and Date::ordinal methods.cfg-if has been removed as a dependency.cfg flags passed to rustc will no longer collide with other crates (at least unless they're
doing something very stupid).OffsetDateTimes can now be represented as Unix timestamps with serde. To do this, you can use the time::timestamp and time::timestamp::option modules.
OffsetDateTimes can now be represented as Unix timestamps with serde. To do this, you can use the
time::serde::timestamp and time::serde::timestamp::option modules.
cargo-web support works, and is now explicitly checked in CI. A previous change was made that made a method call ambiguous.
cargo-web support works, and is now explicitly checked in CI. A previous change was made that made
a method call ambiguous.
Adding/subtracting a core::Duration now correctly takes subsecond values into account. This also affects PrimitiveDateTime and OffsetDateTime.
Adding/subtracting a core::time::Duration now correctly takes subsecond values into account. This
also affects PrimitiveDateTime and OffsetDateTime.
### Fixed Panicking APIs are re-exposed.
Panicking APIs are re-exposed.
Subtracting Instants can correctly result in a negative duration, rather than resulting in the absolute value of it.
Subtracting Instants can correctly result in a negative duration, rather than resulting in the
absolute value of it.
OffsetDateTime::now due to the offset not being clear from the method name alone.
OffsetDateTime::now_utcOffsetDateTime::now due to the offset not being clear from the method name alone.Dates are now uniformly random when using the rand crate. Previously, both the year and day
within the year were uniform, but this meant that any given day in a leap year was slightly less
likely to be chosen than a day in a non-leap year.
Deprecated APIs from time v0.1 are public again. They were previously hidden by accident in 0.2.9.
OffsetDateTimes as RFC3339.impl Display,
rather than a concrete type.cfg-if now has a mandatory minimum of 0.1.10, rather than just 0.1. This is because compilation fails when using 0.1.9.
cfg-if now has a mandatory minimum of 0.1.10, rather than just 0.1. This is because compilation
fails when using 0.1.9.
cargo_web support has been added for getting a local offset. A general catch-all defaulting to UTC has also been added.
cargo_web support has been added for getting a local offset. A general catch-all defaulting to
UTC has also been added.Error::source has been implemented for the wrapper time::Error.UtcOffset::try_local_offset, UtcOffset::try_current_local_offset,
OffsetDateTime::try_now_local() provide fallible alternatives when the default of UTC is not
desired. To facilitate this change, IndeterminateOffsetError has been added.#[non_exhaustive] is simulated on compilers prior to 1.40.0.All changes are now being reported in the repository's changelog.
All changes are now being reported in the repository's changelog.
Display has been implemented for Date, OffsetDateTime, PrimitiveDateTime, Time,
UtcOffset, and Weekday.Hash is now derived for Duration.SystemTime can be converted to and from OffsetDateTime. The following trait implementations
have been made for interoperability:
impl Sub<SystemTime> for OffsetDateTimeimpl Sub<OffsetDateTime> for SystemTimeimpl PartialEq<SystemTime> for OffsetDateTimeimpl PartialEq<OffsetDateTime> for SystemTimeimpl PartialOrd<SystemTime> for OffsetDateTimeimpl PartialOrd<OffsetDateTime> for SystemTimeimpl From<SystemTime> for OffsetDateTimeimpl From<OffsetDateTime> for SystemTimeimpl Duration<T> for Standard, allowing usage with the rand crate. This is
gated behind the rand feature flag.NumericalDuration has been implemented for f32 and f64. NumericalStdDuration and
NumericalStdDurationShort have been implemented for f64 only.UtcOffset::local_offset_at(OffsetDateTime), which will obtain the system's local offset at the
provided moment in time.
OffsetDateTime::now_local() is equivalent to calling
OffsetDateTime::now().to_offset(UtcOffset::local_offset_at(OffsetDateTime::now())) (but more
efficient).UtcOffset::current_local_offset() will return the equivalent of
OffsetDateTime::now_local().offset().impl AsRef<str> as parameters, rather than just
&str. time::validate_format_string does this as well.Date being between the years -100,000 and +100,000 (inclusive) is now
strictly enforced.Duration are now enabled by default. This behavior is the identical to what
the standard library does.time, date, and offset macros have been added to the prelude.Sign has been deprecated in its entirety, along with Duration::sign.
To obtain the sign of a Duration, you can use the Duration::is_positive,
Duration::is_negative, and Duration::is_zero methods.
A number of functions and trait implementations that implicitly assumed a timezone (generally UTC) have been deprecated. These are:
Date::todayTime::nowPrimitiveDateTime::nowPrimitiveDateTime::unix_epochPrimitiveDateTime::from_unix_timestampPrimitiveDateTime::timestampimpl Sub<SystemTime> for PrimitiveDateTimeimpl Sub<PrimitiveDateTime> for SystemTimeimpl PartialEq<SystemTime> for PrimitiveDateTimeimpl PartialEq<PrimitiveDateTime> for SystemTime>impl PartialOrd<SystemTime> for PrimitiveDateTimeimpl PartialOrd<PrimitiveDateTime> for SystemTime>impl From<SystemTime> for PrimitiveDateTimeimpl From<PrimitiveDateTime> for SystemTimeDuration is now always in range. Previously, it was possible (via
addition and/or subtraction) to obtain a value that was not internally consistent.Time::parse erroneously returned an InvalidMinute error when it was actually the second that
was invalid.Date::parse("0000-01-01", "%Y-%m-%d") incorrectly returned an Err (#221).v0.2.5 introduces a major inconsistency, not just in its behavior for PrimitiveDateTime::using_offset, but also changes its signature, rendering it in
v0.2.5 introduces a major inconsistency, not just in its behavior for PrimitiveDateTime::using_offset, but also changes its signature, rendering it incapable of being used in const contexts.
Both the behavior and the function signature have been fixed, while still fixing the underlying issue. PrimitiveDateTime::using_offset mentions in the docs that the PrimitiveDateTime is assumed to be UTC, and is converted to the provided offset. This was the previous behavior.
The following functionality had bugs that were fixed (from v0.2.4):
OffsetDateTime::timestampOffsetDateTime::parseOffsetDateTime — Subsecond values were not checked previously. They also relied on the faulty timestamp implementation.OffsetDateTime — Same as equality and comparison. Additionally, hashes would collide with PrimitiveDateTime if the underlying UTC was the same.OffsetDateTimes previously disregarded the subsecond values.All of these changes are now checked in CI, so regressions will be caught.
PrimitiveDateTime::using_offset was poorly defined, leading to an ambiguity that cause some methods to treat the existing datetime as UTC, while other
PrimitiveDateTime::using_offset was poorly defined, leading to an ambiguity that cause some methods to treat the existing datetime as UTC, while others treated it as the time in the provided offset. This release ensures that the behavior is what I intended — the datetime is assumed to be in the provided offset.
NB: This release has been yanked from crates.io due to major back-compatibility issues. These have been fixed in 0.2.6.
v0.2.4 is identical to v0.2.3 with the exception of the breaking change, which has been reverted. v0.2.4 is backwards-compatible with v0.2.2.
v0.2.4 is identical to v0.2.3 with the exception of the breaking change, which has been reverted. v0.2.4 is backwards-compatible with v0.2.2.
v0.2.3 has been yanked from crates.io. The breaking change (with regard to feature flags) should not have been made. By yanking this version, any exis…
v0.2.3 has been yanked from crates.io. The breaking change (with regard to feature flags) should not have been made. By yanking this version, any existing code will continue to work, while new code will not have potential backwards-incompatible behavior. The change was reverted in v0.2.4.
time!, date!, offset! macrosparse function, allowing for type inference.time::Result<T> alias to time::Result<T, time::Error>Panicking APIs have been deprecated in favor of the new macros.
Minimum supported Rust version is now 1.34, changed from 1.40. This permits a number of crates to upgrade without breaking MSRV.
A number of parsing methods used unchecked constructors. This was because the values should have been checked prior. They are now.
The "std" feature has been renamed to "alloc", which disables the standard library. This was necessary to bring MSRV down to 1.34.
## Bugs fixed #200 has been fixed.
#200 has been fixed.
Duration now allows for the nanoseconds component to be negative. Previously, it was not possible to directly construct a value between 0 and -1 secon
Duration now allows for the nanoseconds component to be negative. Previously, it was not possible to directly construct a value between 0 and -1 seconds. As a result of this change, a number of method signatures were changed to accommodate the sign.
Duration was also re-implemented, which allows for a number of methods to become const fn.
Minimum supported Rust version: 1.40.0
See #190 for major details. This is essentially a new crate compared to v0.1, and only has a few methods for back-compatibility where trivially feasib
See #190 for major details. This is essentially a new crate compared to v0.1, and only has a few methods for back-compatibility where trivially feasible.
Minimum supported Rust version: 1.40.0
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.