Fix Sunday daily bug

This commit is contained in:
2022-08-30 19:41:24 +00:00
parent 129335ac59
commit c0ba3d4127
2 changed files with 6 additions and 4 deletions

View File

@@ -7,13 +7,13 @@
(+
(.join (for day days
(case day
(0 "Su")
(1 "M")
(2 "T")
(3 "W")
(4 "Th")
(5 "F")
(6 "S")
(7 "Su")
(otherwise (throw "bad day")))) "")
" "
lastDayDone

View File

@@ -58,7 +58,7 @@
([noColon]
(Daily
// all days of week
(collect (range 7))
(collect (range 1 8))
// never done before
""))
([::&mut preColon ...afterColon]
@@ -69,7 +69,7 @@
[
// disambiguate Th from T and Su from S:
(when (contains preColon "Th") {(set preColon (StringTools.replace preColon "Th" "")) 4})
(when (contains preColon "Su") {(set preColon (StringTools.replace preColon "Su" "")) 0})
(when (contains preColon "Su") {(set preColon (StringTools.replace preColon "Su" "")) 7})
(when (contains preColon "M") 1)
(when (contains preColon "T") 2)
(when (contains preColon "W") 3)
@@ -171,7 +171,9 @@
(return false))
(case e.type
((Daily days lastDayDone)
(and !(= lastDayDone (todayString)) (contains days (.getDay (Date.now)))))
(let [&mut today (.getDay (Date.now))]
(when (= today 0) (set today 7))
(and !(= lastDayDone (todayString)) (contains days today))))
((Monthly days lastDayDone)
// TODO logic
(let [&mut nextDay