PitPik / tinyDatePicker

NEW: Tiny javascript and jQuery date / time picker [datepicker]
http://www.dematte.at/tinyDatePicker/
MIT License
57 stars 14 forks source link

Add 'apply' button for time #7

Closed chriscarpenter12 closed 7 years ago

chriscarpenter12 commented 7 years ago

Is it possible to add an 'apply' button that inserts the time values in the timepicker into the input field? For instance if the input is blank and i have a readValue function that starts at the current time. The only want to apply that to the input is to change a value (hours, minutes or seconds) and change it back to the original value for it to get applied to the input field.

chriscarpenter12 commented 7 years ago

Not sure if this is the most elegant solution, but it works.

if (/apply/.test(className)) {
  $('#'+_this.currentInput.id).val(_this.date.hour+':'+_this.date.minute+':'+_this.date.second);
  _this.toggle();
}