moment changed .sod() to .startOf('day')

This commit is contained in:
Tyler Renelle 2013-02-08 14:22:33 -05:00
parent dc1639ceb4
commit 842d3183b2
2 changed files with 2 additions and 2 deletions

View file

@ -2,7 +2,7 @@ moment = require('moment')
# Absolute diff between two dates, based on 12am for both days
module.exports.daysBetween = (a, b) ->
Math.abs(moment(a).sod().diff(moment(b).sod(), 'days'))
Math.abs(moment(a).startOf('day').diff(moment(b).startOf('day'), 'days'))
module.exports.dayMapping = dayMapping = {0:'su',1:'m',2:'t',3:'w',4:'th',5:'f',6:'s',7:'su'}

View file

@ -33,7 +33,7 @@ module.exports.deleteStaleAccounts = ->
return unless user? #why does this happen sometimes?
if !!user.lastCron # for now ignore missing crons, still looking into why this is happening
lastCron = new Date(user.lastCron)
diff = Math.abs(moment(today).sod().diff(moment(lastCron).sod(), "days"))
diff = Math.abs(moment(today).startOf('day').diff(moment(lastCron).startOf('day'), "days"))
if diff > 10
removeAccount(collection, user._id)
else