DateTimePicker icon indicating copy to clipboard operation
DateTimePicker copied to clipboard

Add a way to set the picker's date to now

Open dsandstrom opened this issue 8 years ago • 0 comments

Here is what I have so far, but there is probably a better way:

afterShow: (elem) ->
  oDTP = this
  $picker = $('#post_published_at_picker')
  $picker.find('.dtpicker-value')
    .after('<div class="dtpicker-nowWrapper"><a class="dtpicker-buttonNow">change to now</a></div>')
  $picker.find('.dtpicker-buttonNow').on 'click', ->
    # TODO: allow now's time zone to be different than browser time zone
    now = new Date()
    oDTP.oData.iCurrentYear = now.getFullYear()
    oDTP.oData.iCurrentMonth = now.getMonth()
    oDTP.oData.iCurrentDay = now.getDate()
    oDTP.oData.iCurrentHour = now.getHours()
    oDTP.oData.iCurrentMinutes = now.getMinutes()
    oDTP._setCurrentDate()
.dtpicker-nowWrapper {
  text-align: center;
}

dsandstrom avatar Aug 18 '16 23:08 dsandstrom