Jquery datetimepicker - Advance time by 1 hour -
i'm using jquery datetimepicker add-on here
it works perfectly, i'm stumped on how add small bit of functionality it. have 2 instances on page, 1 start-time , 1 end-time. when choose start-time, i'd automatically fill in end-time start time + 1 hour.
can accomplished without extending core script @ all?
the following add 1 hour end-time datepicker.
$('#dtstartdate').datetimepicker({ onselect: function(){ var startdate = $('#dtstartdate').datetimepicker('getdate')); var enddate = new date(parsefloat(startdate.sethours(startdate.gethours()+1))) //get ending date datepart var enddatedatepart = enddate.getfullyear() + '/' + enddate.getmonth() + '/' + enddate.getdate(); //calculate ending date time part including am/pm var enddatetimepart; if (enddate.gethours() > 12) { enddatetimepart = enddate.gethours()-12 + ':' + enddate.getminutes() + ' pm';} else {enddatetimepart = enddate.gethours() + ':' + enddate.getminutes() + ' am';} $('#dtenddate').datetimepicker('setdate', enddatedatepart + ' ' + enddatetimepart ); } });
Comments
Post a Comment