From a21d4b7122e45eced8e1a4bd029ff9c3224267b8 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 30 Jun 2019 10:56:55 +0200 Subject: [PATCH] Add DiaryId::get_date_representation() function Signed-off-by: Matthias Beyer --- lib/domain/libimagdiary/src/diaryid.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/domain/libimagdiary/src/diaryid.rs b/lib/domain/libimagdiary/src/diaryid.rs index c28aebdd..727bb52d 100644 --- a/lib/domain/libimagdiary/src/diaryid.rs +++ b/lib/domain/libimagdiary/src/diaryid.rs @@ -132,6 +132,14 @@ impl DiaryId { 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 + 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 { use chrono::offset::Local;