 
 
     filterize: ->
-        start = if @state.startDate
-            [d, m, y] = @state.startDate.split '/'
-            "#{y}-#{m}-#{d}T00:00:00.000Z"
+        getValue = (key) =>
+            return unless (value = @state[key + 'Date'])
+            moment(value, momentFormat)[key + 'Of']('day').toISOString()
 
-        end = if @state.endDate
-            [d, m, y] = @state.endDate.split '/'
-            "#{y}-#{m}-#{d}T23:59:59.999Z"
-
-        @props.onDateFilter start, end
+        @props.onDateFilter getValue('start'), getValue('end')
 
 
     onReset: ->

        @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



momentFormat     = 'DD/MM/YYYY'
datePickerFormat = '%d/%m/%Y'

module.exports = DateRangePicker = React.createClass
    displayName: 'DateRangePicker'
