Commit Graph

57 Commits

Author SHA1 Message Date
Brandon W Maister 4837b568c2
Merge pull request #381 from waldyrious/same-to_same-as
Reword 'same to' → 'same as'
2019-12-30 17:17:46 -05:00
Brandon W Maister 9397ab2b47
Merge pull request #375 from dlalic/354
Support comparison between dts with different timezones. Fixes #354
2019-12-30 17:16:06 -05:00
Waldir Pimenta 176dfeff87 Reword 'same to' --> 'same as' 2019-12-29 22:27:59 +00:00
Brandon W Maister b9c967b2ac support round tripping display <-> datetime
This extends `FromStr` to allow either a `T` or a ` ` (space) as the delimiter
between the date and the time, and, because of the fact that the `Z`
parser-specifier is shared with the Fixed notation, extends the fixed notation
to support `UTC` in addition to `Z` as the zero-offset.

IMO this Fixes #147
2019-12-27 13:57:02 -05:00
Brandon W Maister 3b295ccb8f Add doctest for comparison between timestamps with different time_zones 2019-12-27 13:49:53 -05:00
Brandon W Maister b9cd0ce803
Merge pull request #270 from asayers/from_ymwd
Construct a NaiveDate by specifying eg. "the 2nd Friday of March 2017"
2019-12-26 20:17:17 -05:00
Brandon W Maister 5d16648df4 rename from_ymwd -> from_weekday_of_month 2019-12-23 17:33:44 -05:00
Brandon W Maister b10e430b1f
Merge pull request #368 from quodlibetor/support-negative-utc-in-rfc2822
Support -0000 as a valid UTC tz in rfc2822
2019-11-30 17:59:22 -05:00
Brandon W Maister b553798f86 Support -0000 as a valid UTC tz in rfc2822
This is a time that is commonly set in some environments, and RFC 5322
explicitly clarifies that we should treat -0000 as UTC[1][2] when interpretting
rfc2822.

Fixes #102

[1]: https://github.com/chronotope/chrono/issues/102#issuecomment-557846931
[2]: https://tools.ietf.org/html/rfc5322#section-3.3
2019-11-30 16:48:35 -05:00
Brandon W Maister 00e6edd457
Merge pull request #367 from quodlibetor/0_4_10-compat-notes
Add compatility notes about the new alloc feature in 0.4.10
2019-11-29 15:01:00 -05:00
Brandon W Maister 3532e33ac2 Add compatility notes about the new alloc feature in 0.4.10
Closes #364
2019-11-29 14:19:22 -05:00
Brandon W Maister 8de2cc375f switch to using criterion for benchmarks
It has a ton of great features[1], including stronger statistical signifance
tests, making comparisons to previous or baseline runs, nice plots, and being
able to be run on stable.

1: https://bheisler.github.io/criterion.rs/book/
2019-11-24 13:51:27 -05:00
Brandon W Maister 41700d101e Remove unused constant, deny(dead_code) 2019-11-23 19:58:20 -05:00
Brandon W Maister 670561b4c1 Prepare for and Bump Chrono version to 0.4.10 2019-11-23 19:19:04 -05:00
Michal Srb 05acc869b9 Accept Borrow<Item> as items
The parse::parse and format::format functions accepted Iterator of owned
Items. While it is sometimes convenient to pass in the owned values,
neither of the functions really need to own them, so references would
be enough. The Borrow trait allows us to pass in Iterator over values,
references, boxes, etc.

According to RFC 1105 this is a minor change, because it shouldn't break
any existing code. And chrono is in pre-1.0 version anyway.

This allows us to remove multiple cloned() calls which speeds up parsing
and formating:

 name                                                 control ns/iter  remove-cloned ns/iter  diff ns/iter   diff %  speedup
 datetime::tests::bench_datetime_from_str             712              582                            -130  -18.26%   x 1.22
 datetime::tests::bench_datetime_parse_from_rfc2822   252              244                              -8   -3.17%   x 1.03
 datetime::tests::bench_datetime_parse_from_rfc3339   242              239                              -3   -1.24%   x 1.01
