```coffeescript
$(document).on 'ready page:change', ->
  $('input[type=datetime]').prop('type','text').datetimepicker
    useSeconds: false
    sideBySide: false

  $('input[type=date]').prop('type','text').datetimepicker
    pickTime: false

  $('input.datetime').on 'dp.change', (event)->
    hidden = $(event.target).next 'input[type=hidden]'
    hidden.val event.date.format 'YYYY-MM-DDTHH:mm'

  $('input.date').on 'dp.change', (event)->
    hidden = $(event.target).next 'input[type=hidden]'
    hidden.val event.date.format 'YYYY-MM-DD'
```

Allow to clear datetime inputs
user
```coffeescript
$(document).on 'ready page:change', ->
  $('input[type=datetime]').prop('type','text').datetimepicker
    useSeconds: false
    sideBySide: false

  $('input[type=date]').prop('type','text').datetimepicker
    pickTime: false

  handleChange = (format)->
    (event)->
      hidden = $(event.target).next 'input[type=hidden]'
      hidden.val event.date.format format

  handleEmpty = (event)->
    hidden = $(event.target).next 'input[type=hidden]'
    hidden.val '' if event.target.value == ''

  $('input.datetime')
    .on 'dp.change', handleChange('YYYY-MM-DDTHH:mm')
    .on 'change', handleEmpty

  $('input.date')
    .on 'dp.change', handleChange('YYYY-MM-DD')
    .on 'change', handleEmpty
```
assistant