Commit Graph

151 Commits

Author SHA1 Message Date
Alex Mikhalev 538f303ed5 Added impl FromStr, Serialize, Deserialize for Weekday 2016-12-06 20:07:39 -07:00
Alex Mikhalev cebb2483d9 Added #[derive(Hash)] for Weekday enum
This is so it can at least be used in a HashSet, if not in a BTreeSet
because it does not impl Ord.
2016-11-14 08:53:58 -07:00
Jim Turner 881e6c2dcc Clarify that Duration is an "accurate" duration
The ISO 8601 format includes both "nominal" (year, month, week, and
day) and "accurate" (hour, minute, and second) components. However, the
`Duration` type only represents an "accurate" duration because
arithmetic with nominal components is not defined in ISO 8601.
2016-10-04 19:07:11 -04: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 00858c6363 More cross-references. 2016-08-02 20:52:45 +09:00
Kang Seonghoon 4475ee5a48 More cross links and detailed examples for docs.
Also fixed some broken links (hard to catch from source files).
2016-08-01 03:23:46 +09:00
Kang Seonghoon 932e29aa94 Better documentation and cross-references for naive types. 2016-08-01 01:02:32 +09:00
Kang Seonghoon f41de9b41f Documentation cleanup.
- The main documentation (`src/lib.rs` AND `README.md`) now properly
  link to other types when rendered.

- The role of `TimeZone` trait is explained more thoroughly.

(Hopefully) fixes #82.
2016-07-26 03:48:08 +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
Danilo Bargen 6d9f91874b Clarify timezone conversion in docs 2016-03-23 09:50:23 +01: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 d3384780d0 rustfmt'ed src/lib.rs (only). 2016-01-23 14:37:29 +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
Martin Risell Lilja d8f2a3e7d8 Added serde support for DateTime, NaiveDate, NaiveTime and NaiveDateTime. 2015-11-19 00:12:13 +01: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 acf4eab102 more documentation, finishing examples for chrono::naive::date. 2015-09-06 21:30:09 +09:00
Corey Farwell 98bc0abad9 Fix nightly warnings related to lifetimes
The following warnings appear:

