Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Set Fuel UX datepicker to restrict all dates but today and the previous year
var today = new Date();
var tomorrow = new Date();
tomorrow = new Date(tomorrow.setDate(tomorrow.getDate() + 1));
var aYearAgo = new Date(today.getTime());
aYearAgo.setFullYear(aYearAgo.getFullYear() - 1);
document.write(today + '<br\>');
document.write(aYearAgo + '<br\>');
document.write(tomorrow + '<br\>');
// initialize
allowPastDates: true,
restricted: [{
from: -Infinity,
to: aYearAgo
from: tomorrow,
to: Infinity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.