I have a form and one button to plus some minutes to a time(hh:MM), but the time is a span tag.
At Firefox works well, but when I tested at Chrome doesn't work the Date(). What happened?
//Botão adicionar horário agenda.
$('.button').click(function() {
var $duration_schedule = $('#duration');
var duration = $duration_schedule.val(); // 30
var hour = $('.time_schedule_form').text(); // 10:00
var new_time = self.Plus_minutes(hour, duration);
alert(new_time); // 10:30
});
Plus_minutes: function(hour, duration) {
var time, new_hour, hours = '';
time = new Date("T"+hour); // Erro at Chrome
time.setTime(time.getTime() + duration*60000);
hours = time.getHours().toString();
minutes = time.getMinutes().toString();
if (minutes.length > 1) {
new_hour = hours + ':' + minutes;
} else {
new_hour = hours + ':0' + minutes;
}
return new_hour;
},