Files
2017-12-21 11:42:41 +01:00

12 lines
340 B
CoffeeScript

window.freezeMoment = (time, callback) ->
#time = "#{time}Z" if typeof time is 'string' and time.slice(-1) isnt 'Z' # work with UTC dates?
time = moment(time) unless time._isAMomentObject
originalMomentNow = moment.now
date = time.toDate()
moment.now = -> date
callback.call null, time
moment.now = originalMomentNow
time