diff options
author | Nora <nora.widdecke@tu-bs.de> | 2019-01-18 23:20:11 +0100 |
---|---|---|
committer | Nora <nora.widdecke@tu-bs.de> | 2019-01-18 23:20:11 +0100 |
commit | bf38db781d82b75a6640fcd80ad65c96a186c9ec (patch) | |
tree | 16cedc8f7467a7217be3e6bf33cf2fe61731ad5e /src/icalwrap | |
parent | 390f419cb8043033ad85b9a0ded5617a6f25002a (diff) |
icalvcalendar: use dateutil::now in with_dtstamp_now
Diffstat (limited to 'src/icalwrap')
-rw-r--r-- | src/icalwrap/icalvcalendar.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/icalwrap/icalvcalendar.rs b/src/icalwrap/icalvcalendar.rs index 3c00df4..baf1f49 100644 --- a/src/icalwrap/icalvcalendar.rs +++ b/src/icalwrap/icalvcalendar.rs @@ -130,8 +130,10 @@ impl IcalVCalendar { pub fn with_dtstamp_now(self) -> Self { unsafe { - let dtstamp_icaltime = ical::icaltime_current_time_with_zone(ical::icaltimezone_get_utc_timezone()); - ical::icalcomponent_set_dtstamp(self.get_ptr(), dtstamp_icaltime); + let now = dateutil::now().timestamp(); + let is_date = 0; + let now_icaltime = ical::icaltime_from_timet_with_zone(now, is_date, ical::icaltimezone_get_utc_timezone()); + ical::icalcomponent_set_dtstamp(self.get_ptr(), now_icaltime); } self } @@ -378,8 +380,7 @@ mod tests { cal = cal.with_dtstamp_now(); let event = cal.get_principal_event(); let now_dtstamp = event.get_property_by_name("DTSTAMP").unwrap().get_value(); - let now_expected = format!("{}", Utc::now().format("%Y%m%dT%H%M%SZ")); - assert_eq!(now_expected, now_dtstamp) + assert_eq!(now_dtstamp, "20130101T010203Z") } #[test] |