Skip to content

Commit

Permalink
feat: add timestamp setter
Browse files Browse the repository at this point in the history
  • Loading branch information
hoodie committed Dec 5, 2021
1 parent c0ffeee commit c0ffee1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ pub trait Component {
self
}

/// Set the [`DTSTAMP`](https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.7.2) [`Property`]
///
/// See [`CalendarDateTime`] for info how are different [`chrono`] types converted automatically.
fn timestamp<T: Into<CalendarDateTime>>(&mut self, dt: T) -> &mut Self {
let calendar_dt = dt.into();
self.add_property("DTSTAMP", &calendar_dt.to_string());
self
}

/// Set the [`DTSTART`](https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.2.4) [`Property`]
///
/// See [`CalendarDateTime`] for info how are different [`chrono`] types converted automatically.
Expand Down

0 comments on commit c0ffee1

Please sign in to comment.