diff options
author | Matěj Laitl <matej@laitl.cz> | 2019-11-09 19:09:36 +0100 |
---|---|---|
committer | Matěj Laitl <matej@laitl.cz> | 2019-11-17 02:03:50 +0100 |
commit | 1ef531f294308cfc9e5a52b3bd8a8279d41d1aeb (patch) | |
tree | cc52daf76d1d8d09d2294640e5d92ab4ffe79324 /src/lib.rs | |
parent | b55004b8db378503a68056562084b42cf85cbe77 (diff) |
Time zone handling: accept only DateTime<Utc> and NaiveDateTime
This is a breaking API change.
- [Todo::due] and [Todo::completed] now take their date-time argument by value rather than by
reference
- [Todo::completed] now requires its [chrono::DateTime] argument to have exactly [chrono::Utc]
specified as its time zone as mandated by the RFC.
- [Component::starts], [Component::ends] and [Todo::due] now take newly introduced
[CalendarDateTime] (through `Into<CalendarDateTime>` indirection). This allows callers to
define time zone handling. Conversions from [chrono::NaiveDateTime] and
[`chrono::DateTime<Utc>`] are provided for ergonomics, the latter also restoring API
compatibility in case of UTC date-times.
Note that we now implement 2 of the 3 DATE-TIME variants defined by the RFC.
The third variant can be implemented in the future.
Fixes #2.
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -47,6 +47,18 @@ //! calendar.add(bday); //! # } //! ``` +//! +//! ## Breaking API Changes in version 0.7.0 +//! +//! - [Todo::due] and [Todo::completed] now take their date-time argument by value rather than by +//! reference +//! - [Todo::completed] now requires its [chrono::DateTime] argument to have exactly [chrono::Utc] +//! specified as its time zone as mandated by the RFC. +//! - [Component::starts], [Component::ends] and [Todo::due] now take newly introduced +//! [CalendarDateTime] (through `Into<CalendarDateTime>` indirection). This allows callers to +//! define time zone handling. Conversions from [`chrono::NaiveDateTime`] and +//! [`chrono::DateTime<Utc>`](chrono::DateTime) are provided for ergonomics, the latter also restoring API +//! compatibility in case of UTC date-times. #![warn(missing_docs, missing_copy_implementations, @@ -83,7 +95,7 @@ mod calendar; //pub mod repeats; pub use crate::properties::{Property, Parameter, Class, ValueType}; pub use crate::properties::{TodoStatus, EventStatus}; -pub use crate::components::{Event, Todo, Component}; +pub use crate::components::{CalendarDateTime, Event, Todo, Component}; pub use crate::calendar::Calendar; // TODO Calendar TimeZone VTIMEZONE STANDARD DAYLIGHT (see thunderbird exports) |