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