From d0a9063631e71928484a698f6c585ebb3915e8a2 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 9 Jan 2022 14:37:35 +0100 Subject: Allow to update events --- src/model/event.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/model') diff --git a/src/model/event.rs b/src/model/event.rs index 27587bc..7ab0244 100644 --- a/src/model/event.rs +++ b/src/model/event.rs @@ -13,6 +13,16 @@ pub struct Event { pub name: String, } +pub fn init(date: NaiveDate) -> Event { + Event { + id: Uuid::new_v4(), + date, + start: None, + end: None, + name: "".to_string(), + } +} + impl Event { pub fn pprint(&self) -> String { let start = self.start.map(pprint_time).unwrap_or_default(); @@ -29,7 +39,7 @@ impl Event { } } -fn pprint_time(t: NaiveTime) -> String { +pub fn pprint_time(t: NaiveTime) -> String { if t.minute() == 0 { format!("{}h", t.hour()) } else { -- cgit v1.2.3