aboutsummaryrefslogtreecommitdiffstats
path: root/todolist/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'todolist/util.go')
-rw-r--r--todolist/util.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/todolist/util.go b/todolist/util.go
index ff3dbba..6fa93f3 100644
--- a/todolist/util.go
+++ b/todolist/util.go
@@ -59,3 +59,23 @@ func pluralize(count int, singular, plural string) string {
}
return singular
}
+
+func isToday(t time.Time) bool {
+ nowYear, nowMonth, nowDay := time.Now().Date()
+ timeYear, timeMonth, timeDay := t.Date()
+ return nowYear == timeYear &&
+ nowMonth == timeMonth &&
+ nowDay == timeDay
+}
+
+func isTomorrow(t time.Time) bool {
+ nowYear, nowMonth, nowDay := time.Now().AddDate(0, 0, 1).Date()
+ timeYear, timeMonth, timeDay := t.Date()
+ return nowYear == timeYear &&
+ nowMonth == timeMonth &&
+ nowDay == timeDay
+}
+
+func isPastDue(t time.Time) bool {
+ return time.Now().After(t)
+}