```
   Compiling chrono v0.2.15 (file:///Users/coreyf/Development/rust/rust-chrono)
src/lib.rs:504:5: 504:52 warning: the trait `core::marker::Sized` is not implemented for the type `Self` [E0277]
src/lib.rs:504     fn with_year(&self, year: i32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:504:5: 504:52 help: run `rustc --explain E0277` to see a detailed explanation
src/lib.rs:504:5: 504:52 note: `Self` does not have a constant size known at compile-time
src/lib.rs:504     fn with_year(&self, year: i32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:504:5: 504:52 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
src/lib.rs:504     fn with_year(&self, year: i32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:504:5: 504:52 note: required by `core::option::Option`
src/lib.rs:504     fn with_year(&self, year: i32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:509:5: 509:54 warning: the trait `core::marker::Sized` is not implemented for the type `Self` [E0277]
src/lib.rs:509     fn with_month(&self, month: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:509:5: 509:54 help: run `rustc --explain E0277` to see a detailed explanation
src/lib.rs:509:5: 509:54 note: `Self` does not have a constant size known at compile-time
src/lib.rs:509     fn with_month(&self, month: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:509:5: 509:54 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
src/lib.rs:509     fn with_month(&self, month: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:509:5: 509:54 note: required by `core::option::Option`
src/lib.rs:509     fn with_month(&self, month: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:514:5: 514:56 warning: the trait `core::marker::Sized` is not implemented for the type `Self` [E0277]
src/lib.rs:514     fn with_month0(&self, month0: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:514:5: 514:56 help: run `rustc --explain E0277` to see a detailed explanation
src/lib.rs:514:5: 514:56 note: `Self` does not have a constant size known at compile-time
src/lib.rs:514     fn with_month0(&self, month0: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:514:5: 514:56 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
src/lib.rs:514     fn with_month0(&self, month0: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:514:5: 514:56 note: required by `core::option::Option`
src/lib.rs:514     fn with_month0(&self, month0: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:519:5: 519:50 warning: the trait `core::marker::Sized` is not implemented for the type `Self` [E0277]
src/lib.rs:519     fn with_day(&self, day: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:519:5: 519:50 help: run `rustc --explain E0277` to see a detailed explanation
src/lib.rs:519:5: 519:50 note: `Self` does not have a constant size known at compile-time
src/lib.rs:519     fn with_day(&self, day: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:519:5: 519:50 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
src/lib.rs:519     fn with_day(&self, day: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:519:5: 519:50 note: required by `core::option::Option`
src/lib.rs:519     fn with_day(&self, day: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:524:5: 524:52 warning: the trait `core::marker::Sized` is not implemented for the type `Self` [E0277]
src/lib.rs:524     fn with_day0(&self, day0: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:524:5: 524:52 help: run `rustc --explain E0277` to see a detailed explanation
src/lib.rs:524:5: 524:52 note: `Self` does not have a constant size known at compile-time
src/lib.rs:524     fn with_day0(&self, day0: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:524:5: 524:52 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
src/lib.rs:524     fn with_day0(&self, day0: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:524:5: 524:52 note: required by `core::option::Option`
src/lib.rs:524     fn with_day0(&self, day0: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:529:5: 529:58 warning: the trait `core::marker::Sized` is not implemented for the type `Self` [E0277]
src/lib.rs:529     fn with_ordinal(&self, ordinal: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:529:5: 529:58 help: run `rustc --explain E0277` to see a detailed explanation
src/lib.rs:529:5: 529:58 note: `Self` does not have a constant size known at compile-time
src/lib.rs:529     fn with_ordinal(&self, ordinal: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:529:5: 529:58 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
src/lib.rs:529     fn with_ordinal(&self, ordinal: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:529:5: 529:58 note: required by `core::option::Option`
src/lib.rs:529     fn with_ordinal(&self, ordinal: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:534:5: 534:60 warning: the trait `core::marker::Sized` is not implemented for the type `Self` [E0277]
src/lib.rs:534     fn with_ordinal0(&self, ordinal0: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:534:5: 534:60 help: run `rustc --explain E0277` to see a detailed explanation
src/lib.rs:534:5: 534:60 note: `Self` does not have a constant size known at compile-time
src/lib.rs:534     fn with_ordinal0(&self, ordinal0: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:534:5: 534:60 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
src/lib.rs:534     fn with_ordinal0(&self, ordinal0: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:534:5: 534:60 note: required by `core::option::Option`
src/lib.rs:534     fn with_ordinal0(&self, ordinal0: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:580:5: 580:52 warning: the trait `core::marker::Sized` is not implemented for the type `Self` [E0277]
src/lib.rs:580     fn with_hour(&self, hour: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:580:5: 580:52 help: run `rustc --explain E0277` to see a detailed explanation
src/lib.rs:580:5: 580:52 note: `Self` does not have a constant size known at compile-time
src/lib.rs:580     fn with_hour(&self, hour: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:580:5: 580:52 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
src/lib.rs:580     fn with_hour(&self, hour: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:580:5: 580:52 note: required by `core::option::Option`
src/lib.rs:580     fn with_hour(&self, hour: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:585:5: 585:53 warning: the trait `core::marker::Sized` is not implemented for the type `Self` [E0277]
src/lib.rs:585     fn with_minute(&self, min: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:585:5: 585:53 help: run `rustc --explain E0277` to see a detailed explanation
src/lib.rs:585:5: 585:53 note: `Self` does not have a constant size known at compile-time
src/lib.rs:585     fn with_minute(&self, min: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:585:5: 585:53 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
src/lib.rs:585     fn with_minute(&self, min: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:585:5: 585:53 note: required by `core::option::Option`
src/lib.rs:585     fn with_minute(&self, min: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:590:5: 590:53 warning: the trait `core::marker::Sized` is not implemented for the type `Self` [E0277]
src/lib.rs:590     fn with_second(&self, sec: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:590:5: 590:53 help: run `rustc --explain E0277` to see a detailed explanation
src/lib.rs:590:5: 590:53 note: `Self` does not have a constant size known at compile-time
src/lib.rs:590     fn with_second(&self, sec: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:590:5: 590:53 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
src/lib.rs:590     fn with_second(&self, sec: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:590:5: 590:53 note: required by `core::option::Option`
src/lib.rs:590     fn with_second(&self, sec: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:595:5: 595:58 warning: the trait `core::marker::Sized` is not implemented for the type `Self` [E0277]
src/lib.rs:595     fn with_nanosecond(&self, nano: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:595:5: 595:58 help: run `rustc --explain E0277` to see a detailed explanation
src/lib.rs:595:5: 595:58 note: `Self` does not have a constant size known at compile-time
src/lib.rs:595     fn with_nanosecond(&self, nano: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:595:5: 595:58 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
src/lib.rs:595     fn with_nanosecond(&self, nano: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:595:5: 595:58 note: required by `core::option::Option`
src/lib.rs:595     fn with_nanosecond(&self, nano: u32) -> Option<Self>;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

...because of:

https://github.com/rust-lang/rfcs/pull/1214
2015-09-05 12:01:46 +02:00
Kang Seonghoon 68f45dae75 Fix a link in the README.
Fixes #41.
2015-08-08 13:09:44 +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 0d6c3ce11a a couple of documentation fixes.
- We've got 1.0.0, so no need for version pinning now.

- `%Z` is formatting-only specifier but wasn't clearly documented.
  Fixes #38.
2015-05-25 10:12:11 +09:00
Kang Seonghoon 9cff70bd04 0.2.14: fixed a subtle bug in `Naive(Date)Time` addition.
- `NaiveDateTime +/- Duration` or `NaiveTime +/- Duration` could
  have gone wrong when the `Duration` to be added is negative and
  has a fractional second part.

  This was caused by an underflow in the conversion from `Duration`
  to the parts; the lack of tests for this case allowed a bug.
  A regression test has been added to avoid further bugs. (#37)
2015-05-15 02:20:03 +09:00
Kang Seonghoon e08f0849dc well, I forgot to update the README. 2015-04-29 02:12:17 +09:00
Kang Seonghoon 90ac81e9f9 0.2.13: beta stabilization and optional rustc_serialize deps.
- This version is finally beta-compatible.

  This introduces a slight incompatibility, namely, due to
  the rewired reexport for `chrono::Duration` (which now comes
  from crates.io `time` crate).

- The optional dependency on `rustc_serialize` and relevant
  `Rustc{En,De}codable` implementations for supported types
  has been added. You will need the `rustc-serialize` Cargo
  feature to use them.
2015-04-29 02:09:04 +09:00
Jisoo Park b5281af9f3 Add optional rustc-serialize support 2015-04-28 18:42:18 +09:00
Eunchong Yu 2ced2b1fb2 Exclude benchmark-related tests by default
This features can be enabled to use the cfg flag 'bench'.
2015-04-26 15:53:39 +09:00
Eunchong Yu 28f4c7acd2 Remove unstable feature 'std-misc' 2015-04-26 15:52:16 +09:00
Eunchong Yu d84588eb49 Remove unstable feature 'zero_one' and use the impl of 'num' crate 2015-04-26 15:41:18 +09:00
Eunchong Yu b950d83454 Remove unstable feature 'core' 2015-04-26 15:17:01 +09:00
Eunchong Yu 878b81d72f Remove unstable slice pattern 2015-04-26 15:10:28 +09:00
Kang Seonghoon 533161cfd7 0.2.12: language changes.
- Many `std::num` traits are removed and replaced with
  the external `num` crate. For time being, thus, Chrono will
  require the dependency on `num`. This is expected to be temporary
  however.
2015-04-25 00:12:56 +09:00
Jisoo Park 14a44aef2b Language update 2015-04-24 16:45:53 +09:00
Kang Seonghoon eced570882 0.2.11: language changes.
- Replaced `thread::scoped` with `thread::spawn` to cope with
  a rare de-stabilization event.

- `#[deprecated]` is (ironically) deprecated with user crates.
  All uses of them have been replaced by doc comments.
