diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-05-23 10:01:43 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-05-23 10:01:43 +0200 |
commit | ff823a10f049e06c711537560ba10f3dc826afcd (patch) | |
tree | 25000784fef0758b7aad1990d3d14ecbe7eae46d /aero-dav/src/caldecoder.rs | |
parent | 7687065bfc824127fda657363894a30268e95385 (diff) | |
download | aerogramme-ff823a10f049e06c711537560ba10f3dc826afcd.tar.gz aerogramme-ff823a10f049e06c711537560ba10f3dc826afcd.zip |
improve ical date parsing
Diffstat (limited to 'aero-dav/src/caldecoder.rs')
-rw-r--r-- | aero-dav/src/caldecoder.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/aero-dav/src/caldecoder.rs b/aero-dav/src/caldecoder.rs index 6bc911f..7de5e2a 100644 --- a/aero-dav/src/caldecoder.rs +++ b/aero-dav/src/caldecoder.rs @@ -287,7 +287,7 @@ impl QRead<Property> for Property { .is_some() { let dtstr = xml.tag_string().await?; - let dt = NaiveDateTime::parse_from_str(dtstr.as_str(), CALDAV_DATETIME_FMT)?.and_utc(); + let dt = NaiveDateTime::parse_from_str(dtstr.as_str(), UTC_DATETIME_FMT)?.and_utc(); xml.close().await?; return Ok(Property::MaxDateTime(dt)); } @@ -653,8 +653,8 @@ impl QRead<Expand> for Expand { _ => return Err(ParsingError::MissingAttribute), }; - let start = NaiveDateTime::parse_from_str(rstart.as_str(), CALDAV_DATETIME_FMT)?.and_utc(); - let end = NaiveDateTime::parse_from_str(rend.as_str(), CALDAV_DATETIME_FMT)?.and_utc(); + let start = NaiveDateTime::parse_from_str(rstart.as_str(), UTC_DATETIME_FMT)?.and_utc(); + let end = NaiveDateTime::parse_from_str(rend.as_str(), UTC_DATETIME_FMT)?.and_utc(); if start > end { return Err(ParsingError::InvalidValue); } @@ -672,8 +672,8 @@ impl QRead<LimitRecurrenceSet> for LimitRecurrenceSet { _ => return Err(ParsingError::MissingAttribute), }; - let start = NaiveDateTime::parse_from_str(rstart.as_str(), CALDAV_DATETIME_FMT)?.and_utc(); - let end = NaiveDateTime::parse_from_str(rend.as_str(), CALDAV_DATETIME_FMT)?.and_utc(); + let start = NaiveDateTime::parse_from_str(rstart.as_str(), UTC_DATETIME_FMT)?.and_utc(); + let end = NaiveDateTime::parse_from_str(rend.as_str(), UTC_DATETIME_FMT)?.and_utc(); if start > end { return Err(ParsingError::InvalidValue); } @@ -691,8 +691,8 @@ impl QRead<LimitFreebusySet> for LimitFreebusySet { _ => return Err(ParsingError::MissingAttribute), }; - let start = NaiveDateTime::parse_from_str(rstart.as_str(), CALDAV_DATETIME_FMT)?.and_utc(); - let end = NaiveDateTime::parse_from_str(rend.as_str(), CALDAV_DATETIME_FMT)?.and_utc(); + let start = NaiveDateTime::parse_from_str(rstart.as_str(), UTC_DATETIME_FMT)?.and_utc(); + let end = NaiveDateTime::parse_from_str(rend.as_str(), UTC_DATETIME_FMT)?.and_utc(); if start > end { return Err(ParsingError::InvalidValue); } @@ -918,13 +918,13 @@ impl QRead<TimeRange> for TimeRange { let start = match xml.prev_attr("start") { Some(r) => { - Some(NaiveDateTime::parse_from_str(r.as_str(), CALDAV_DATETIME_FMT)?.and_utc()) + Some(NaiveDateTime::parse_from_str(r.as_str(), UTC_DATETIME_FMT)?.and_utc()) } _ => None, }; let end = match xml.prev_attr("end") { Some(r) => { - Some(NaiveDateTime::parse_from_str(r.as_str(), CALDAV_DATETIME_FMT)?.and_utc()) + Some(NaiveDateTime::parse_from_str(r.as_str(), UTC_DATETIME_FMT)?.and_utc()) } _ => None, }; |