diff options
Diffstat (limited to 'src/app/impl_self.rs')
-rw-r--r-- | src/app/impl_self.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/app/impl_self.rs b/src/app/impl_self.rs index 8a84cb2..1dfe268 100644 --- a/src/app/impl_self.rs +++ b/src/app/impl_self.rs | |||
@@ -54,6 +54,10 @@ impl App { | |||
54 | } | 54 | } |
55 | } | 55 | } |
56 | 56 | ||
57 | pub fn list_habits(&self) -> Vec<String> { | ||
58 | self.habits.iter().map(|x| x.name()).collect::<Vec<_>>() | ||
59 | } | ||
60 | |||
57 | pub fn delete_by_name(&mut self, name: &str) { | 61 | pub fn delete_by_name(&mut self, name: &str) { |
58 | let old_len = self.habits.len(); | 62 | let old_len = self.habits.len(); |
59 | self.habits.retain(|h| h.name() != name); | 63 | self.habits.retain(|h| h.name() != name); |
@@ -141,7 +145,7 @@ impl App { | |||
141 | let completed = total - remaining; | 145 | let completed = total - remaining; |
142 | 146 | ||
143 | let timestamp = if self.view_month_offset == 0 { | 147 | let timestamp = if self.view_month_offset == 0 { |
144 | format!("{}", Local::now().date().format("%d/%b/%y"),) | 148 | format!("{}", Local::now().naive_local().date().format("%d/%b/%y"),) |
145 | } else { | 149 | } else { |
146 | let months = self.view_month_offset; | 150 | let months = self.view_month_offset; |
147 | format!("{}", format!("{} months ago", months),) | 151 | format!("{}", format!("{} months ago", months),) |
@@ -270,7 +274,7 @@ impl App { | |||
270 | self.message.set_message("help <command>|commands|keys") | 274 | self.message.set_message("help <command>|commands|keys") |
271 | } | 275 | } |
272 | } | 276 | } |
273 | Command::Quit => self.save_state(), | 277 | Command::Quit | Command::Write => self.save_state(), |
274 | Command::MonthNext => self.sift_forward(), | 278 | Command::MonthNext => self.sift_forward(), |
275 | Command::MonthPrev => self.sift_backward(), | 279 | Command::MonthPrev => self.sift_backward(), |
276 | Command::Blank => {} | 280 | Command::Blank => {} |