longbill / jquery-date-range-picker

A jQuery plugin that allows user to select a date range
MIT License
1.12k stars 579 forks source link

Disable past days #330

Closed f1ss1on closed 6 years ago

f1ss1on commented 7 years ago

How can I disable the user from selecting any past days. The user should be able to select any future dates just not be able to select any past dates.

DanielStegemann commented 7 years ago

+1

Idea: Introduce a parameter to define the relative start date. Possible values could be "0d" for today, "-1d" for yesterday or "+1d" for tomorrow as start date.

400Tryon commented 6 years ago

+1

Wondering if anybody has found a way to do this with existing code?

400Tryon commented 6 years ago

Quick followup here. Here's what I did: { startDate: Date(), }

I did not specify an endDate, and all seems to be ok. I had originally put something far in the future, but I don't believe it's needed in conjunction with startDate

holtkamp commented 6 years ago

@400Tryon thanks, that sounds like a good approach. Also check out the examples: http://longbill.github.io/jquery-date-range-picker/

ghost commented 5 years ago

Can someone explain this? Whenever i add "startDate: Date()," The calendar goes to undefined.

monovertex commented 5 years ago

Hi @vedaleondesign. Please see the docs here: http://longbill.github.io/jquery-date-range-picker/.

This string defines the earliest date which is allowed for the user, same format as format

The value of startDate is supposed to be a String, with the format specified in the format option or false.