 
 momentFormat     = 'DD/MM/YYYY'
 datePickerFormat = '%d/%m/%Y'
-
 
 module.exports = DateRangePicker = React.createClass
     displayName: 'DateRangePicker'

        @changeDates 'month'

    changeDates: (type) ->
        value = moment().subtract(1, type).startOf(type) if type
        state =
            isActive    : !!type
            startDate   : value?.format momentFormat
            endDate     : value?.endOf(type).format momentFormat

        @setState state, @filterize




    filterize: ->
        getValue = (key) =>
            return unless (value = @state[key + 'Date'])
            moment(value, momentFormat)[key + 'Of']('day').toISOString()

        @props.onDateFilter getValue('start'), getValue('end')


    onReset: ->