2019-11-23 23:34:59 +01:00
Brandon W Maister 2839d8d7db Put wasm-bindgen and js-sys behind a wasm-bindgen feature gate
Fixes #334
2019-09-03 09:05:15 -04:00
Brandon W Maister 6429cd2780 Add CHANGELOG entry for wasm-unknown-unknown
Features added in #287 and #331
2019-08-31 15:22:01 -04:00
Brandon W Maister a448800727 Add CHANGELOG entry for upcoming unreleased changes 2019-06-25 09:44:13 -04:00
Brandon W Maister 579679b9c3 Add changelog entry for 0.4.7 2019-06-21 17:11:01 -04:00
Mahmoud Al-Qudsi 43447e5dbf Update Changelog to mention `std::convert::From` conversions 2019-04-08 10:15:19 -05:00
Alex Sayers 892bbf3f3a Add NaiveDate::from_ymwd_opt, implement from_ymwd in terms of it 2018-08-13 11:29:02 +09:00
Alex Sayers 4ffd411654 Add NaiveDate::from_ymwd
This contructor allows you to make a NaiveDate by specifying eg. "the
2nd Friday of March 2017".  It contains a couple of panics, but these
are consistent with the behaviour of the other NaiveDate constructors.
2018-08-13 11:29:02 +09:00
Brandon W Maister 8fceba82f4 Bump Chrono version to 0.4.5 2018-07-28 17:12:03 -04:00
Brandon W Maister b975d7a2ff Add another change to the changelog 2018-07-28 17:09:40 -04:00
Brandon W Maister ffb27b8cc7 Add changelog entries for already-merged changes 2018-07-28 15:24:48 -04:00
Brandon W Maister 237042365e Update for 0.4.4 2018-06-23 17:32:44 -04:00
Evan Schwartz 074e92fc63 Document millisecond format without the dot 2018-06-12 10:51:36 -04:00
Brandon W Maister f1852a6d21 Update changelog with TZ Offset Permissive 2018-06-10 21:35:41 -04:00
Thomas Bytheway 5d86c53679 Updated Changelog 2018-05-24 13:49:23 +01:00
Brandon W Maister 97dbfd02ab Bump version for 0.4.2 release 2018-04-07 17:51:56 -04:00
Brandon W Maister 1c4fc66323 Update changelog 2018-04-03 22:36:08 -04:00
Brandon W Maister 39ca2e622c Deprecated warnings in cargo output for rustc-serialize feature
Unfortunately due to rust-lang/rust#39935 placing the annotation on the `impl`s
of `Encodable`/`Decodable` for the various items have no effect whatsoever, so
we need to place it on some type that chrono actually uses internally. The only
*type* that I can find that only exists for rustc-serialize only is the
 `TsSeconds` struct.

So, marking TsSeconds deprecated causes Chrono's internal uses of `TsSeconds`
to emit deprecation warnings, both in our builds and for packages that specify
Chrono as a dependency with the `rustc-serialize` feature active. This means
that the current commit will cause a `warning: use of deprecated item:
RustcSerialize will be removed before chrono 1.0, use Serde instead` to appear
in `cargo build` output.

Unfortunately I don't think that it's possible for downstream crates to disable
the warning the warning in any way other than actually switching to Serde or
using an older chrono. That's the reason for all the `#[allow(deprecated)]`
through the code, it means that the warning appears almost exactly once,
instead of dozens of times.
2018-03-29 14:32:39 -04:00
Brandon W Maister d889e3838f Update changelog for 0.4.1 2018-03-26 22:10:45 -04:00
Kang Seonghoon fe529c8016
0.4.0: Mass renaming, `IsoWeek`, `SystemTime` supports, serde utils.
Starting from this version the `CHANGELOG.md` file is the canonical
source for the list of significant changes. See the file for details.

