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()); }
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()); }