aboutsummaryrefslogtreecommitdiff
path: root/aero-dav
diff options
context:
space:
mode:
Diffstat (limited to 'aero-dav')
-rw-r--r--aero-dav/src/caldecoder.rs18
-rw-r--r--aero-dav/src/calencoder.rs24
-rw-r--r--aero-dav/src/caltypes.rs4
3 files changed, 23 insertions, 23 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,
};
diff --git a/aero-dav/src/calencoder.rs b/aero-dav/src/calencoder.rs
index f145628..d5d4305 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(CALDAV_DATETIME_FMT));
+ let dtstr = format!("{}", dt.format(UTC_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(CALDAV_DATETIME_FMT));
+ let dtstr = format!("{}", dt.format(UTC_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(CALDAV_DATETIME_FMT)).as_str(),
+ format!("{}", self.0.format(UTC_DATETIME_FMT)).as_str(),
));
empty.push_attribute((
"end",
- format!("{}", self.1.format(CALDAV_DATETIME_FMT)).as_str(),
+ format!("{}", self.1.format(UTC_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(CALDAV_DATETIME_FMT)).as_str(),
+ format!("{}", self.0.format(UTC_DATETIME_FMT)).as_str(),
));
empty.push_attribute((
"end",
- format!("{}", self.1.format(CALDAV_DATETIME_FMT)).as_str(),
+ format!("{}", self.1.format(UTC_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(CALDAV_DATETIME_FMT)).as_str(),
+ format!("{}", self.0.format(UTC_DATETIME_FMT)).as_str(),
));
empty.push_attribute((
"end",
- format!("{}", self.1.format(CALDAV_DATETIME_FMT)).as_str(),
+ format!("{}", self.1.format(UTC_DATETIME_FMT)).as_str(),
));
xml.q.write_event_async(Event::Empty(empty)).await
}
@@ -737,20 +737,20 @@ impl QWrite for TimeRange {
match self {
Self::OnlyStart(start) => empty.push_attribute((
"start",
- format!("{}", start.format(CALDAV_DATETIME_FMT)).as_str(),
+ format!("{}", start.format(UTC_DATETIME_FMT)).as_str(),
)),
Self::OnlyEnd(end) => empty.push_attribute((
"end",
- format!("{}", end.format(CALDAV_DATETIME_FMT)).as_str(),
+ format!("{}", end.format(UTC_DATETIME_FMT)).as_str(),
)),
Self::FullRange(start, end) => {
empty.push_attribute((
"start",
- format!("{}", start.format(CALDAV_DATETIME_FMT)).as_str(),
+ format!("{}", start.format(UTC_DATETIME_FMT)).as_str(),
));
empty.push_attribute((
"end",
- format!("{}", end.format(CALDAV_DATETIME_FMT)).as_str(),
+ format!("{}", end.format(UTC_DATETIME_FMT)).as_str(),
));
}
}
diff --git a/aero-dav/src/caltypes.rs b/aero-dav/src/caltypes.rs
index 924b651..50cdb92 100644
--- a/aero-dav/src/caltypes.rs
+++ b/aero-dav/src/caltypes.rs
@@ -3,8 +3,8 @@
use super::types as dav;
use chrono::{DateTime, Utc};
-pub const ICAL_DATETIME_FMT: &str = "%Y%m%dT%H%M%S";
-pub const CALDAV_DATETIME_FMT: &str = "%Y%m%dT%H%M%SZ";
+pub const FLOATING_DATETIME_FMT: &str = "%Y%m%dT%H%M%S";
+pub const UTC_DATETIME_FMT: &str = "%Y%m%dT%H%M%SZ";
//@FIXME ACL (rfc3744) is missing, required
//@FIXME Versioning (rfc3253) is missing, required