668 Commits

Author SHA1 Message Date
Martin Kröning
7d7ceb4539 Serde: Deserialize units as None on optional value 2020-06-05 16:25:43 -04:00
Marc Schreiber
5a1a80fbff
Impl From variants for DateTime<Utc> and js_sys::Date (#424) 2020-06-05 16:24:22 -04:00
Xavier L'Heureux
beb2c6eefc
Update patch version of time to add Redox support (#425)
The 0.1 version of the time crates supports Redox up from version 0.1.43.
Update the dependency to allow redox to use chrono.
2020-06-05 16:22:58 -04:00
fx-kirin
bd636d811e
Fix serde with _option macro bug. (#429)
* fixing option handling.

* Add a test for serde option handling in bincode

Co-authored-by: Brandon W Maister <quodlibetor@gmail.com>
2020-06-05 16:14:49 -04:00
azarus
d4116e1257
fix docs: milliseconds -> seconds (#427) 2020-06-05 15:09:24 -04:00
Brandon W Maister
7e6b59b566
Merge pull request #428 from quodlibetor/fix-readme
Fix build
2020-06-05 15:04:09 -04:00
Brandon W Maister
b9af436698 Fix borrow rules for 1.13.0 2020-06-05 14:29:32 -04:00
Brandon W Maister
321d760d69 Fix function inclusion with serde and no other default features 2020-06-05 14:11:24 -04:00
Brandon W Maister
0ca999e1fa Fix format with format_inner
padding should only be applied after all inner formats have been built.
2020-05-27 22:49:20 -04:00
Brandon W Maister
8e1fdeaf95 Fix README generation
A previous PR updated the README instead of src/lib.rs, which should have been
caught by CI but was not.
2020-05-27 09:38:01 -04:00
Guillaume Gomez
768de26015
Replace "cfg(test)" with "cfg(doctest)" for readme testing 2020-05-07 11:54:52 +02:00
Brandon W Maister
8060089730
Merge pull request #408 from sergeyt/format_item
extract format_item function
2020-04-10 15:33:33 -04:00
Benoît Courtine
04a58593b3
Add a link to chrono_ext crate (and sources), for non ISO weeks handling (cf. issues #139 and #405). (#406) 2020-04-10 15:27:38 -04:00
Sergey Todyshev
f450ae3237 extract format_item function 2020-04-08 22:07:01 +07:00
Nathan Wilson
2b76243d36
Removed unnecessary parentheses. (#401) 2020-03-29 12:59:44 -04:00
Brandon W Maister
e493218d68
Update changelog for 0.4.11 (#399) v0.4.11 2020-03-07 16:16:02 -05:00
Brandon W Maister
725d88e0dc
Merge pull request #395 from vallentin/master
Fixed typos
2020-03-07 15:34:35 -05:00
Brandon W Maister
9041ce5b05
Merge pull request #396 from ignatenkobrain/fix-cargo-test
Fix cargo test with latest serde_json
2020-03-07 15:33:44 -05:00
Igor Gnatenko
7d37413665
Fix cargo test with latest serde_json
```rust
[  117s] error: expected item, found `"serde_json requires that either `std` (default) or `alloc` feature is enabled"`
[  117s]  --> /usr/share/cargo/registry/serde_json-1.0.48/src/features_check/error.rs:1:1
[  117s]   |
[  117s] 1 | "serde_json requires that either `std` (default) or `alloc` feature is enabled"
[  117s]   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected item
```
2020-02-18 16:57:21 +01:00
vallentin
89da02ebd5 Fixed typos 2020-02-11 21:08:21 +01:00
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
Brandon W Maister
4ad95ee602
Merge pull request #378 from quodlibetor/round-trip-display
support round tripping display <-> datetime
2019-12-30 17:15:51 -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
Dunja Lalic
ad8644ea57 Fixes #354 2019-12-26 20:32:45 -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
b5015c634b
Merge pull request #348 from gThorondorsen/test-num_days_from_ce
Test `Datelike::num_days_from_ce` against an alternative implementation
2019-12-23 17:19:43 -05:00
Brandon W Maister
d9d0728f51
Merge pull request #374 from quodlibetor/fix-playground-and-docs
Change docs and playground features so that it compiles
2019-12-23 14:16:02 -05:00
Brandon W Maister
6daed98412
Merge pull request #376 from AnderEnder/remove-deprecated-error-description
Allow deprecated Error::description and replace it with a stub implementation.
2019-12-23 13:48:56 -05:00
Brandon W Maister
536ac86511 Add bench for new implementation
Unfortunately it seems to be slightly more than twice as slow. On the plus
side, that is some justification for the existing optimizations.
2019-12-23 13:46:45 -05:00
Gwaihir Thorondorsen
3e592d4565 Test Datelike::num_days_from_ce against an alternative implementation 2019-12-23 13:28:46 -05:00
Brandon W Maister
5ca6ff5afc Make it harder to accidentally use private features
In particular if built with `--all-features` or `features = "all"` we don't
want to accidentally make it look like `YearFlags` are something that people
should use. So: hide it from docs and put it behind a dunder.
2019-12-23 13:26:05 -05:00
Brandon W Maister
4f73f9423b Make criterion a dev dependency
It's much less risky than making it an optional dependency, even if it does
mean that everyone working on chrono has to compile it.
2019-12-23 12:51:11 -05:00
Brandon W Maister
977ad60391 allow_deprecated on stub Error::description for rust 1.13 2019-12-23 12:38:25 -05:00
Andrii Radyk
a42c5b22cd remove deprecated Error::description 2019-12-17 09:42:32 +01:00
Brandon W Maister
a5e2796931 Change docs and playground features so that it compiles
All features includes some things that are nightly only.

Fixes #373
2019-12-13 11:10:49 -08:00
Brandon W Maister
df0e6ae8f6
Merge pull request #370 from quodlibetor/rfc2822-is-http-and-email
Document that rfc2822 is what is used for http and email headers
2019-11-30 19:46:05 -05:00
Brandon W Maister
495243ae3c
Merge pull request #369 from quodlibetor/finish-criterion
Finish moving all benchmarks to criterion
2019-11-30 19:45:37 -05:00
Brandon W Maister
d0dbc61b69 Make criterion an optional dependency
So that it doesn't slow down every user's builds and and CI
2019-11-30 18:40:28 -05:00
Brandon W Maister
7a1cd09b86 Document that rfc2822 is what is used for http and email headers
Closes #328
2019-11-30 18:25:36 -05:00
Brandon W Maister
4f1c35827f Finish moving all benchmarks to criterion
I didn't delete some, apparently, and an internal struct had to be made public
to get its benchmark to work.
2019-11-30 18:11:03 -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
19dd051d22
Merge pull request #365 from coolreader18/fix-wasi
Add support for compilation on wasm32-wasi
2019-11-29 15:03:27 -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
596aa19104
Merge pull request #363 from quodlibetor/use-criterion-benchmarks
switch to using criterion for benchmarks
2019-11-29 14:06:43 -05:00