2015-04-17 01:28:31 +09:00
Kang Seonghoon 7fd0cf124a 0.2.10: language changes.
- `Copy` requires `Clone`.
2015-04-05 03:18:49 +09:00
Kang Seonghoon 9ed34ec542 0.2.9: language changes.
- `std::num::Int` is deprecated.

- Removed one feature flag (`str_char`).
2015-04-03 17:53:44 +09:00
Kang Seonghoon e012702033 0.2.8: language changes.
- Slice patterns are now feature gated.

- Reformatted the `chrono::format::strftime` documentation
  with a proper table (closes #31).
2015-03-30 10:23:20 +09:00
Huon Wilson 5bbc668081 Slice patterns are now feature gated. 2015-03-29 22:09:15 +11:00
Kang Seonghoon 98c5f3a2b1 0.2.7: language changes.
- Feature flags are now required on the doctests.

- New lints for trivial casts. We are now not going to change
  the internal implementation type for `NaiveDate`, so that's fine.
2015-03-27 11:35:34 +09:00
Kang Seonghoon a5bd6c040e 0.2.6: language changes and dependency updates.
- `range` is now deprecated.

- `str_char` feature gate is split out from `collections`.
2015-03-21 22:01:52 +09:00
Kang Seonghoon 04b179502c 0.2.5: language changes, mostly overflow changes. 2015-03-06 00:23:51 +09:00
Kang Seonghoon 37be780b31 0.2.4: language changes and bug fixes. 2015-03-03 02:40:03 +09:00
Kang Seonghoon 2dbc11dcb1 0.2.3: Fixed a couple of outstanding bugs.
- `DateTime<Tz>` and `Date<Tz>` is now `Copy`/`Send` when
  `Tz::Offset` is `Copy`/`Send`. The implementations for them were
  mistakenly omitted. Fixes #25.

- `Local::from_utc_datetime` didn't set a correct offset.
  The tests for `Local` were lacking. Fixes #26.
2015-02-27 13:08:20 +09:00
Kang Seonghoon ffa86603ae 0.2.2: language & docs changes.
- `missing_docs` lint now checks for associated types.
2015-02-27 00:24:06 +09:00
Kang Seonghoon c11b6deb5a 0.2.1: language changes.
- `std::hash` has been renewed.

- `DelayedFormat` no longer has a redundant lifetime.
2015-02-21 18:15:11 +09:00
Kang Seonghoon e80501dcb3 forgot to update the docs for removal of `Time`... 2015-02-19 05:42:18 +09:00
Kang Seonghoon be6a721be6 0.2.0: offset reform, new format/parse module, various cleanups.
Fixes #11 and #12.
The complete list of changes is available in [CHANGELOG.md].

[CHANGELOG.md]: https://github.com/lifthrasiir/rust-chrono/blob/master/CHANGELOG.md#020-2015-02-19
2015-02-19 05:12:03 +09:00
Kang Seonghoon 6a9490522e updated docs for RFC2822/3339 and added ChangeLog. 2015-02-19 05:08:00 +09:00
Kang Seonghoon f39b13a14c removed timezone-aware `Time` type.
`Time` with an associated time zone is in principle possible, but
in practice it can only meaningfully constructed from an existing
`DateTime`. this makes it hard to implement other operations
natural to `NaiveTime` for `Time` (e.g. `with_*` methods), so
we simply let it go.

migration path: if you *do* happen to use `Time`, don't panic!
every operation possible to `Time` is much more possible to
`NaiveTime`. if you have to deal with a local time, first combine
it with a `NaiveDate`, convert it via `TimeZone::from_local_datetime`
then extract `Time` part again.
2015-02-19 04:17:27 +09:00
Kang Seonghoon c1d0b0279f various doc cleanups; added `FromStr` impl for `DateTime<Local>`.
also made a small script for auto-generating `README.md` out of
the main doc comment from `src/lib.rs`.
2015-02-19 02:21:52 +09:00
Kang Seonghoon 664c4d0191 merged the new offset design branch. 2015-02-19 01:48:29 +09:00
Kang Seonghoon a4f5d19d24 mass renaming from offset/state to timezone/offset. 2015-02-19 00:30:13 +09:00
Kang Seonghoon e43cb62f10 initial implementation of `Offset` redesign (#11).
- We have splitted `Offset` into `Offset` and `OffsetState` (name
  changes in consideration). The former is used to construct and convert
  local or UTC date, and the latter is used to store the UTC offset
  inside constructed values. Some offsets are their own states as well.

- This uses lots of associated types which implementation is still in
  flux. Currently it crashes with debuginfo enabled. We've temporarily
  disabled debuginfo from `Cargo.toml`.

- This technically allows a conversion to the local time, but not yet
  tested.
2015-02-19 00:25:04 +09:00
Kang Seonghoon 46996e35e1 implemented `FromStr` for `DateTime<FixedOffset/UTC>`. 2015-02-19 00:03:58 +09:00
Kang Seonghoon 637784c8ef renamed `from_str` methods to `parse_from_str`.
so that we can safely implement `FromStr` traits for those types.
also updates READMEs and rewires `%+` specifier of `StrftimeItems`
to a new RFC 3339 formatting item.
2015-02-15 21:27:12 +09:00
Kang Seonghoon 6937470405 created `format::parse` module.
this new module encompasses John Nagle's original RFC 2822 and 3337
parsers, updated to fully compatible to the actual standard.
the contributed `parse` module has been merged into it.
2015-02-15 21:02:44 +09:00
Kang Seonghoon 292faa0b23 temporarily merged PR #24, to be fully integrated later. 2015-02-13 21:18:35 +09:00
Kang Seonghoon 2e7a213818 0.1.18: language changes.
- Replaced remaining occurrences of Show with Debug.
- Dependency upgrades.
2015-02-07 01:16:05 +09:00
Kang Seonghoon 82c63e5b40 0.2.0-dev: date/time parsing.
Basically, this should close #12 when officially released.

- Formatting syntax is now refactored out of the rendering logic.
  The main syntax is available in the `format::strftime` module,
  which also serves as a documentation for the syntax.

- A parser (modelled after `strptime(3)`) has been implemented.
  See the individual commits for the detailed implementation.

- There are two ways to get a timezone-aware value from a string:
  `Offset` or `DateTime<FixedOffset>`. The former should be used
  when the offset is known in advance (e.g. assume the local date)
  while the latter should be used when the offset is unknown.
  Naive types have a simple `from_str` method.

- There are some known problems with the parser (even after
  tons of tests), which will be sorted out in 0.2. Known issues:

  - This does not exactly handle RFC 2822 and RFC 3339, which
    subtly differs from the current implementation in
    case-sensitivity, whitespace handling and legacy syntax.
    I'd like to integrate #24 for this cause.

  - Time zone names are not recognized at all. There is even
    no means to get a name itself, not sure about the resolution.

  - `Parsed` does *not* constrain `year` to be non-negative,
    so manually prepared `Parsed` may give a negative year.
    But the current verification pass may break such cases.

  - I absolutely don't know about the parser's performance!

- `AUTHORS.txt` has been added, for what it's worth.
2015-02-05 02:53:19 +09:00
Kang Seonghoon 7eb9a1a983 public interfaces for parser are now available. 2015-02-05 02:16:35 +09:00
Kang Seonghoon 3d00a0fd5a added `checked_{add,sub}` methods to `[Naive]Date[Time]` types.
- Existing `+` and `-` operators use them, and properly panics with
  a correct error message on overflow/underflow.
2015-02-04 16:19:54 +09:00
Kang Seonghoon 98d1ce01c9 language changes: replaced remaining occurrences of Show with Debug. 2015-02-04 16:17:35 +09:00
Kang Seonghoon 36181b65ca 0.1.17: language changes.
- Many unstable stdlib parts require `#[feature]` flags as per
  Rust RFC #507.
2015-01-30 00:03:19 +09:00
Kang Seonghoon 7087cd156a 0.1.16: dependency fixes due to language changes. 2015-01-29 08:47:05 +09:00
John Nagle 3566c3a793 Change names of parsing functions for consistency with "chrono".
All tests pass.
2015-01-26 23:11:09 -08:00
John Nagle 203b455569 Added parsing functions for standard date formats. Tests run.
Some functions will now be renamed for consistency with the
chrono crate.
2015-01-26 22:47:25 -08:00
Kang Seonghoon cf5e2f322f 0.1.15: language changes.
- `std::fmt::Show` is now `std::fmt::Debug`.
- `std::fmt::String` is now `std::fmt::Display`.
2015-01-24 17:45:12 +09:00
Kang Seonghoon 45765ebd13 0.1.14: fixed a missing `String` impl for `Local`.
Fixes #20. Thanks to @daboross.
2015-01-10 12:32:54 +09:00
Kang Seonghoon ca84749869 0.1.13: language changes and fmt::String supports.
- Every type modulo `LocalResult` and `Offset` now implements
  `std::fmt::String`, so `.to_string()` can be used.
  The exact format has been changed for better looking output.

- `std::fmt::Show` are intended for "stricter" output,
  which mostly means the strict ISO 8601 format.
  `DelayedFormat` also implements this, but only for inspection.

- `Offset` should implement `Show` but can omit `String`.
  The old `name` method is merged into `String` implementations.
2015-01-10 03:27:24 +09:00
Kang Seonghoon d79c460fc4 0.1.12: language changes, removed ops for Duration in the lhs.
- Feature flags used are all accepted.
- Orphan check workaround is no longer required.
- Impl reachability rules prevent the addition of `Duration + others`,
  as `Duration` is not implemented in this crate. Removed the impl;
  use `others + Duration` as a workaround.
2015-01-08 02:08:41 +09:00
Kang Seonghoon e97993d76a 0.1.11: language changes.
- Boxed closures are gone; some unboxed closures require an explicit
  annotation for kinds (`&:` in most cases).
2015-01-06 22:38:37 +09:00
Kang Seonghoon 883b656d49 0.1.10: language changes.
- `std::str::SendStr` is now `std::string::CowString<'static>`.
2015-01-06 10:44:08 +09:00
Kang Seonghoon e2ddee2f76 0.1.9: language changes.
- `Add` and `Sub` switches to associated types.
2015-01-05 18:31:15 +09:00
Kang Seonghoon 94df51861f 0.1.8: language changes.
- #[deriving] is now #[derive].
- prelude no longer imports many items by default.
- [T, ..n] is no longer valid.
- a temporary fix for #[derive(Hash)] failing out.
- the formatting error uses a dedicated type instead of `IoError`.
2015-01-04 15:14:57 +09:00
Kang Seonghoon cde432ed8e bumped copyright years. 2015-01-04 15:08:25 +09:00
Ken Tossell 3303127415 Fixed build against rust nightly.
Added 'use' statements for cmd::Ordering, ops::{Add, Sub}, borrow::IntoCow, num::ToPrimitive

Changed deriving -> derive. Changed [x, ..N] -> [x; N].

Made format(f: &fmt::Formatter) return fmt::Result instead of
IoResult. Had to raise generic errors in a couple of cases where
IoResult's fields were being set (but these errors were being thrown
out anyway).

Temporarily set #![feature(old_orphan_check)] because

Thanks for @eddyb for explaining the format() situation.
2015-01-03 17:45:07 -05:00
Kang Seonghoon e53a8b0b01 oops, updated README.md. 2015-01-02 13:48:58 +09:00
Kang Seonghoon bf4ded9f07 0.1.6: fixed tests per language changes and .travis.yml.
This also switches to the crates.io dependency unconditionally.
2014-12-25 16:47:10 +09:00
Kang Seonghoon 389e58f727 added BIG limitations section to the README. 2014-12-13 22:16:38 +09:00
klutzy 37d85ffd3b Update for upstream changes 2014-12-13 20:29:06 +09:00
Kang Seonghoon 920a681d54 better documentation, some additional APIs.
- `Date/Time - Duration` is now supported. (duh!)
- `with_offset` methods have been added.
- `LocalResult` now implements common traits.
- `LocalResult` has several methods to propagate errors.
  this makes the initialization from untrusted sources easier
  (`off.ymd_opt(y,m,d).and_hms_opt(h,n,s).single()`).
2014-11-28 23:53:22 +09:00
Kang Seonghoon 86665d0a7f 0.1.2: no more `num` dependency, multidispatched addition.
- `num` dependency is gone. It was only used for floored division
  and it is not hard to copy only that portion from num.
- `Duration + Date` (or so) was blocked by rust-lang/rust#7590,
  which has been subsequently fixed.
- Removed unused `unsafe` checks.
2014-11-24 14:52:07 +09:00
Kang Seonghoon 0a04ae1aa9 0.1.1: language changes, updated documentations.
- `std::fmt::WriteError` is now `std::fmt::Error`.
- abandoned rust-ci for documentations (sorry, but it didn't work
  nowdays ;_;), we are now publishing directly to Github pages.
2014-11-21 16:18:55 +09:00
Kang Seonghoon ec6c874042 language changes: namespaced enums, no more std::num::{Zero,Bounded}. 2014-11-19 10:59:32 +09:00
Colin Ray fd5f8b7f34 Fix lint warning on deny(missing_doc) 2014-11-02 17:03:19 -06:00
Kang Seonghoon d6e0c3f266 language changes: `extern crate A = "B";` -> `extern crate "B" as A;`. 2014-09-12 18:53:06 +09:00
Kang Seonghoon 10c580f664 switches to std::time::duration::Duration. 2014-08-31 14:43:26 +09:00
Kang Seonghoon f1931ad21e added `chrono::format` module and `format` methods.
this is a saner replacement for `time::strftime`; it does not allocate
the additional memory.
2014-08-01 04:08:19 +09:00
Kang Seonghoon ead13f66d8 added the Local offset implementation. 2014-07-31 11:02:20 +09:00
Kang Seonghoon 9d52c6d2f1 added constructors from timestamp; added `UTC::{today,now}`. 2014-07-31 10:09:54 +09:00
Kang Seonghoon 95f5c0c095 splitted naive types into their own modules. 2014-07-29 16:17:26 +09:00
Kang Seonghoon 586b41df54 mass renaming from `BlahBlahZ` to `NaiveBlahBlah`. 2014-07-29 15:55:40 +09:00
Kang Seonghoon 32c3ee85e8 initial `Offset` implementations. 2014-07-29 15:41:47 +09:00
Kang Seonghoon 9300f2481c renamed `chrono:📅:{MIN,MAX}` to `chrono:📅:{MINZ,MAXZ}`.
this is because we are going to add `MIN` and `MAX` for
timezone-aware `Date`s later.
2014-07-25 19:24:32 +09:00
Kang Seonghoon 4dbd00dca2 added all missing docs. 2014-07-25 18:12:51 +09:00
Kang Seonghoon 110c7de7d3 added docs to `Duration`; added `Duration::new_opt`; removed `{MIN,MAX}_{DAYS,YEAR}`.
the minimum and maximum for `DateZ` and `Duration` is now provided via
dedicated constants `{date,duration}::{MIN,MAX}`, much like built-in
`std::int` and others. they also now implements `std::num::Bounded`.

cf. rust-lang/rust#15934
2014-07-25 17:05:26 +09:00
Kang Seonghoon b79f6b302b major API surgeries.
- added a new example.
- reexported all public APIs in the crate root.
- made all constructors fail on the invalid arguments by default;
  `*_opt()` variants have been added for the original behavior.
- same for `DateZ::{succ,pred}`.
- fixed a missing overflow check from `TimeZ::from_hms_{milli,micro}`.
2014-07-20 02:51:57 +09:00