jiff
A date-time library that encourages you to jump into the pit of success. This library is heavily inspired by the Temporal project.
0.2.35
167M downloads/mo
#571 most downloaded on crates.io
BurntSushi/jiff
What this package is like to depend on
Last release 29 days ago
25 Jul 2026
Ships fairly regularly
a new release about every 2 weeks
Nearly every release is documented
notes for 66 of 67 stable releases
Nothing withdrawn
no release was ever pulled
3 years old
67 releases · first in 2024
20 releases in the last 12 months
see the full history below
Release timeline
67 releases · Feb 2024 to Jul 2026Releases
latest 60 of 67-
0.2.3525 Jul 2026Release notes
Open source →This release fixes a bug in duration parsing where, e.g.,
-PT0.5Swould be parsed as if the-sign didn't exist. This bug also affects friendly durations such as-0.5s.Bug fixes:
- #613: Fixes a bug where the sign in a duration could be ignored while parsing.
-
0.2.3419 Jul 2026Release notes
Open source →This release contains a few small enhancements. Namely, some error messages for parsing datetime values have been improved by removing some redundant messaging. Additionally, the
strftimeAPIs on datetime values can no longer panic. Instead, they'll silently pass through invalid formatting directives.Enhancements:
-
0.2.3319 Jul 2026Release notes
Open source →This release permits the use of a global time zone database in
alloc-only environments. It also contains a massive internal refactor that introduces a newjiff-corecrate for better code sharing.Enhancements:
-
0.2.3209 Jul 2026Release notes
Open source →This release updates Jiff's bundled copy of the [IANA Time Zone Database] to
2026c. See the2026crelease announcement for more details. -
0.2.3129 Jun 2026Release notes
Open source →This release fixes a minor bug in tests that prevents the crate from running through standard build processes in Linux distributions downstream.
- #594: Fix imports in recently added tests.
-
0.2.3029 Jun 2026Release notes
Open source →This release fixes a safety soundness bug in Jiff's lower level printing APIs. There is also a nice performance improvement to
civil::Date::weekday, which also improves downstread routines likecivil::Date::nth_weekdayand datetime<-->timestamp conversions in some cases.Enhancements:
- #591: Improve the performance of weekday calculations from Gregorian dates by 30-50%.
Bug fixes:
- #592:
Fix safety soundness bug when using a non-empty
Stringdestination buffer with lower level printing APIs inside ofjiff::fmt.
-
0.2.2921 Jun 2026Release notes
Open source →This release adds support for [
defmt], which is a highly efficient logging framework that targets resource-constrained devices, like microcontrollers.Enhancements:
- #505:
Add support for the
defmtcrate by implementingdefmt::Formaton the principle public types in Jiff. - #584:
Add
Zoned::UNIX_EPOCHas a constant. - #587:
Change the
Debugoutput forcivil::ISOWeekDateto match theDebugoutput style of other primitive datetime types.
Bug fixes:
- #505:
Add support for the
-
0.2.2829 May 2026Release notes
Open source →This is a small release with a fix for test failures on 32-bit targets in
no-allocenvironments.Bug fixes:
- #573:
Fix test failure on 32-bit targets in
no-allocenvironments.
- #573:
Fix test failure on 32-bit targets in
-
0.2.2726 May 2026Release notes
Open source →This is a small release with a bug fix for build errors on Windows for very old versions of Rust.
Bug fixes:
- #566: Fix build error on Windows for very old versions of Rust (e.g., 1.71).
-
0.2.2626 May 2026Release notes
Open source →This release has a couple enhancements.
Firstly, Jiff now uses
windows-linkfor calling FFI routines on Windows instead ofwindows-sys. Usingwindows-linkmeans less churn and fewer duplicates in the dependency graph.Secondly, a new
jiff-sqlx 0.2.0release has been put out to supportsqlx 0.9.0.Enhancements:
- #538:
Replace use of
windows-syswithwindows-linkand inline bindings. - #561:
Update
jiff-sqlxto usesqlx 0.9.0and releasejiff-sqlx 0.2.0.
Bug fixes:
- #548:
Absolutetize incorrect relative size terms in the documentation of
RoundMode.
- #538:
Replace use of
-
0.2.2525 May 2026Release notes
Open source →This release updates Jiff's bundled copy of the [IANA Time Zone Database] to
2026b. See the2026brelease announcement for more details. -
0.2.2423 Apr 2026Release notes
Open source →This release primarily adds a new
memory_usageroutine for reporting heap allocation sizes for theTimeZoneandZonedtypes. This release also acknowledges and updates the timeline expectations for a Jiff 1.0 release inREADME.md.Enhancements:
- #520:
Add
memory_usageto theTimeZoneandZonedtypes. - #535:
Improve comment in
Span::checked_addexample.
Bug fixes:
- #541: Update Jiff 1.0 timeline.
- #520:
Add
-
0.2.2303 Mar 2026Release notes
Open source →This release updates Jiff's bundled copy of the [IANA Time Zone Database] to
2026a. See the2026arelease announcement for more details. -
0.2.2228 Feb 2026Release notes
Open source →This release includes a bug fix where fallible conversions from signed durations to unsigned durations could panic in some cases.
Bug fixes:
- #526:
Fix a panicking bug that occurs for
std::time::Duration::try_from(SignedDuration::new(0, -1)).
- #526:
Fix a panicking bug that occurs for
-
0.2.2122 Feb 2026Release notes
Open source →This release contains a performance improvement and a bug fix for
civil::Date::newwhere it could panic on some inputs.Bug fixes:
- #523:
Fix a bug where
Date::newcould panic. This was a regression introduced injiff 0.2.20.
Performance:
- #518:
Improve
Timestamptocivil::DateTimeconversion performance by ~15%.
- #523:
Fix a bug where
-
0.2.2012 Feb 2026Release notes
Open source →This release contains a major internal refactor that moves off of using ranged integers internally. There are also some small bug fixes and added support for finding the system time zone on emscripten targets.
Enhancements:
- #11: Stop using ranged integers internally.
- #490: Add support for retrieving the system time zone on emscripten targets.
- #500:
Update comparison with the
timecrate in the Jiff documentation. - #502: Enable some non-default features for the Rust Playground deployment.
Bug fixes:
-
0.2.1905 Feb 2026Release notes
Open source →This is a small release with a performance optimization (with respect to doing heavily contended arithmetic on
Zonedvalues) and a bug fix for a panic that can occur when using%2sinstrftime.Enhancements:
- #491:
Avoid cloning
TimeZonefor consuming operations onZoned.
Bug fixes:
- #497:
Fix a panic in
timestamp.strftime("%2s").
- #491:
Avoid cloning
-
0.2.1806 Jan 2026Release notes
Open source →This release ships a sizeable refactor to the RFC 2822, RFC 9110, RC 3339, RFC 9557, ISO 8601 and friendly format printers. Specifically, they are now all monomorphic internally (instead of being generic over
jiff::fmt::Write) and write to uninitialized buffers. This improves runtime performance (sometimes dramatically so), and to a more modest degree, decreases binary size and improves compile times.This release also includes a bug fix where
DateTime::MIN.to_zoned(..)could panic.Enhancements:
- #460: Improve runtime performance and binary size of RFC 2822 printer.
- #461: Tweak behavior of printing min/max offsets in RFC 2822 and Temporal printers.
- #462:
Export fallible constructors for
jiff::SignedDuration. - #465: Improve runtime performance and binary size of the "friendly" duration printer.
- #468: Improve runtime performance and binary size of the Temporal ISO 8601 duration printer.
- #470: Improve runtime performance and binary size of the Temporal ISO 8601 datetime printer.
- #474:
Improve runtime performance and binary size of Jiff's
strftimeimplementation. - #477:
Fix a bug where time zone lookups for
civil::DateTime::MINcould panic.
-
0.2.1724 Dec 2025Release notes
Open source →This release contains binary size improvements to Jiff, more succinct error messages and some new minor APIs.
While Jiff 1.0 is overdue, I've been doing a lot of experimenting with improving Jiff's binary size and compile times. In particular, I want to spend time doing this before Jiff 1.0 so that we don't box ourselves into a corner. (For example, some binary size improvements may require minor API breaking changes.)
In this release, Jiff has switched to structured error handling internally in an effort to provide error predicates and also hopefully improve binary sizes and compile times. Overall this didn't have as big of an impact on binary sizes or compile times as I was hoping. I did take this opportunity to make Jiff's error messages a bit more succinct. In many cases, this involved de-duplicating some aspects of error messages and omitting user provided input in the messages. If you feel like there is a significant decrease in error message quality that isn't easily amended by callers providing additional context themselves, please open an issue.
This release also updates Jiff's bundled copy of the [IANA Time Zone Database] to
2025c. See the2025crelease announcement for more details.Enhancements:
- #412:
Add
Display,FromStr,SerializeandDeserializetrait implementations forjiff::civil::ISOWeekDate. These all use the ISO 8601 week date format. - #418:
Add some basic predicates to
jiff::Errorfor basic error introspection. - #453, #454: Switch to structured error handling internally.
- #456, #457, #458: Various improvements to binary size.
- #412:
Add
-
0.2.1607 Nov 2025Release notes
Open source →This release contains a number of enhancements and bug fixes that have accrued over the last few months. Most are small polishes. A couple of the bug fixes apply to panics that could occur when parsing invalid
TZstrings or invalidstrptimeformat strings.Also, parsing into a
Spanshould now be much faster (for both the ISO 8601 and "friendly" duration formats).Enhancements:
- #298:
Add Serde helpers for (de)serializing
std::time::Durationvalues. - #396:
Add
SubandAddtrait implementations forZoned(in addition to the already existing trait implementations for&Zoned). - #397:
Add
BrokenDownTime::set_meridiemand ensure it overrides the hour when formatting. - #409:
Switch dependency on
serdetoserde_core. This should help speed up compilation times in some cases. - #430:
Add new
Zoned::seriesAPI, making it consistent with the same API on other datetime types. - #432:
When
lenientmode is enabled forstrftime, Jiff will no longer error when the formatting string contains invalid UTF-8. - #432:
Formatting of
%yand%gno longer fails based on the specific year value. - #432:
Parsing of
%sis now a bit more consistent with other fields. Moreover,BrokenDownTime::{to_timestamp,to_zoned}will now prefer timestamps parsed with%sover any other fields that have been parsed. - #433:
Allow parsing just a
%sinto aZonedvia theEtc/Unknowntime zone.
Bug fixes:
- #386:
Fix a bug where
2087-12-31T23:00:00Zin theAfrica/Casablancatime zone could not be round-tripped (because its offset was calculated incorrectly as a result of not handling "permanent DST" POSIX time zones). - #407: Fix a panic that occurred when parsing an empty string as a POSIX time zone.
- #410:
Fix a panic that could occur when parsing
%:viastrptimeAPIs. - #414:
Update some parts of the documentation to indicate that
TimeZone::unknown()is a fallback forTimeZone::system()(instead of thejiff 0.1behavior of usingTimeZone::UTC). - #423: Fix a panicking bug when reading malformed TZif data.
- #426:
Fix a panicking bug when parsing century (
%C) viastrptime. - #445:
Fixed bugs with parsing durations like
-9223372036854775808sand-PT9223372036854775808S.
Performance:
- #445:
Parsing into
SpanorSignedDurationis now a fair bit faster in some cases.
- #298:
Add Serde helpers for (de)serializing
-
0.2.1513 Jun 2025Release notes
Open source →This release fixes a bug where error values were being constructed during parsing even in the success case. This was a regression introduced in
0.2.14as a result of trying to improve compilation times. Thankfully, fixing this regression doesn't seem to meaningfully impact the amount of IR generated by compiling Jiff.Bug fixes:
- #385: Fixes a performance regression for parsing.
-
0.2.1420 May 2025Release notes
Open source →This release includes a smattering of bug fixes, and hopefully a small improvement to the time it takes to compile Jiff. Also, in this release, when
TZis set to a non-empty but invalid value, Jiff will always fall back toEtc/Unknownwhen usingTimeZone::system(). This differs from previous behavior where Jiff would, in this case, attempt to read the system's default time zone. This change brings Jiff into consistency with existing Unix tooling likedate, and is also arguably a better failure mode. That is, whenTZis set but invalid, we shouldn't silently fall back to the default system time zone, but instead do something that indicates something has potentially gone wrong.Enhancements:
Bug fixes:
-
0.2.1306 May 2025Release notes
Open source →This release fixes a bug in a corner case where
TimeZone::followingcould sometimes omit the last time zone transition. This could only happen in time zones that once had daylight saving time, but ended it. This did not have an impact on other Jiff APIs that handle daylight saving time.Bug fixes:
- #362:
Fix a bug where
TimeZone::followingcould omit the last historical time zone transition.
- #362:
Fix a bug where
-
0.2.1203 May 2025Release notes
Open source →This release fixes a couple bugs in Jiff's parser. In particular, a regression was introduced in
jiff 0.2.11where its RFC 2822 parser could panic on some inputs. Previous releases of Jiff are unaffected.Bug fixes:
-
0.2.1101 May 2025Release notes
Open source →This release includes new APIs for customizing Jiff's
strtimebehavior along with a few minor bug fixes. Jiff'sstrtimeformatting API has also been optimized. It's about twice as fast as it was.This release also coincides with the publication of
jiff-icu 0.2.0-beta.2, which has support foricu 2.0.0-beta.2.Enhancements:
- #338:
Add support for the
%c,%r,%Xand%xconversion specifiers. - #341:
Add support for
%qinjiff::fmt::strtime(prints quarter of year). - #342:
Add support for
%::zand%:::zinjiff::fmt::strtime. - #344:
Add support for
%Ninjiff::fmt::strtime(alias for%9f). - #350:
Add a "lenient" mode for
strtimeformatting APIs that ignores most errors.
Bug fixes:
- #328:
Document default precision behavior of
Displayimpls for datetime types. - #340: Allow whitespace in more places in RFC 2822 parser (improves spec compliance).
- #346:
TimeZone::get("UTC")should now always returnTimeZone::UTC.
Performance:
- #338:
Jiff's
strftimeAPIs are now approximately twice as fast as they were. Performance should be comparable tochronoandtime's prebuilt APIs.
- #338:
Add support for the
-
0.2.1021 Apr 2025Release notes
Open source →This release includes a bug fix for parsing
Tuesdaywhen using%Avia Jiff'sstrptimeAPIs. Specifically, it would recognizeTuedayinstead ofTuesday.Bug fixes:
- #333:
Fix typo in
strptimeparsing fromTuedaytoTuesday.
- #333:
Fix typo in
-
0.2.919 Apr 2025Release notes
Open source →This release includes a bug fix that, in debug mode, could result in datetime types having different hashes for the same value. This could cause problems, for example, if you are using datetimes as keys in a hash map. This problem didn't exist when Jiff was compiled in release mode.
This release also improves the panic message shown when the
jsfeature isn't enabled and the current time is requested onwasm32-unknown-unknowntargets.Enhancements:
- #296:
Provide a better panic message when
Zoned::now()fails on WASM.
Bug fixes:
- #330:
Fix bug where
Hashon datetime types could yield different hash values for the same underlying date/time.
- #296:
Provide a better panic message when
-
0.2.813 Apr 2025Release notes
Open source →This release fixes a bug where the constructors on
SignedDurationfor floating point durations could panic (in debug mode) or produce incorrect results (in release mode). This bug only impacts users of thetry_from_secs_{f32,f64}andfrom_secs_{f32,f64}methods onSignedDuration.Enhancements:
- #326:
Add an alternate
Debugimpl forSignedDurationthat only shows its second and nanosecond components (while using only one component when the other is zero).
Bug fixes:
- #324:
Fix a bug that could produce a panic or incorrect results in
SignedDuration::(try_)?from_secs_{f32,f64}.
- #326:
Add an alternate
-
0.2.713 Apr 2025Release notes
Open source →This release includes a bug fix that changes how an empty but set
TZenvironment variable is interpreted (as indistinguishable fromTZ=UTC). This also includes a new enabled by default create feature,perf-inline, which allows toggling Jiff's use ofinline(always). This may help improve compile times or decrease binary size.Enhancements:
- #320: Remove some internal uses of generics to mildly improve compile times.
- #321:
Add
perf-inlinecrate feature for controllinginline(always)annotations.
Bug fixes:
- #311:
Make
TZ=indistinguishable fromTZ=UTC.
-
0.2.607 Apr 2025Release notes
Open source →This release includes a few bug fixes and support for discovering the IANA Time Zone Database automatically on Illumos.
Enhancements:
- #315: Add support for automatically finding the tzdb on Illumos.
Bug fixes:
-
0.2.523 Mar 2025Release notes
Open source →This release updates Jiff's bundled copy of the [IANA Time Zone Database] to
2025b. See the2025brelease announcement for more details.Enhancements:
- #300:
Update
jiff-tzdbto2025b.
- #300:
Update
-
0.2.410 Mar 2025Release notes
Open source →This is another small release that fixes a problem where Jiff could break builds if they relied on inference for integer comparisons. Specifically, Jiff uses internal trait impls to make comparing its internal ranged integers more convenient. But Rust the language has no concept of "internal" trait impls, and thus this can impact type inference. If code was written in a way that relies on a singular trait impl that is available, then adding Jiff to the project can cause it to break.
This isn't arguably Jiff's fault per se, but since these trait impls were just about internal convenience and not essential to Jiff's design, we adopt a pragmatic approach and just remove them.
Bug fixes:
- #293: Remove internal trait impls that can cause breaks due to inference failures.
-
0.2.307 Mar 2025Release notes
Open source →This is a small release that fixes a bug in the handling of POSIX time zones in some cases. Specifically, the implementation of
Date::yesterdaywas wrong when the date was the first of the month. This was a regression introduced in0.2.2and was not present in older releases. More test coverage has been added.Bug fixes:
- #290:
Fix bug in implementation of
Date::yesterday.
- #290:
Fix bug in implementation of
-
0.2.206 Mar 2025Release notes
Open source →This release of Jiff includes a new opt-in proc macro for embedding a
TimeZoneinto your binary. Just enable Jiff'sstaticfeature, and this will print the current time in theAmerica/New_Yorktime zone:use jiff::{ tz::{self, TimeZone}, Timestamp, }; fn main() { static TZ: TimeZone = tz::get!("America/New_York"); let zdt = Timestamp::now().to_zoned(TZ.clone()); println!("{zdt}"); }This enables
TimeZoneto be meaningfully used in core-only environments, even when dynamic memory allocation isn't available.This release also features a number of performance improvements for time zone lookups. In some cases, the improvement is significant (by an order of magnitude).
Additionally, the IANA Time Zone Database embedded into
jiff-tzdbnow uses "rearguard" semantics. This means that the boolean flag indicating whether daylight saving time is active or not (only accessible viaTimeZone::to_offset_info) will respect the actual definition of daylight saving time. (This is relevant, for example, for time zones likeEurope/Dublin, where their summer time is legally known as their standard time, but is in effect daylight saving time.)Enhancements:
- #256:
Add
tz::{get,include}macros for time zone support in core-only environments. - #258:
Switch to
rearguardtzdb data injiff-tzdband document it. - #259:
De-duplicate TZif data in
jiff-tzdb. - #273:
Add "crate features" documentation to
jiff-sqlxandjiff-diesel. - #277:
Document semver guarantee for error conditions on
Timestampconstructors. - #277: Greatly optimize time zone lookups (for both timestamps and civil datetimes).
Bug fixes:
- #261:
Improve the documentation for
ZonedWith::nanosecondandZonedWith::subsec_nanosecond.
- #256:
Add
-
0.2.116 Feb 2025Release notes
Open source →This release includes a massive number of optimizations that significantly improves performance in some cases. If you had a workload whose performance with Jiff was underwhelming, please give it a try. I welcome questions via [Discussions on GitHub].
This release also provides a new API,
Timestamp::constant, for constructingTimestampvalues in aconstcontext.Enhancements:
-
0.2.011 Feb 2025Release notes
Open source →This is a new semver incompatible release of Jiff. It contains several breaking changes. I expect most users of Jiff to be able to upgrade without any changes. The fundamental API organization of Jiff has not changed.
Some of the highlights of this release include reducing footguns and better ecosystem integration.
For reducing footguns, APIs on
Spanwill no longer implicitly assume that days are always 24 hours long. AndSpanno longer implementsPartialEqorEq(instead favoringspan.fieldwise()to create a value that supports naive fieldwise comparison). Moreover, when usingTimeZone::system()(perhaps viaZoned::now()), if the system time zone could not be detected, then a specialEtc/Unknowntime zone will be used instead. This avoids erroring, but also surfaces itself to make it clearer that something has (perhaps) gone wrong.As for ecosystem integration, this release coincides with the publication of the [
jiff-icu], [jiff-sqlx] and [jiff-diesel] crates.jiff-icuintegrates with the [ICU4X project], and is now the recommended way to use Jiff to work with non-Gregorian calendars or to localize datetimes for end users.jiff-sqlxandjiff-dieselprovide wrapper types that implement the necessary traits to make it ergonomic to store and retrieve Jiff values in a database using [SQLx] or [Diesel], respectively.Unless something unexpected happens, my plan is for the next breaking change release to be Jiff 1.0 in about 6 months. Once Jiff 1.0 is out, I plan to commit to it indefinitely.
BREAKING CHANGES:
This is an exhaustive list of breaking changes. Changes with the bolded RUNTIME prefix are changes that will not be caught by the Rust compiler. That is, they are changes in runtime behavior.
- #28:
The deprecated
intzroutines onZoned,Timestamp,civil::DateTimeandcivil::Datehave been removed. You can usein_tzinstead. This change was made because many found the nameintzto be unclear. - #32:
The
PartialEqandEqtrait implementations onSpanhave been removed. Ideally these shouldn't have been used, but if you do need them, please useSpan::fieldwiseto create aSpanFieldwise, which does have thePartialEqandEqtraits implemented. These were removed onSpanitself because they made it very easy to commit subtle bugs. - #36:
Turn panics during
Timestamp::saturing_addinto errors. Callers adding spans that are known to contain units of hours or smaller are guaranteed that this will not return an error. - RUNTIME #48:
On
SpanAPIs, days are no longer silently assumed to always be 24 hours when a relative datetime is not provided. Instead, to perform operations on units of days or bigger, callers must either provide a relative date or opt into invariant 24-hour days withSpanRelativeTo::days_are_24_hours. Shortcuts have been added to the span builders. For example,SpanTotal::days_are_24_hours. - RUNTIME #147:
Change the behavior of the deprecated
%Vconversion specifier injiff::fmt::strtimefrom formatting an IANA time zone identifier to formatting an ISO 8601 week number. To format an IANA time zone identifier, use%Qor%:Q(which were introduced injiff 0.1). - RUNTIME #212:
When parsing into a
Zonedwith a civil time corresponding to a gap, we treat all offsets as invalid and return an error. Previously, we would accept the offset as given. This brings us into line with Temporal's behavior. For example, previously Jiff accepted2006-04-02T02:30-05[America/Indiana/Vevay]but will now return an error. This is desirable for cases where a datetime in the future is serialized before a change in the daylight saving time rules. For more examples, seejiff::fmt::temporal::DateTimeParser::offset_conflictfor details on how to change Jiff's default behavior. This behavior change also applies totz::OffsetConflict::PreferOffset. - RUNTIME #213:
Tweak the semantics of
tz::TimeZoneDatabaseso that it only initializes one internal tzdb instead of trying to find as many as possible. It is unlikely that you'll be impacted by this change, but it's meant to make the semantics be a bit more sensible. (Injiff 0.1, it was in theory possible for one tz lookup to succeed in the system zoneinfo and then another tz lookup to fail in zoneinfo but succeed automatically via the bundled copy. But this seems confusing and possibly not desirable. Hence the change.) - #218:
In order to make naming a little more consistent between
Zonedandcivil::Date, thecivil::Date::to_iso_week_dateandcivil::ISOWeekDate::to_dateAPIs were renamed tocivil::Date::iso_week_dateandcivil::ISOWeekDate::date. - #220:
Remove
Span::to_durationfor converting aSpanto astd::time::Durationand renameSpan::to_jiff_durationtoSpan::to_duration. This prioritizesSignedDurationas the "primary" non-calendar duration type in Jiff. And makes it more consistent with APIs likeZoned::duration_since. For non-calendar spans, theTryFrom<Span> for std::time::Durationstill exists. For calendar durations, useSpan::to_durationand then convert theSignedDurationtostd::time::Duration. Additionally,Timestamp::from_jiff_durationandTimestamp::as_jiff_durationwere renamed toTimestamp::from_durationandTimestamp::as_duration, respectively. The old deprecated routines on the unsignedstd::time::Durationhave been removed. - #221:
Change the type of the value yielded by the
jiff::tz::TimeZoneNameIteriterator fromStringtojiff::tz::TimeZoneName. This opaque type is more API evolution friendly. To access the string, either useTimeZoneName'sDisplaytrait implementation, or itsas_strmethod. - #222:
Split
TimeZone::to_offsetinto two methods. One that just returns the offset, and another,TimeZone::to_offset_info, which includes the offset, DST status and time zone abbreviation. The extra info is rarely needed and is sometimes more costly to compute. Also, make the lifetime of the time zone abbreviation returned byTimeZoneTransition::abbreviationtied to the transition instead of the time zone (for future API flexibility, likely in core-only environments). This change was overall motivated by wanting to do less work in the common case (where we only need the offset), and for reducing the size of aTimeZoneconsiderably in core-only environments. Callers previously usingTimeZone::to_offsetto get DST status and time zone abbreviation should now useTimeZone::to_offset_info. - RUNTIME #230:
When
TimeZone::system()cannot find a system configured time zone,jiff 0.1would automatically fall back toTimeZone::UTC(with a WARN-level log message). Injiff 0.2, the fall back is now toTimeZone::unknown(), which has a specialEtc/Unknownidentifier (as specified by Unicode and reserved by the IANA time zone database). The fallback otherwise still behaves as if it wereTimeZone::UTC. This helps surface error conditions related to finding the system time zone without causing unrecoverable failure.
Enhancements:
- #136:
When the special
SpanRelativeTo::days_are_24_hours()marker is used, weeks will also be treated as invariant. That is, seven 24-hour days. In all cases, working with years and months still requires a relative date. - #228:
It is now possible to forcefully use a bundled copy of the IANA time zone
database without relying on disabling crate features. This can be done by
enabling the
tzdb-bundle-alwayscrate feature and explicitly creating ajiff::tz::TimeZoneDatabase::bundled()database. Once in hand, you must use APIs likeTimeZoneDatabase::getto create aTimeZoneand avoid any APIs that implicitly use the global time zone database (likeTimestamp::in_tzor evenZoned::from_str). - #238:
Add integration with the ICU4X project via the [
jiff-icu] crate.jiff-icuprovides traits for easily converting between datetime types defined in Jiff and datetime types defined in ICU4X. - #240:
Add integration with the SQLx project via the [
jiff-sqlx] crate.jiff-sqlxprovides wrapper types that implement the necessary traits in SQLx for reasonably ergonomic integration. This includes PostgreSQL and SQLite support, but not MySQL support. (It's not clear if it's possible at present to provide MySQL support for SQLx for datetime types outside of SQLx itself.) - #241:
Add integration with the Diesel project via the [
jiff-diesel] crate.jiff-dieselprovides wrapper types that implement the necessary traits in Diesel for reasonably ergonomic integration. This includes MySQL, PostgreSQL and SQLite support.
- #28:
The deprecated
-
0.1.2902 Feb 2025Release notes
Open source →This release includes a few small enhancements and a bug fix. In particular, there is now Serde support for
TimeZoneand theISOWeekDateAPI has been filled out a bit more.Unless a serious issue is uncovered, my plan is that this will be the last release before
jiff 0.2.Enhancements:
- #89:
Opt-in support for using Serde with
jiff::tz::TimeZonehas been added. - #227:
The
civil::ISOWeekDateAPI has been beefed up with a few convenience methods. - #233:
Add
tz::Offset::roundfor rounding time zone offsets.
Bug fixes:
- #231: Use more flexible offset equality when parsing offsets with fractional minutes.
- #89:
Opt-in support for using Serde with
-
0.1.2827 Jan 2025Release notes
Open source →This is a small release that just removes the dev-dependency on
serde_yml. It has been replaced with the deprecatedserde_yaml. See this post aboutserde_ymlshenanigans for why this was done. Note that this was only a dev-dependency and thus doesn't impact folks using Jiff.Bug fixes:
- #225:
Remove dependency on
serde_ymlin favor ofserde_yaml.
- #225:
Remove dependency on
-
0.1.2725 Jan 2025Release notes
Open source →This is a small release with a bug fix for precision loss in some cases when doing arithmetic on
TimestamporZoned.Bug fixes:
- #223: Fix the check for fractional seconds before taking the fast path.
-
0.1.2623 Jan 2025Release notes
Open source →This is a small release with another deprecation and a new API for doing prefix parsing via
strptime. There's also a bug fix for a corner case when dealing with daylight saving time gaps with theZoned::withAPI.Deprecations:
- #210:
Deprecate
ISOWeekDate::to_datein favor ofISOWeekDate::date.
Enhancements:
- #209:
Add
fmt::strtime::BrokenDownTime::parse_prefixfor parsing only a prefix.
Bug fixes:
- #211:
Fix unintuitive behavior of
Zoned::withwhen time falls in a DST gap.
- #210:
Deprecate
-
0.1.2521 Jan 2025Release notes
Open source →This release contains a number of deprecations in preparation for a
jiff 0.2release. The deprecations are meant to facilitate a smoother transition. The deprecations, when possible, come with new APIs that will permit users to write forward compatible code that will work in bothjiff 0.1andjiff 0.2.This release also includes a handful of new conversion specifiers in Jiff's
strftimeandstrptimeAPIs. This improves compatibility with the analogous implementation with GNU libc.Deprecations:
- #28:
The
intzmethods onZoned,Timestamp,civil::DateTimeandcivil::Datehave been deprecated in favor ofin_tz. - #32:
The
EqandPartialEqtrait implementations onSpanhave been deprecated in favor of using the newSpanFieldwisetype. - #48:
Silently assuming days are always 24 hours in some
SpanAPIs has now been deprecated. This will become an error injiff 0.2. To continue assuming days are 24 hours without a relative reference date, you can use the newSpanRelativeTo::days_are_24_hoursAPI. Injiff 0.1, you'll seen a WARN-level log message emitted if you're code will be broken byjiff 0.2. - #147:
Both
%Vand%:Vhave been deprecated in favor of%Qand%:Q. Injiff 0.2,%Vwill correspond to the ISO 8601 week number and%:Vwill result in an error. This change was made to improve compatibility with otherstrtimeimplementations.%Vand%:Vcontinue to correspond to IANA time zone identifiers injiff 0.1, but using them for parsing or formatting will result in a WARN-level deprecation message.
Enhancements:
- #147:
Adds a number of new conversion specifiers to Jiff's
strftimeandstrptimeAPIs. Specifically,%C,%G,%g,%j,%k,%l,%n,%R,%s,%t,%U,%u,%W,%w. Their behavior should match the corresponding specifiers in GNU libc.
- #28:
The
-
0.1.2416 Jan 2025Release notes
Open source →This release updates Jiff's bundled copy of the [IANA Time Zone Database] to
2025a. See the2025arelease announcement for more details.Enhancements:
- #206:
Update
jiff-tzdbto2025a.
- #206:
Update
-
0.1.2313 Jan 2025Release notes
Open source →This release includes some bug fixes, particularly for compilation on
aarch64-linux-android. There are also some minor enhancements, such as makingZoned::iso_week_datea convenience function forcivil::Date::iso_week_date, in line with similar functions.My current plan is to make a reasonably quick transition to
jiff 0.2with a few pending breaking changes. I will be making somejiff 0.1releases with deprecations in order to make the transition as smooth as possible. If all goes well withjiff 0.2, then my plan is still to do a Jiff 1.0 release in the Summer of 2025.Deprecations:
- #197:
Date::to_iso_week_datehas been deprecated in favor ofDate::iso_week_date.
Enhancements:
- #196: Improve ISO week date documentation regarding weekday offsets.
- #197:
Add
Zoned::iso_week_date,DateTime::iso_week_dateandDate::iso_week_date.
Bug fixes:
- #197:
-
0.1.2212 Jan 2025Release notes
Open source →This release adds support for Android. This support means that Jiff will automatically read its special concatenated time zone database, and will read the
persist.sys.timezoneproperty to determine the system's current time zone.See [PLATFORM] for more specific information about Android support.
Note that this release also removed all non-essential files (including tests and test data) for the artifact uploaded to crates.io. If you need or want these files, please open a new issue.
Enhancements:
- #140: Add support for the Android platform.
-
0.1.2104 Jan 2025Release notes
Open source →This release includes a new API for setting the unit designator label in a friendly formatted duration for zero-length durations.
Enhancements:
- #192: Add option to the friendly printer for setting the unit when writing a zero-length duration.
-
0.1.2004 Jan 2025Release notes
Open source →This release includes a new type,
Pieces, in thejiff::fmt::temporalsub-module. This exposes the individual components of a parsed Temporal ISO 8601 datetime string. It allows users of Jiff to circumvent the checks in the higher level parsing routines that prevent you from shooting yourself in the foot.For example, parsing into a
Zonedwill return an error for raw RFC 3339 timestamps like2025-01-03T22:03-05because there is no time zone annotation. Without a time zone, Jiff cannot do time zone aware arithmetic and rounding. Instead, such a datetime can only be parsed into aTimestamp. This lower levelPiecesAPI now permits users of Jiff to parse this string into its component parts and assemble it into aZonedif they so choose.Enhancements:
- #188:
Add
fmt::temporal::Piecesfor granular datetime parsing and formatting.
- #188:
Add
-
0.1.1902 Jan 2025Release notes
Open source →This releases includes a UTF-8 related bug fix and a few enhancements.
Firstly, a
Span's defaultDisplayimplementation now writes uppercase unit designator labels. That means you'll getP1Y2M3DT4H5M6Sinstead ofP1y2m3dT4h5m6sby default. You can restore previous behavior viajiff::fmt::temporal::SpanPrinter::lowercase. This change was made to improve interoperability.Secondly,
SignedDurationnow supports rounding viaSignedDuration::round. Note that it only supports rounding time units (hours or smaller). In order to round with calendar units, you'll still need to use aSpan.Enhancements:
- #130:
Document value ranges for methods like
year,day,hourand so on. - #187:
Add a rounding API (for time units only) on
SignedDuration. - #190:
SpanandSignedDurationnow use uppercase unit designator labels in their default ISO 8601Displayimplementation.
Bug fixes:
- #155:
Relax
strftimeformat strings from ASCII-only to all of UTF-8.
- #130:
Document value ranges for methods like
-
0.1.1801 Jan 2025Release notes
Open source →This release includes a few minor enhancements. Namely, the ability to iterate over time zone transitions (in the future or the past), and some improvements to failure modes when
TimestampandSpanarithmetic fails.Enhancements:
-
0.1.1731 Dec 2024Release notes
Open source →This release enhances Jiff's support for
no_stdenvironments by making itsallocfeature optional. Whenallocis disabled, only fixed offset time zones are supported and error messages are significantly degraded. If you have core-only use cases for Jiff, I'd love to hear about them on the issue tracker.Enhancements:
-
0.1.1626 Dec 2024Release notes
Open source →This release includes a new
jiff::fmt::friendlymodule for formatting and parsing durations in a more human readable format than what ISO 8601 specifies. ISO 8601 remains the "default" duration format in Jiff due to its widespread support. Here are some examples:40d 40 days 1y1d 1yr 1d 3d4h59m 3 days, 4 hours, 59 minutes 3d 4h 59m 2h30m 2h 30m 1mo 1w 1 week 1w4d 1 wk 4 days 1m 0.0021s 0s 0d 0 days 3 mins 34s 123ms 3 mins 34.123 secs 3 mins 34,123s 1y1mo1d1h1m1.1s 1yr 1mo 1day 1hr 1min 1.1sec 1 year, 1 month, 1 day, 1 hour, 1 minute 1.1 seconds 1 year, 1 month, 1 day, 01:01:01.1To quickly demonstrate this new feature, here's a simple CLI program using Clap:
use clap::Parser; use jiff::{Span, Zoned}; #[derive(Parser, Debug)] #[command(version, about, long_about = None)] struct Args { duration: Span, } fn main() { let args = Args::parse(); println!("adding duration to now: {}", &Zoned::now() + args.duration); }And running the program:
$ cargo run -q -- '1 year, 2 months, 5 hours' adding duration to now: 2026-02-26T18:58:22-05:00[America/New_York] $ cargo run -q -- 'P1Y2MT5H' # ISO 8601 durations are supported too! adding duration to now: 2026-02-26T19:00:57-05:00[America/New_York]With Jiff, you should no longer need to pull in crates like
humantimeandhumantime-serdeto accomplish a similar task.While this new format doesn't support any kind of internationalization, the prevalence of the
humantimecrate suggests there's a desire for something like this. The "friendly" format is meant to service all the same use cases ashumantimedoes for durations, but in a way that doesn't let you shoot yourself in the foot.The new "friendly" format is now the default for the
Debugimplementations of bothSpanandSignedDuration. It's also available via the "alternate"Displayimplementations forSpanandSignedDurationas well. Moreover, theFromStrtrait implementations for bothSpanandSignedDurationwill parse both the ISO 8601 duration and this new "friendly" format. Finally, whenserdeintegration is enabled, theDeserializeimplementations forSignedDurationandSpanalso automatically parse either ISO 8601 or the friendly format. For serialization, ISO 8601 remains the default, but thejiff::fmt::serdemodule provides easy to use helpers to switch to the friendly format.The
jiff::fmt::friendlymodule documentation provides many more details, including a complete grammar for the format.Enhancements:
- #143:
Add
Hashimplementation forZonedandTimestamp.
Bug fixes:
- #143:
Add
-
0.1.1530 Nov 2024Release notes
Open source →This release fixes a bug where Jiff would sometimes fail to parse TZif files (found, typically, in
/usr/share/zoneinfoon Unix systems). This occurred when the TZif file contained a time zone transition outside the range of Jiff'sTimestamptype (which is-9999-01-01to9999-12-31). The bug fix works by clamping the out-of-range transitions to Jiff's supported range.This bug only seems to occur in some environments where their TZif files contain more extreme values than what is typically found.
Bug fixes:
- #163: Fix a bug where Jiff would fail to parse some TZif files.
-
0.1.1401 Nov 2024Release notes
Open source →This release introduces new APIs to the RFC 2822 printer that explicitly print timestamps in a format strictly compatible with [RFC 9110].
Enhancements:
- #151:
Add
rfc2822::DateTimePrinter::timestamp_to_rfc9110_stringmethod.
- #151:
Add
-
0.1.1307 Sep 2024Release notes
Open source →This release introduces a new
jiff::tz::TimeZone::try_systemAPI. It is likeTimeZone::system, but returns an error instead of an automatic fall back to UTC when the system time zone could not be discovered.This also includes an update to the bundled [IANA Time Zone Database] to the
2024brelease in thejiff-tzdbcrate. As a reminder, the bundled database is not used or included on Unix platforms by default. See [PLATFORM] for more details.Enhancements:
-
0.1.1231 Aug 2024Release notes
Open source →This release introduces some new minor APIs that support formatting
Timestampvalues as RFC 3339 strings with a specific offset.Previously, using the standard formatting routines that Jiff provides, it was only possible to format a
Timestampusing Zulu time. For example:use jiff::Timestamp; assert_eq!( Timestamp::UNIX_EPOCH.to_string(), "1970-01-01T00:00:00Z", );This is fine most use cases, but it can be useful on occasion to format a
Timestampwith a specific offset. While this isn't as expressive as formatting a datetime with a time zone (e.g., with an IANA time zone identifier), it may be useful in contexts where you just want to "hint" at what a user's local time is. To that end, there is a newTimestamp::display_with_offsetmethod that makes this possible:use jiff::{tz, Timestamp}; assert_eq!( Timestamp::UNIX_EPOCH.display_with_offset(tz::offset(-5)).to_string(), "1969-12-31T19:00:00-05:00", );A corresponding API was added to
jiff::fmt::temporal::DateTimePrinterfor lower level use.Moreover, this release also includes new convenience APIs on the Temporal and RFC 2822 printer types for returning strings. For example, previously, if you were using the RFC 2822 printer to format a
Timestamp, you had to do this:use jiff::{fmt::rfc2822::DateTimePrinter, Timestamp}; let mut buf = String::new(); DateTimePrinter::new().print_timestamp(&Timestamp::UNIX_EPOCH, &mut buf).unwrap(); assert_eq!(buf, "Thu, 1 Jan 1970 00:00:00 -0000");But now you can just do this:
use jiff::{fmt::rfc2822::DateTimePrinter, Timestamp}; assert_eq!( DateTimePrinter::new().timestamp_to_string(&Timestamp::UNIX_EPOCH).unwrap(), "Thu, 1 Jan 1970 00:00:00 -0000", );Enhancements:
- #122:
Support formatting
Timestampto an RFC 3339 string with a specific offset.
- #122:
Support formatting
-
0.1.1128 Aug 2024Release notes
Open source →This release includes a few small enhancements that have been requested over the last several weeks. The biggest enhancement is a new
jiff::fmt::serdesub-module. It provides convenience routines similar to Chrono'schrono::serdesub-module for serializing and deserializing between ajiff::Timestampand an integer number of seconds, milliseconds, microseconds or nanoseconds. For example:use jiff::Timestamp; #[derive(serde::Serialize, serde::Deserialize)] struct Record { #[serde(with = "jiff::fmt::serde::timestamp::second::required")] timestamp: Timestamp, } let json = r#"{"timestamp":1517644800}"#; let got: Record = serde_json::from_str(&json).unwrap(); assert_eq!(got.timestamp, Timestamp::from_second(1517644800).unwrap()); assert_eq!(serde_json::to_string(&got).unwrap(), json);If you need to support optional timestamps via
Option<Timestamp>, then usejiff::fmt::serde::timestamp::second::optionalinstead. Similarly, if you need to support milliseconds instead of seconds, then replacesecondwithmillisecondin the module path.Enhancements:
- #78:
Add
BrokenDownTime::set_{offset,iana_time_zone}APIs. - #93:
Add note about using
Timestamp::now().to_zoned()instead ofZoned::now().with_time_zone(). - #101:
Add new
jiff::fmt::serdemodule for integration with integer timestamps. - #117:
Remove
unsafeusage inlibmfunctions (applicable only to no-std users).
- #78:
Add
-
0.1.1024 Aug 2024Release notes
Open source →This release features a small bug fix where Jiff will detect an IANA time zone identifier in some cases where it wouldn't before. While Jiff would previously read the symlink metadata on
/etc/localtimeby default to discover the system configured time zone on Unix systems, it wouldn't do so whenTZ=/etc/localtime. There's really no reason not to, so this release of Jiff is fixed to use symlink sniffing on file paths provided by theTZenvironment variable.Bug fixes:
- #113:
When
TZ=/etc/localtime, use symlink metadata to detect IANA identifier.
- #113:
When
-
0.1.923 Aug 2024Release notes
Open source →This release introduces new options for controlling the precision of fractional seconds when printing
Zoned,Timestamp,civil::DateTimeorcivil::Timevalues. This is principally exposed viajiff::fmt::temporal::DateTimePrinter::precision, but it's also available via the standard library's formatting machinery. For example, ifzdtis ajiff::Zoned, thenformat!("{zdt:.6}")will format it into a string with microsecond precision, even if its fractional component is zero.Enhancements:
- #92: Support setting the precision of fractional seconds when printing datetimes.
-
0.1.819 Aug 2024Release notes
Open source →This releases fixes a build error in Jiff's
alloc-only configuration. This regression was introduced injiff 0.1.6.Bug fixes:
- #108:
Use
core::time::Durationeverywhere instead ofstd::time::Duration.
- #108:
Use
-
0.1.718 Aug 2024Release notes
Open source →This release relaxes Jiff's dependency on
windows-systo include multiple semver incompatible releases. The purpose of this relaxation is to enable Jiff to work with different versions ofwindows-sysin the hopes that this reduces the likelihood that multiple copies ofwindows-sysare included in your dependency tree.Dependencies:
- #106:
Relax
windows-sysdependency constraint to>=0.52.0, <=0.59.*.
- #106:
Relax
-
0.1.618 Aug 2024Release notes
Open source →This release includes a new top-level type,
SignedDuration, that provides a near exact replica ofstd::time::Duration, but signed. It is meant to provide alternative APIs for working with durations at a lower level than whatSpanprovides, and to facilitate better integration with the standard library.A
SignedDurationhas also been integrated with all of Jiff's datetime types. For example, previously,Zoned::checked_addonly accepted a concretejiff::Span. But now it accepts ajiff::Span,jiff::SignedDurationor even astd::time::Duration. Moreover, all of theuntilandsinceAPIs on datetime types have been ported and copied to returnSignedDurationunder theduration_untilandduration_sincenames.This marks an initial integration phase with
SignedDuration. It is planned to integrate it more with the datetime types. Currently, there are integrations onTimestampandSpan, but more will be added in the future.Overall, folks should still use
Span. That is the intended default duration type in Jiff and will continue to be. Users of Jiff may findSignedDurationuseful in contexts where speed is important or when one needs to integrate with the standard library.This release also includes a few related deprecations as the APIs involving
std::time::Durationare phased out in favor ofSignedDuration.Deprecations:
Timestamp::as_duration: replaced withas_jiff_duration, which will be renamed toas_durationinjiff 0.2.Timestamp::from_duration: replaced withfrom_jiff_duration, which will be renamed tofrom_durationinjiff 0.2.Timestamp::from_signed_duration: replaced withfrom_jiff_duration.Span::to_duration: replaced withto_jiff_duration, which will be renamed toto_durationinjiff 0.2.
Basically, all of the above APIs either accept or return a
std::time::Duration. To avoid breaking changes at this point, new methods forSignedDurationwere added. For example,Timestamp::as_jiff_duration. Injiff 0.2, the above deprecated methods will be removed and replaced with equivalent methods that accept or return aSignedDurationinstead. Callers can then convert between aSignedDurationand astd::time::Durationusing appropriateTryFromtrait implementations.Enhancements:
- #21:
Add new top-level
SignedDurationtype. - #90:
Improve error message when using
Spanwith >=day units with aTimestamp.
Performance: