#= require ./calendar-vendor
Dunlop.register_setup 'calendar', (target) ->
  target.find('.datepicker').calendar
    firstDayOfWeek: 1
    type: 'date'
    formatter:
      date: (date, settings) ->
        return '' unless date
        moment(date).format().substr(0, 10)
      datetime: (date, settings) ->
        return '' unless date
        moment(date).format().substr(0, 10)

  target.find('.timepicker').calendar
    ampm: false
    firstDayOfWeek: 1
    type: 'time'
    formatter:
      time: (date, settings) ->
        return '' unless date
        date.toISOString()
        moment(date).format()
      datetime: (date, settings) ->
        return '' unless date
        moment(date).format()
