Add DiaryId::get_date_representation() function

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2019-06-30 10:56:55 +02:00
parent 57039654ca
commit a21d4b7122

View file

@ -132,6 +132,14 @@ impl DiaryId {
self self
} }
/// Get the date how it is stored in the DiaryId object
///
/// This can be useful for sorting a list of diary entries by date, but not using
/// Into<NaiveDateTime>
pub fn get_date_representation(&self) -> (i32, u32, u32, u32, u32, u32) {
(self.year, self.month, self.day, self.hour, self.minute, self.second)
}
pub fn now(name: String) -> DiaryId { pub fn now(name: String) -> DiaryId {
use chrono::offset::Local; use chrono::offset::Local;