Files
mozo-backend/app/assets/javascripts/shared-ember-helpers/time.js.coffee
T

7 lines
357 B
CoffeeScript

Ember.Handlebars.helper 'time', (time, params..., options = {})->
return '' unless time
time = new Date(time) if typeof(time) is "string"
iso = time.toISOString()
tag = if options.bare then iso else $("<span data-time=\"#{iso}\"></span>").text(moment(iso).format(options.format || 'dd D MMM HH:mm')).get(0).outerHTML
new Handlebars.SafeString tag