Skip to content

Instantly share code, notes, and snippets.

@vertiginous
Created February 18, 2011 14:58
Show Gist options
  • Save vertiginous/833761 to your computer and use it in GitHub Desktop.
Save vertiginous/833761 to your computer and use it in GitHub Desktop.
var Scheduler = function(){
this.minDate = new Date(2011, 2, 7);
this.maxDate = new Date(2011, 2, 11);
this.update_time = function(value, element) {
var date = new Date(this.minDate.getTime());
date.setTime(date.getTime() + value);
element.val(date.strftime("%a %R"));
};
this.dateDiff = function(d1, d2) {
return Math.floor((d2.getTime() - d1.getTime()) );
};
this.max = function(){
return this.dateDiff(this.minDate, this.maxDate);
};
};
$(function() {
var scheduler = new Scheduler
// so the meeting-time box isn't blank before
// the slider is moved
scheduler.update_time(0, $("#meeting-time"))
$("#meeting-start").slider({
max: scheduler.max(),
value: 0,
step: 900000,
slide: function( event, ui ) {
scheduler.update_time(ui.value, $("#meeting-time"));
}
})
.find( ".ui-slider-handle" )
.append( "<div id='line'></div> " );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment