jonthornton / Datepair.js

A javascript plugin for intelligently selecting date and time ranges, inspired by Google Calendar.
https://www.jonthornton.com/Datepair.js
358 stars 87 forks source link

Duration not updated when changing time using setTime #102

Closed mayankaggarwal092 closed 6 years ago

mayankaggarwal092 commented 6 years ago

When you change the value of start time and end time using the setTime method of timepicker, the duration is not updated. Instead we see duration that correspond to earlier start time.

jonthornton commented 6 years ago

Datepair is triggered by the change event. You can cause the duration update by firing a synthetic event after calling setTime. With jQuery, you'd do something like this:

$('#someTimeInput').timepicker('setTime', new Date()).trigger('change')