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