Skip to content

Commit

Permalink
Added humanizing date template helper. Fixes #21.
Browse files Browse the repository at this point in the history
  • Loading branch information
Avaq committed Jun 30, 2014
1 parent ddc01bc commit 6aab51a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/lib/view-helper.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ Handlebars.registerHelper 'url', (routeName, params..., options) ->
# Pass a string to turn it into a class name (lowercase + dashify)
Handlebars.registerHelper 'classify', (string) ->
string.toLowerCase()

Handlebars.registerHelper 'date', (input) ->
date = if input instanceof Date then input else new Date input
return "#{date.toLocaleDateString()} - #{date.getHours()}:#{date.getMinutes()}"
2 changes: 1 addition & 1 deletion app/views/history/templates/entry.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</li>
<li class="dt-created">
<i class="fa fa-clock-o"></i>
{{this.created}}
{{date this.created}}
</li>
</ul>
</footer>

0 comments on commit 6aab51a

Please sign in to comment.