ericjgagnon / wickedpicker

A simple jQuery timepicker
http://ericjgagnon.github.io/wickedpicker/
MIT License
93 stars 78 forks source link

Method is missing to update time #74

Closed jaimestuardo closed 6 years ago

jaimestuardo commented 6 years ago

I have encountered the problem that if the input is being set by other mechanism, the time of the control is not refreshed, so I have added the following public method to refresh the time from the current INPUT value:

_update: function () { var currentTime = $(this.element).val().replace(/ /g, ''); if (currentTime != '') this.options.now = currentTime; var time = this.timeArrayFromString(this.options.now); this.options.now = new Date(today.getFullYear(), today.getMonth(), today.getDate(), time[0], time[1], time[2]); this.selectedHour = this.parseHours(this.options.now.getHours()); this.selectedMin = this.parseSecMin(this.options.now.getMinutes()); this.selectedSec = this.parseSecMin(this.options.now.getSeconds()); this.selectedMeridiem = this.parseMeridiem(this.options.now.getHours()); }