diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-05-22 15:02:53 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-05-22 15:02:53 +0200 |
commit | 6ca7082197aa60288c3295387bfdf47d8adbed2d (patch) | |
tree | 4f6e47bae54106f4144620839a41aa91a91f597e /aero-dav/src/calencoder.rs | |
parent | 194e34d4e1b28957d8310ea1205989fadb1b44c7 (diff) | |
download | aerogramme-6ca7082197aa60288c3295387bfdf47d8adbed2d.tar.gz aerogramme-6ca7082197aa60288c3295387bfdf47d8adbed2d.zip |
fix: parsing components & times
Diffstat (limited to 'aero-dav/src/calencoder.rs')
-rw-r--r-- | aero-dav/src/calencoder.rs | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/aero-dav/src/calencoder.rs b/aero-dav/src/calencoder.rs index 4467f7c..f145628 100644 --- a/aero-dav/src/calencoder.rs +++ b/aero-dav/src/calencoder.rs @@ -178,7 +178,7 @@ impl QWrite for Property { let start = xml.create_cal_element("min-date-time"); let end = start.to_end(); - let dtstr = format!("{}", dt.format(ICAL_DATETIME_FMT)); + let dtstr = format!("{}", dt.format(CALDAV_DATETIME_FMT)); xml.q.write_event_async(Event::Start(start.clone())).await?; xml.q .write_event_async(Event::Text(BytesText::new(dtstr.as_str()))) @@ -189,7 +189,7 @@ impl QWrite for Property { let start = xml.create_cal_element("max-date-time"); let end = start.to_end(); - let dtstr = format!("{}", dt.format(ICAL_DATETIME_FMT)); + let dtstr = format!("{}", dt.format(CALDAV_DATETIME_FMT)); xml.q.write_event_async(Event::Start(start.clone())).await?; xml.q .write_event_async(Event::Text(BytesText::new(dtstr.as_str()))) @@ -493,11 +493,11 @@ impl QWrite for Expand { let mut empty = xml.create_cal_element("expand"); empty.push_attribute(( "start", - format!("{}", self.0.format(ICAL_DATETIME_FMT)).as_str(), + format!("{}", self.0.format(CALDAV_DATETIME_FMT)).as_str(), )); empty.push_attribute(( "end", - format!("{}", self.1.format(ICAL_DATETIME_FMT)).as_str(), + format!("{}", self.1.format(CALDAV_DATETIME_FMT)).as_str(), )); xml.q.write_event_async(Event::Empty(empty)).await } @@ -508,11 +508,11 @@ impl QWrite for LimitRecurrenceSet { let mut empty = xml.create_cal_element("limit-recurrence-set"); empty.push_attribute(( "start", - format!("{}", self.0.format(ICAL_DATETIME_FMT)).as_str(), + format!("{}", self.0.format(CALDAV_DATETIME_FMT)).as_str(), )); empty.push_attribute(( "end", - format!("{}", self.1.format(ICAL_DATETIME_FMT)).as_str(), + format!("{}", self.1.format(CALDAV_DATETIME_FMT)).as_str(), )); xml.q.write_event_async(Event::Empty(empty)).await } @@ -523,11 +523,11 @@ impl QWrite for LimitFreebusySet { let mut empty = xml.create_cal_element("limit-freebusy-set"); empty.push_attribute(( "start", - format!("{}", self.0.format(ICAL_DATETIME_FMT)).as_str(), + format!("{}", self.0.format(CALDAV_DATETIME_FMT)).as_str(), )); empty.push_attribute(( "end", - format!("{}", self.1.format(ICAL_DATETIME_FMT)).as_str(), + format!("{}", self.1.format(CALDAV_DATETIME_FMT)).as_str(), )); xml.q.write_event_async(Event::Empty(empty)).await } @@ -737,18 +737,21 @@ impl QWrite for TimeRange { match self { Self::OnlyStart(start) => empty.push_attribute(( "start", - format!("{}", start.format(ICAL_DATETIME_FMT)).as_str(), + format!("{}", start.format(CALDAV_DATETIME_FMT)).as_str(), + )), + Self::OnlyEnd(end) => empty.push_attribute(( + "end", + format!("{}", end.format(CALDAV_DATETIME_FMT)).as_str(), )), - Self::OnlyEnd(end) => { - empty.push_attribute(("end", format!("{}", end.format(ICAL_DATETIME_FMT)).as_str())) - } Self::FullRange(start, end) => { empty.push_attribute(( "start", - format!("{}", start.format(ICAL_DATETIME_FMT)).as_str(), + format!("{}", start.format(CALDAV_DATETIME_FMT)).as_str(), + )); + empty.push_attribute(( + "end", + format!("{}", end.format(CALDAV_DATETIME_FMT)).as_str(), )); - empty - .push_attribute(("end", format!("{}", end.format(ICAL_DATETIME_FMT)).as_str())); } } xml.q.write_event_async(Event::Empty(empty)).await |