#= require ./behavior

class window.DatePickSetter extends window.Behavior

  init: ->
    @range = @data('datepick-setter-range', 7)

    @$dom.click =>
      @setPickers()

  startDom: ->
    @domData('datepick-setter-start-target')

  endDom: ->
    @domData('datepick-setter-end-target')

  startDate: ->
    moment().subtract('days', @range)

  endDate: ->
    moment()

  setPickers: ->
    @startDom().datepicker('setDate', @startDate().toDate()).change()
    @endDom().datepicker('setDate', @endDate().toDate()).change()
