1ChangeLog for Chrono
2====================
3
4This documents all notable changes to [Chrono](https://github.com/chronotope/chrono).
5
6Chrono obeys the principle of [Semantic Versioning](http://semver.org/).
7
8There were/are numerous minor versions before 1.0 due to the language changes.
9Versions with only mechanical changes will be omitted from the following list.
10
11## 0.4.11
12
13### Improvements
14
15* Support a space or `T` in `FromStr` for `DateTime<Tz>`, meaning that e.g.
16  `dt.to_string().parse::<DateTime<Utc>>()` now correctly works on round-trip.
17  (@quodlibetor in #378)
18* Support "negative UTC" in `parse_from_rfc2822` (@quodlibetor #368 reported in
19  #102)
20* Support comparisons of DateTimes with different timezones (@dlalic in #375)
21* Many documentation improvements
22
23### Bitrot and external integration fixes
24
25* Don't use wasmbind on wasi (@coolreader18 #365)
26* Avoid deprecation warnings for `Error::description` (@AnderEnder and
27  @quodlibetor #376)
28
29### Internal improvements
30
31* Use Criterion for benchmarks (@quodlibetor)
32
33## 0.4.10
34
35### Compatibility notes
36
37* Putting some functionality behind an `alloc` feature to improve no-std
38  support (in #341) means that if you were relying on chrono with
39  `no-default-features` *and* using any of the functions that require alloc
40  support (i.e. any of the string-generating functions like `to_rfc3339`) you
41  will need to add the `alloc` feature in your Cargo.toml.
42
43### Improvements
44
45* `DateTime::parse_from_str` is more than 2x faster in some cases. (@michalsrb
46  #358)
47* Significant improvements to no-std and alloc support (This should also make
48  many format/serialization operations induce zero unnecessary allocations)
49  (@CryZe #341)
50
51### Features
52
53* Functions that were accepting `Iterator` of `Item`s (for example
54  `format_with_items`) now accept `Iterator` of `Borrow<Item>`, so one can
55  use values or references. (@michalsrb #358)
56* Add built-in support for structs with nested `Option<Datetime>` etc fields
57  (@manifest #302)
58
59### Internal/doc improvements
60
61* Use markdown footnotes on the `strftime` docs page (@qudlibetor #359)
62* Migrate from `try!` -> `?` (question mark) because it is now emitting
63  deprecation warnings and has been stable since rustc 1.13.0
64* Deny dead code
65
66## 0.4.9
67
68### Fixes
69
70* Make Datetime arithmatic adjust their offsets after discovering their new
71  timestamps (@quodlibetor #337)
72* Put wasm-bindgen related code and dependencies behind a `wasmbind` feature
73  gate. (@quodlibetor #335)
74
75## 0.4.8
76
77### Fixes
78
79* Add '0' to single-digit days in rfc2822 date format (@wyhaya #323)
80* Correctly pad DelayedFormat (@SamokhinIlya #320)
81
82### Features
83
84* Support `wasm-unknown-unknown` via wasm-bindgen (in addition to
85  emscripten/`wasm-unknown-emscripten`). (finished by @evq in #331, initial
86  work by @jjpe #287)
87
88## 0.4.7
89
90### Fixes
91
92* Disable libc default features so that CI continues to work on rust 1.13
93* Fix panic on negative inputs to timestamp_millis (@cmars #292)
94* Make `LocalResult` `Copy/Eq/Hash`
95
96### Features
97
98* Add `std::convert::From` conversions between the different timezone formats
99  (@mqudsi #271)
100* Add `timestamp_nanos` methods (@jean-airoldie #308)
101* Documentation improvements
102
103## 0.4.6
104
105### Maintenance
106
107* Doc improvements -- improve README CI verification, external links
108* winapi upgrade to 0.3
109
110## Unreleased
111
112### Features
113
114* Added `NaiveDate::from_weekday_of_month{,_opt}` for getting eg. the 2nd Friday of March 2017.
115
116## 0.4.5
117
118### Features
119
120* Added several more serde deserialization helpers (@novacrazy #258)
121* Enabled all features on the playground (@davidtwco #267)
122* Derive `Hash` on `FixedOffset` (@LuoZijun #254)
123* Improved docs (@storyfeet #261, @quodlibetor #252)
124
125## 0.4.4
126
127### Features
128
129* Added support for parsing nanoseconds without the leading dot (@emschwartz #251)
130
131## 0.4.3
132
133### Features
134
135* Added methods to DateTime/NaiveDateTime to present the stored value as a number
136  of nanoseconds since the UNIX epoch (@harkonenbade #247)
137* Added a serde serialise/deserialise module for nanosecond timestamps. (@harkonenbade #247)
138* Added "Permissive" timezone parsing which allows a numeric timezone to
139  be specified without minutes. (@quodlibetor #242)
140
141## 0.4.2
142
143### Deprecations
144
145* More strongly deprecate RustcSerialize: remove it from documentation unless
146  the feature is enabled, issue a deprecation warning if the rustc-serialize
147  feature is enabled (@quodlibetor #174)
148
149### Features
150
151* Move all uses of the system clock behind a `clock` feature, for use in
152  environments where we don't have access to the current time. (@jethrogb #236)
153* Implement subtraction of two `Date`s, `Time`s, or `DateTime`s, returning a
154  `Duration` (@tobz1000 #237)
155
156## 0.4.1
157
158### Bug Fixes
159
160* Allow parsing timestamps with subsecond precision (@jonasbb)
161* RFC2822 allows times to not include the second (@upsuper)
162
163### Features
164
165* New `timestamp_millis` method on `DateTime` and `NaiveDateTim` that returns
166  number of milliseconds since the epoch. (@quodlibetor)
167* Support exact decimal width on subsecond display for RFC3339 via a new
168  `to_rfc3339_opts` method on `DateTime` (@dekellum)
169* Use no_std-compatible num dependencies (@cuviper)
170* Add `SubsecRound` trait that allows rounding to the nearest second
171  (@dekellum)
172
173### Code Hygiene and Docs
174
175* Docs! (@alatiera @kosta @quodlibetor @kennytm)
176* Run clippy and various fixes (@quodlibetor)
177
178## 0.4.0 (2017-06-22)
179
180This was originally planned as a minor release but was pushed to a major
181release due to the compatibility concern raised.
182
183### Added
184
185- `IsoWeek` has been added for the ISO week without time zone.
186
187- The `+=` and `-=` operators against `time::Duration` are now supported for
188  `NaiveDate`, `NaiveTime` and `NaiveDateTime`. (#99)
189
190  (Note that this does not invalidate the eventual deprecation of `time::Duration`.)
191
192- `SystemTime` and `DateTime<Tz>` types can be now converted to each other via `From`.
193  Due to the obvious lack of time zone information in `SystemTime`,
194  the forward direction is limited to `DateTime<Utc>` and `DateTime<Local>` only.
195
196### Changed
197
198- Intermediate implementation modules have been flattened (#161),
199  and `UTC` has been renamed to `Utc` in accordance with the current convention (#148).
200
201  The full list of changes is as follows:
202
203  Before                                   | After
204  ---------------------------------------- | ----------------------------
205  `chrono::date::Date`                     | `chrono::Date`
206  `chrono::date::MIN`                      | `chrono::MIN_DATE`
207  `chrono::date::MAX`                      | `chrono::MAX_DATE`
208  `chrono::datetime::DateTime`             | `chrono::DateTime`
209  `chrono::naive::time::NaiveTime`         | `chrono::naive::NaiveTime`
210  `chrono::naive::date::NaiveDate`         | `chrono::naive::NaiveDate`
211  `chrono::naive::date::MIN`               | `chrono::naive::MIN_DATE`
212  `chrono::naive::date::MAX`               | `chrono::naive::MAX_DATE`
213  `chrono::naive::datetime::NaiveDateTime` | `chrono::naive::NaiveDateTime`
214  `chrono::offset::utc::UTC`               | `chrono::offset::Utc`
215  `chrono::offset::fixed::FixedOffset`     | `chrono::offset::FixedOffset`
216  `chrono::offset::local::Local`           | `chrono::offset::Local`
217  `chrono::format::parsed::Parsed`         | `chrono::format::Parsed`
218
219  With an exception of `Utc`, this change does not affect any direct usage of
220  `chrono::*` or `chrono::prelude::*` types.
221
222- `Datelike::isoweekdate` is replaced by `Datelike::iso_week` which only returns the ISO week.
223
224  The original method used to return a tuple of year number, week number and day of the week,
225  but this duplicated the `Datelike::weekday` method and it had been hard to deal with
226  the raw year and week number for the ISO week date.
227  This change isolates any logic and API for the week date into a separate type.
228
229- `NaiveDateTime` and `DateTime` can now be deserialized from an integral UNIX timestamp. (#125)
230
231  This turns out to be very common input for web-related usages.
232  The existing string representation is still supported as well.
233
234- `chrono::serde` and `chrono::naive::serde` modules have been added
235  for the serialization utilities. (#125)
236
237  Currently they contain the `ts_seconds` modules that can be used to
238  serialize `NaiveDateTime` and `DateTime` values into an integral UNIX timestamp.
239  This can be combined with Serde's `[de]serialize_with` attributes
240  to fully support the (de)serialization to/from the timestamp.
241
242  For rustc-serialize, there are separate `chrono::TsSeconds` and `chrono::naive::TsSeconds` types
243  that are newtype wrappers implementing different (de)serialization logics.
244  This is a suboptimal API, however, and it is strongly recommended to migrate to Serde.
245
246### Fixed
247
248- The major version was made to fix the broken Serde dependency issues. (#146, #156, #158, #159)
249
250  The original intention to technically break the dependency was
251  to facilitate the use of Serde 1.0 at the expense of temporary breakage.
252  Whether this was appropriate or not is quite debatable,
253  but it became clear that there are several high-profile crates requiring Serde 0.9
254  and it is not feasible to force them to use Serde 1.0 anyway.
255
256  To the end, the new major release was made with some known lower-priority breaking changes.
257  0.3.1 is now yanked and any remaining 0.3 users can safely roll back to 0.3.0.
258
259- Various documentation fixes and goodies. (#92, #131, #136)
260
261## 0.3.1 (2017-05-02)
262
263### Added
264
265- `Weekday` now implements `FromStr`, `Serialize` and `Deserialize`. (#113)
266
267  The syntax is identical to `%A`, i.e. either the shortest or the longest form of English names.
268
269### Changed
270
271- Serde 1.0 is now supported. (#142)
272
273  This is technically a breaking change because Serde 0.9 and 1.0 are not compatible,
274  but this time we decided not to issue a minor version because
275  we have already seen Serde 0.8 and 0.9 compatibility problems even after 0.3.0 and
276  a new minor version turned out to be not very helpful for this kind of issues.
277
278### Fixed
279
280- Fixed a bug that the leap second can be mapped wrongly in the local time zone.
281  Only occurs when the local time zone is behind UTC. (#130)
282
283## 0.3.0 (2017-02-07)
284
285The project has moved to the [Chronotope](https://github.com/chronotope/) organization.
286
287### Added
288
289- `chrono::prelude` module has been added. All other glob imports are now discouraged.
290
291- `FixedOffset` can be added to or subtracted from any timelike types.
292
293    - `FixedOffset::local_minus_utc` and `FixedOffset::utc_minus_local` methods have been added.
294      Note that the old `Offset::local_minus_utc` method is gone; see below.
295
296- Serde support for non-self-describing formats like Bincode is added. (#89)
297
298- Added `Item::Owned{Literal,Space}` variants for owned formatting items. (#76)
299
300- Formatting items and the `Parsed` type have been slightly adjusted so that
301  they can be internally extended without breaking any compatibility.
302
303- `Weekday` is now `Hash`able. (#109)
304
305- `ParseError` now implements `Eq` as well as `PartialEq`. (#114)
306
307- More documentation improvements. (#101, #108, #112)
308
309### Changed
310
311- Chrono now only supports Rust 1.13.0 or later (previously: Rust 1.8.0 or later).
312
313- Serde 0.9 is now supported.
314  Due to the API difference, support for 0.8 or older is discontinued. (#122)
315
316- Rustc-serialize implementations are now on par with corresponding Serde implementations.
317  They both standardize on the `std::fmt::Debug` textual output.
318
319  **This is a silent breaking change (hopefully the last though).**
320  You should be prepared for the format change if you depended on rustc-serialize.
321
322- `Offset::local_minus_utc` is now `Offset::fix`, and returns `FixedOffset` instead of a duration.
323
324  This makes every time zone operation operate within a bias less than one day,
325  and vastly simplifies many logics.
326
327- `chrono::format::format` now receives `FixedOffset` instead of `time::Duration`.
328
329- The following methods and implementations have been renamed and older names have been *removed*.
330  The older names will be reused for the same methods with `std::time::Duration` in the future.
331
332    - `checked_*` → `checked_*_signed` in `Date`, `DateTime`, `NaiveDate` and `NaiveDateTime` types
333
334    - `overflowing_*` → `overflowing_*_signed` in the `NaiveTime` type
335
336    - All subtraction implementations between two time instants have been moved to
337      `signed_duration_since`, following the naming in `std::time`.
338
339### Fixed
340
341- Fixed a panic when the `Local` offset receives a leap second. (#123)
342
343### Removed
344
345- Rustc-serialize support for `Date<Tz>` types and all offset types has been dropped.
346
347  These implementations were automatically derived and never had been in a good shape.
348  Moreover there are no corresponding Serde implementations, limiting their usefulness.
349  In the future they may be revived with more complete implementations.
350
351- The following method aliases deprecated in the 0.2 branch have been removed.
352
353    - `DateTime::num_seconds_from_unix_epoch` (→ `DateTime::timestamp`)
354    - `NaiveDateTime::from_num_seconds_from_unix_epoch` (→ `NaiveDateTime::from_timestamp`)
355    - `NaiveDateTime::from_num_seconds_from_unix_epoch_opt` (→ `NaiveDateTime::from_timestamp_opt`)
356    - `NaiveDateTime::num_seconds_unix_epoch` (→ `NaiveDateTime::timestamp`)
357
358- Formatting items are no longer `Copy`, except for `chrono::format::Pad`.
359
360- `chrono::offset::add_with_leapsecond` has been removed.
361  Use a direct addition with `FixedOffset` instead.
362
363## 0.2.25 (2016-08-04)
364
365This is the last version officially supports Rust 1.12.0 or older.
366
367(0.2.24 was accidentally uploaded without a proper check for warnings in the default state,
368and replaced by 0.2.25 very shortly. Duh.)
369
370### Added
371
372- Serde 0.8 is now supported. 0.7 also remains supported. (#86)
373
374### Fixed
375
376- The deserialization implementation for rustc-serialize now properly verifies the input.
377  All serialization codes are also now thoroughly tested. (#42)
378
379## 0.2.23 (2016-08-03)
380
381### Added
382
383- The documentation was greatly improved for several types,
384  and tons of cross-references have been added. (#77, #78, #80, #82)
385
386- `DateTime::timestamp_subsec_{millis,micros,nanos}` methods have been added. (#81)
387
388### Fixed
389
390- When the system time records a leap second,
391  the nanosecond component was mistakenly reset to zero. (#84)
392
393- `Local` offset misbehaves in Windows for August and later,
394  due to the long-standing libtime bug (dates back to mid-2015).
395  Workaround has been implemented. (#85)
396
397## 0.2.22 (2016-04-22)
398
399### Fixed
400
401- `%.6f` and `%.9f` used to print only three digits when the nanosecond part is zero. (#71)
402- The documentation for `%+` has been updated to reflect the current status. (#71)
403
404## 0.2.21 (2016-03-29)
405
406### Fixed
407
408- `Fixed::LongWeekdayName` was unable to recognize `"sunday"` (whoops). (#66)
409
410## 0.2.20 (2016-03-06)
411
412### Changed
413
414- `serde` dependency has been updated to 0.7. (#63, #64)
415
416## 0.2.19 (2016-02-05)
417
418### Added
419
420- The documentation for `Date` is made clear about its ambiguity and guarantees.
421
422### Fixed
423
424- `DateTime::date` had been wrong when the local date and the UTC date is in disagreement. (#61)
425
426## 0.2.18 (2016-01-23)
427
428### Fixed
429
430- Chrono no longer pulls a superfluous `rand` dependency. (#57)
431
432## 0.2.17 (2015-11-22)
433
434### Added
435
436- Naive date and time types and `DateTime` now have a `serde` support.
437  They serialize as an ISO 8601 / RFC 3339 string just like `Debug`. (#51)
438
439## 0.2.16 (2015-09-06)
440
441### Added
442
443- Added `%.3f`, `%.6f` and `%.9f` specifier for formatting fractional seconds
444  up to 3, 6 or 9 decimal digits. This is a natural extension to the existing `%f`.
445  Note that this is (not yet) generic, no other value of precision is supported. (#45)
446
447### Changed
448
449- Forbade unsized types from implementing `Datelike` and `Timelike`.
450  This does not make a big harm as any type implementing them should be already sized
451  to be practical, but this change still can break highly generic codes. (#46)
452
453### Fixed
454
455- Fixed a broken link in the `README.md`. (#41)
456
457## 0.2.15 (2015-07-05)
458
459### Added
460
461- Padding modifiers `%_?`, `%-?` and `%0?` are implemented.
462  They are glibc extensions which seem to be reasonably widespread (e.g. Ruby).
463
464- Added `%:z` specifier and corresponding formatting items
465  which is essentially the same as `%z` but with a colon.
466
467- Added a new specifier `%.f` which precision adapts from the input.
468  This was added as a response to the UX problems in the original nanosecond specifier `%f`.
469
470### Fixed
471
472- `Numeric::Timestamp` specifier (`%s`) was ignoring the time zone offset when provided.
473
474- Improved the documentation and associated tests for `strftime`.
475
476## 0.2.14 (2015-05-15)
477
478### Fixed
479
480- `NaiveDateTime +/- Duration` or `NaiveTime +/- Duration` could have gone wrong
481  when the `Duration` to be added is negative and has a fractional second part.
482  This was caused by an underflow in the conversion from `Duration` to the parts;
483  the lack of tests for this case allowed a bug. (#37)
484
485## 0.2.13 (2015-04-29)
486
487### Added
488
489- The optional dependency on `rustc_serialize` and
490  relevant `Rustc{En,De}codable` implementations for supported types has been added.
491  This is enabled by the `rustc-serialize` Cargo feature. (#34)
492
493### Changed
494
495- `chrono::Duration` reexport is changed to that of crates.io `time` crate.
496  This enables Rust 1.0 beta compatibility.
497
498## 0.2.4 (2015-03-03)
499
500### Fixed
501
502- Clarified the meaning of `Date<Tz>` and fixed unwanted conversion problem
503  that only occurs with positive UTC offsets. (#27)
504
505## 0.2.3 (2015-02-27)
506
507### Added
508
509- `DateTime<Tz>` and `Date<Tz>` is now `Copy`/`Send` when `Tz::Offset` is `Copy`/`Send`.
510  The implementations for them were mistakenly omitted. (#25)
511
512### Fixed
513
514- `Local::from_utc_datetime` didn't set a correct offset. (#26)
515
516## 0.2.1 (2015-02-21)
517
518### Changed
519
520- `DelayedFormat` no longer conveys a redundant lifetime.
521
522## 0.2.0 (2015-02-19)
523
524### Added
525
526- `Offset` is splitted into `TimeZone` (constructor) and `Offset` (storage) types.
527  You would normally see only the former, as the latter is mostly an implementation detail.
528  Most importantly, `Local` now can be used to directly construct timezone-aware values.
529
530  Some types (currently, `UTC` and `FixedOffset`) are both `TimeZone` and `Offset`,
531  but others aren't (e.g. `Local` is not what is being stored to each `DateTime` values).
532
533- `LocalResult::map` convenience method has been added.
534
535- `TimeZone` now allows a construction of `DateTime` values from UNIX timestamp,
536  via `timestamp` and `timestamp_opt` methods.
537
538- `TimeZone` now also has a method for parsing `DateTime`, namely `datetime_from_str`.
539
540- The following methods have been added to all date and time types:
541
542    - `checked_add`
543    - `checked_sub`
544    - `format_with_items`
545
546- The following methods have been added to all timezone-aware types:
547
548    - `timezone`
549    - `with_timezone`
550    - `naive_utc`
551    - `naive_local`
552
553- `parse_from_str` method has been added to all naive types and `DateTime<FixedOffset>`.
554
555- All naive types and instances of `DateTime` with time zones `UTC`, `Local` and `FixedOffset`
556  implement the `FromStr` trait. They parse what `std::fmt::Debug` would print.
557
558- `chrono::format` has been greatly rewritten.
559
560    - The formatting syntax parser is modular now, available at `chrono::format::strftime`.
561
562    - The parser and resolution algorithm is also modular, the former is available at
563      `chrono::format::parse` while the latter is available at `chrono::format::parsed`.
564
565    - Explicit support for RFC 2822 and 3339 syntaxes is landed.
566
567    - There is a minor formatting difference with atypical values,
568      e.g. for years not between 1 BCE and 9999 CE.
569
570### Changed
571
572- Most uses of `Offset` are converted to `TimeZone`.
573  In fact, *all* user-facing code is expected to be `Offset`-free.
574
575- `[Naive]DateTime::*num_seconds_from_unix_epoch*` methods have been renamed to
576  simply `timestamp` or `from_timestamp*`. The original names have been deprecated.
577
578### Removed
579
580- `Time` has been removed. This also prompts a related set of methods in `TimeZone`.
581
582  This is in principle possible, but in practice has seen a little use
583  because it can only be meaningfully constructed via an existing `DateTime` value.
584  This made many operations to `Time` unintuitive or ambiguous,
585  so we simply let it go.
586
587  In the case that `Time` is really required, one can use a simpler `NaiveTime`.
588  `NaiveTime` and `NaiveDate` can be freely combined and splitted,
589  and `TimeZone::from_{local,utc}_datetime` can be used to convert from/to the local time.
590
591- `with_offset` method has been removed. Use `with_timezone` method instead.
592  (This is not deprecated since it is an integral part of offset reform.)
593
594## 0.1.14 (2015-01-10)
595
596### Added
597
598- Added a missing `std::fmt::String` impl for `Local`.
599
600## 0.1.13 (2015-01-10)
601
602### Changed
603
604- Most types now implement both `std::fmt::Show` and `std::fmt::String`,
605  with the former used for the stricter output and the latter used for more casual output.
606
607### Removed
608
609- `Offset::name` has been replaced by a `std::fmt::String` implementation to `Offset`.
610
611## 0.1.12 (2015-01-08)
612
613### Removed
614
615- `Duration + T` no longer works due to the updated impl reachability rules.
616  Use `T + Duration` as a workaround.
617
618## 0.1.4 (2014-12-13)
619
620### Fixed
621
622- Fixed a bug that `Date::and_*` methods with an offset that can change the date are
623  off by one day.
624
625## 0.1.3 (2014-11-28)
626
627### Added
628
629- `{Date,Time,DateTime}::with_offset` methods have been added.
630
631- `LocalResult` now implements a common set of traits.
632
633- `LocalResult::and_*` methods have been added.
634  They are useful for safely chaining `LocalResult<Date<Off>>` methods
635  to make `LocalResult<DateTime<Off>>`.
636
637### Changed
638
639- `Offset::name` now returns `SendStr`.
640
641- `{Date,Time} - Duration` overloadings are now allowed.
642
643## 0.1.2 (2014-11-24)
644
645### Added
646
647- `Duration + Date` overloading is now allowed.
648
649### Changed
650
651- Chrono no longer needs `num` dependency.
652
653## 0.1.0 (2014-11-20)
654
655The initial version that was available to `crates.io`.
656
657