diff --git a/common/script/index.coffee b/common/script/index.coffee index 0ea1af6e9e..5cd774f15c 100644 --- a/common/script/index.coffee +++ b/common/script/index.coffee @@ -86,7 +86,7 @@ api.shouldDo = (day, dailyTask, options = {}) -> dayOfWeek = api.startOfDay(_.defaults {now:day}, o).day() # check if event is in the future - hasStartedCheck = moment(day).isAfter(dailyTask.startDate) || moment(day).isSame(dailyTask.startDate) + hasStartedCheck = day >= dailyTask.startDate if dailyTask.frequency == 'daily' daysSinceTaskStart = api.numDaysApart(day, dailyTask.startDate, o) @@ -1547,7 +1547,7 @@ api.wrap = (user, main=true) -> {completed, repeat} = daily thatDay = moment(now).subtract({days: 1}) - if api.shouldDo(thatDay, repeat, user.preferences) || completed + if api.shouldDo(thatDay.toDate(), daily, user.preferences) || completed _.each daily.checklist, ((box)->box.completed=false;true) daily.completed = false return @@ -1574,7 +1574,7 @@ api.wrap = (user, main=true) -> scheduleMisses = 0 _.times daysMissed, (n) -> thatDay = moment(now).subtract({days: n + 1}) - if api.shouldDo(thatDay, task, user.preferences) + if api.shouldDo(thatDay.toDate(), task, user.preferences) scheduleMisses++ if user.stats.buffs.stealth user.stats.buffs.stealth-- diff --git a/test/common/algos.mocha.coffee b/test/common/algos.mocha.coffee index e6a709edf4..4fc9431d86 100644 --- a/test/common/algos.mocha.coffee +++ b/test/common/algos.mocha.coffee @@ -793,7 +793,7 @@ describe 'Cron', -> before.dailys[0].streak = after.dailys[0].streak = 10 before.dailys[0].completed = after.dailys[0].completed = true if options.checked if options.shouldDo - expect(shared.shouldDo(now, options.repeat, {timezoneOffset, dayStart:options.dayStart, now})).to.be.ok() + expect(shared.shouldDo(now.toDate(), options.repeat, {timezoneOffset, dayStart:options.dayStart, now})).to.be.ok() after.fns.cron {now} before.stats.mp=after.stats.mp #FIXME switch options.expect