Skip to content

Instantly share code, notes, and snippets.

@jaseflow
Created January 18, 2013 01:04
Show Gist options
  • Save jaseflow/4561422 to your computer and use it in GitHub Desktop.
Save jaseflow/4561422 to your computer and use it in GitHub Desktop.
$('.datepicker-toggle').datepicker({
numberOfMonths: 6,
dateFormat: 'D dd M',
minDate: 0,
showAnim: '',
onSelect: function(dateText, inst) {
var selectedDate = this.value;
// need to make this detect todays date
if (this.value == 'Fri 18 Jan') {
this.events.showError();
}
else {
$('.error').removeClass('active');
$('.datepicker-body').removeClass('has-error');
var $returnHtml = $('<div class="datepicker"><input type="text" placeholder="(Optional)" readonly class="datepicker-toggle return active flat" id="arrive"><a href="#arrive" class="datepicker-close"></a></div>');
$('.datepicker-toggle.active').removeClass('active');
$('.datepicker-body').append($returnHtml);
setTimeout(function() {
$('#arrive').datepicker('show');
},240);
$returnHtml.find('.datepicker-toggle').datepicker({
numberOfMonths: 6,
dateFormat: 'D dd M',
minDate: 0,
showAnim: '',
onSelect: function(e) {
if (this.value == selectedDate) {
alert('same day bro');
};
if (this.value == 'Sat 19 Jan') {
$(this).addClass('same-day');
};
$('.datepicker-close').addClass('active');
}
});
$('.strip-done').removeClass('btn-disabled').addClass('btn-success').attr('href','#datepicker-wrap');
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment