startOfDay: if between midnight and custom day start, jump back to previous day
This commit is contained in:
+4
-2
@@ -31,7 +31,10 @@ api.startOfWeek = api.startOfWeek = (options={}) ->
|
||||
|
||||
api.startOfDay = (options={}) ->
|
||||
o = sanitizeOptions(options)
|
||||
moment(o.now).startOf('day').add('h', o.dayStart)
|
||||
dayStart = moment(o.now).startOf('day').add('h', o.dayStart)
|
||||
# if between midnight and Custom Day Start, jump back to previous day
|
||||
dayStart.subtract('day', 1) if moment(o.now).isBefore(dayStart)
|
||||
return dayStart
|
||||
|
||||
dayMapping = {0:'su',1:'m',2:'t',3:'w',4:'th',5:'f',6:'s'}
|
||||
|
||||
@@ -1239,4 +1242,3 @@ api.wrap = (user, main=true) ->
|
||||
get: ->
|
||||
tasks = user.habits.concat(user.dailys).concat(user.todos).concat(user.rewards)
|
||||
_.object(_.pluck(tasks, "id"), tasks)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user