Skip to content

Instantly share code, notes, and snippets.

@mischah
Created July 18, 2014 00:05
Show Gist options
  • Save mischah/08e86a08772a33166984 to your computer and use it in GitHub Desktop.
Save mischah/08e86a08772a33166984 to your computer and use it in GitHub Desktop.
The power of moment.js

#The power of Moment.js

Use case:

  • start date: current day + 2 days
  • end date: current day + 7 days
  • default date: current day + 2 days
  • disabled dates: Sundays within the range of start date to end date

http://momentjs.com

$form.find('#deliveryDate').datetimepicker($.extend(amsel.base.getDatetimepickerDefaults(), {
startDate: moment().add('days', 2),
endDate: moment().add('days', 7),
defaultDate: moment().add('days', 2),
disabledDates: [moment().day(7)],
})).on('change.dp', function() {
$(this).trigger('blur');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment