timepickerpop
timepickerpop copied to clipboard
Changing AM to PM does not display the time correctly in the popup.
If I type 06:00 AM in the time field the time in popup is correctly adjusted. If I change the AM in the time field, the popup shows 12:00 PM and further changes to the time don't change the time in the popup unless the PM is changed back to AM.
Fixed as follows. Use parseInt to change the hour to number before adding 12. In your version '06' + 12 = '0612', not 18.
if (apm[0].toLowerCase() == 'pm') {
sp[0] = parseInt(sp[0], 10) + 12;
}
In the process of fixing this, I also added on-change to use ng-change on the time picker.
I like the timepickerpop. A great effort from someone new to AngularJS.
Thanks.
Thank you so much you saved my day :) :)