     if _.contains categories, name
       return "selected"
     else return ""
+  'date_start': ->
+    return moment(@from).format(DATE_FORMAT)
+  'date_end': ->
+    return moment(@to).format(DATE_FORMAT)
+  'time_start': ->
+    return moment(@from).format(TIME_FORMAT)
+  'time_end': ->
+    return moment(@to).format(TIME_FORMAT)
+
 
 Template.event_form.rendered = ->
   $(".categories-chooser").chosen()

  'mine': ->
    Meteor.user()?.profile?.events.indexOf(@_id) > -1
  'when': ->
    dateStart = moment(@date_start, "YYYY-MM-DD")
    timeStart = moment(@time_start, "hh-mm")

    dateEnd = moment(@date_end, "YYYY-MM-DD")
    timeEnd = moment(@time_end, "hh-mm")

    from = dateStart.hour(timeStart.hour()).minute(timeStart.minute())
    to = dateEnd.hour(timeEnd.hour()).minute(timeEnd.minute())

    "#{from.format('lll')} - #{to.format('lll')}"

Template.all.helpers
  'all_events': -> Events.find().fetch()

        sameElse : 'dddd, L[,] LT'
    }
})

DATE_FORMAT = "YYYY-MM-DD"
TIME_FORMAT = "HH:mm"

# convert undefined, single category to array
fix_categories = (categories) ->
