pub enum CalendarDateTime {
Floating(NaiveDateTime),
Utc(DateTime<Utc>),
WithTimezone {
date_time: NaiveDateTime,
tzid: String,
},
}
Expand description
Representation of various forms of DATE-TIME
per
RFC 5545, Section 3.3.5
Conversions from chrono types are provided in form of From implementations, see documentation of individual variants.
In addition to readily implemented FORM #1
and FORM #2
, the RFC also specifies
FORM #3: DATE WITH LOCAL TIME AND TIME ZONE REFERENCE
. This variant is not yet implemented.
Adding it will require adding support for VTIMEZONE
and referencing it using TZID
.
Variants§
Floating(NaiveDateTime)
FORM #1: DATE WITH LOCAL TIME
: floating, follows current time-zone of the attendee.
Conversion from chrono::NaiveDateTime
results in this variant.
§Note
finding this in a calendar is a red flag, datetimes should end in 'Z'
for UTC
or have a TZID
property
Utc(DateTime<Utc>)
FORM #2: DATE WITH UTC TIME
: rendered with Z suffix character.
Conversion from chrono::DateTime<Utc>
results in this variant. Use
date_time.with_timezone(&Utc)
to convert date_time
from arbitrary time zone to UTC.
WithTimezone
FORM #3: DATE WITH LOCAL TIME AND TIME ZONE REFERENCE
: refers to a time zone definition.
Fields
date_time: NaiveDateTime
The date and time in the given time zone.
Trait Implementations§
Source§impl Clone for CalendarDateTime
impl Clone for CalendarDateTime
Source§fn clone(&self) -> CalendarDateTime
fn clone(&self) -> CalendarDateTime
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for CalendarDateTime
impl Debug for CalendarDateTime
Source§impl From<CalendarDateTime> for DatePerhapsTime
impl From<CalendarDateTime> for DatePerhapsTime
Source§fn from(dt: CalendarDateTime) -> Self
fn from(dt: CalendarDateTime) -> Self
Source§impl From<DateTime<Utc>> for CalendarDateTime
Converts from time zone-aware UTC date-time to CalendarDateTime::Utc
.
impl From<DateTime<Utc>> for CalendarDateTime
Converts from time zone-aware UTC date-time to CalendarDateTime::Utc
.
Source§impl From<NaiveDateTime> for CalendarDateTime
Converts from time zone-less date-time to CalendarDateTime::Floating
.
impl From<NaiveDateTime> for CalendarDateTime
Converts from time zone-less date-time to CalendarDateTime::Floating
.