aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/model')
-rw-r--r--src/model/event.rs12
1 files changed, 11 insertions, 1 deletions
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 {