5

I am using piackadate.js as a date picker for my site. I would like to implement the functionality that would disable any previous date. I read the docs on disabling dates but I don't see a way to disable all previous dates.

How would one do this?

L84
  • 45,514
  • 58
  • 177
  • 257

2 Answers2

28

You can do it much easier. It will disable all the previous dates.

$('#test').pickadate({
    min: true
});
NXT
  • 1,981
  • 1
  • 24
  • 30
10

Try this:

var yesterday = new Date((new Date()).valueOf()-1000*60*60*24);

$('#test').pickadate({
  disable: [
    { from: [0,0,0], to: yesterday }
  ]
});

1000*60*60*24 is the number of milliseconds in a day.

Demo: http://jsfiddle.net/alan0xd7/kdoo53vg/

alan0xd7
  • 1,831
  • 1
  • 15
  • 19