Fixes #146.
Fixes #159.
2017-06-22 02:59:46 +09:00
Kang Seonghoon dcf193323b
0.3.1: Minor maintenance release, Serde 1.0 support.
- Serde 1.0 is now supported. (#142)

  Technically this is a breaking change, but the minor version was not
  effective in avoiding dependency breakages anyway (because Cargo
  will silently compile two versions of crates). Provided that this is
  likely the last breakage from Serde, we tolerate
  this more-than-last-minute change in this version.

- `Weekday` now implements `FromStr`, `Serialize` and `Deserialize`.
  (#113)

- Fixed a bug that the leap second can be mapped wrongly
  in the local tz with some conditions. (#130)

- Some changes to the tests to avoid previously known issues.

Note that the actually published version is very slightly different
from the repository because no published version of bincode supports
Serde 1.0 right now.
2017-05-02 03:13:00 +09:00
Kang Seonghoon db9b98f691
0.3.0: Planned breaking changes to the existing interface.
So this is a much delayed major release, but this should not really
change how you use Chrono---only the "required" breakages have been
done (e.g. anything hindering API evolution). The "big" release used to
be 0.3, but due to the dependency changes we are forced to push that to
0.4. I've took this opportunity to push all known planned breaking
changes to 0.3, so this should be quite stable for a moment.

See `CHANGELOG.md` for the full list of changes, but most importantly:

- `chrono::prelude` module has been added for proper glob imports.

- `FixedOffset` is now the official "value" type for time zone offsets.

- Serde 0.9 support has landed, and serialization format used by
  rustc-serialize and Serde has been now synchronized.

- Formatting items have been slightly adjusted to be future-proof.

Fixes #126.
2017-02-07 05:52:07 +09:00
Kang Seonghoon de4df91421
Removed all remaining mentions of rust-chrono (very old name). 2017-02-06 06:15:57 +09:00
Kang Seonghoon cb9fd7fbe1 0.2.25: Fixed warnings from 0.2.24. Duh. 2016-08-04 03:44:31 +09:00
Kang Seonghoon 603ac1bc1c 0.2.24: Serialization updates.
- Serde 0.8 is now supported. (#86)

- The deserialization implementation for rustc-serialize now properly
  verifies the input. Also tons of tests have been added. (#42)
2016-08-04 03:37:33 +09:00
Kang Seonghoon ae9be4a6f3 0.2.23: Documentation and minor bug fixes.
- Tons of documentation updates! (#77, #78, #80, #82 and my own
  changes as well)

- `DateTime::timestamp_subsec_{millis,micros,nanos}` methods have
  been added. (#81)

- When the system time records a leap second,
  the nanosecond component was mistakenly reset to zero. (#84)

- `Local` offset misbehaves in Windows for August and later,
  due to the long-standing libtime bug (dates back to mid-2015).
  Workaround has been implemented. (#85)
2016-08-03 01:18:33 +09:00
Kang Seonghoon 8efc85ce9f 0.2.22: Fixes on `%.6f` and `%.9f` on whole seconds.
- `%.6f` and `%.9f` used to print only three digits
  when the nanosecond part is zero. (#71)

- The documentation for `%+` has been updated
  to reflect the current status. (#71)
2016-04-22 08:54:57 +09:00
Kang Seonghoon d869643a33 0.2.21: a slight bug fix.
- `Fixed::LongWeekdayName` was unable to recognize `"sunday"`. (#66)
- Slight documentation addition. (#65)
2016-03-29 09:00:49 +09:00
Kang Seonghoon 530a5ee10b 0.2.20: Updated `serde` dependency. (#63, #64) 2016-03-06 00:19:29 +09:00
Kang Seonghoon aa6df02436 0.2.19: `DateTime::date` (and indirectly, `Local::today`) fix. (#61) 2016-02-05 01:35:43 +09:00
Kang Seonghoon d789e3e493 0.2.18: Get rid of a superfluous `rand` dependency. (#57) 2016-01-23 14:41:12 +09:00
Kang Seonghoon 2c11364410 0.2.17: Added a serde support for date and time types. (#51) 2015-11-22 03:27:08 +09:00
Kang Seonghoon ed3727931f 0.2.16: mainly maintenance changes, with a minor formatting addition.
- Added `%.3f`, `%.6f` and `%.9f` specifier for formatting fractional seconds
  up to 3, 6 or 9 decimal digits. This is a natural extension to the existing `%f`.
  Note that this is (not yet) generic, no other value of precision is supported. (#45)

- Forbade unsized types from implementing `Datelike` and `Timelike`.
  This does not make a big harm as any type implementing them should be already sized
  to be practical, but this change still can break highly generic codes. (#46)

- Fixed a broken link in the `README.md`. (#41)

- Tons of supporting examples for the documentation have been added. More to come.
2015-09-06 21:46:03 +09:00
Kang Seonghoon 01b3ed2ada 0.2.15: more formatting specifiers and documentation fixes.
- Added padding modifiers `%_?`, `%-?` and `%0?`.

- Added new specifiers `%:z` and `%.f`.

- When `%s` specifier is used with a time zone, the time zone offset was
  ignored. This has been fixed.

- Several documentation fixes including the misleading presence of
  colons in the `%z` specifier. `%:z` was introduced partly due to this.
2015-07-05 15:26:30 +09:00
Kang Seonghoon 3220d0f15d updated `CHANGELOG.md`. 2015-07-05 15:06:38 +09:00
Kang Seonghoon 0466a4bf30 documentation fix and some slight bug fix.
- The time zone offset is printed without a colon, but the documentation
  had that inverted. (#39)

- `chrono::format::strftime`'s specifier table is tested throughly.

- When `%s` specifier is used with a time zone, the time zone offset was
  ignored. This has been fixed.
2015-05-29 02:26:01 +09:00