question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DatePicker maxDate and minDate

See original GitHub issue

It would be awesome to be able to set the maxDate and minDates that are considered selectable in the datePicker and timePicker. For example, using the range picker, I want to the user to only be able to select past dates/times. With something like jqueryui’s date picker you can set it with the (max/min)Date apis.

Currently this is sort of possible with validation but its not a great user experience.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:10
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

44reactions
abhipanoriancommented, Sep 9, 2019

I was able to accomplish this by

<DatePicker disabledDate={d => !d || d.isAfter("2002-12-31") || d.isSameOrBefore("1960-01-01") } format="YYYY-MM-DD HH:mm:ss" defaultPickerValue={moment("2002-12-31")} placeholder="Start" />

19reactions
Bobinhoscommented, Jan 18, 2018

@benjycui I would like to have minDate and maxDate too. disabledDate rule works only for days in month, not for months and years, so user can change months and years even though all dates in month/year are disabled. Or you can approve disabledDate behaviour for month/year pickers

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changing minDate and maxDate on the fly using jQuery ...
I have changed min date property of date time picker by using this $('#date').data("DateTimePicker").minDate(startDate);.
Read more >
How to Set minimum and maximum date in jQuery UI Datepicker
With minDate and maxDate options, you can restrict date range of jQuery UI Datepicker widget. The user will only able to select the...
Read more >
Datepicker Widget - jQuery UI API Documentation
The jQuery UI Datepicker is a highly configurable plugin that adds datepicker functionality to your pages. You can customize the date format and...
Read more >
jquery datepicker maxdate or maxDate and mindate or minDate
Date: A date object containing the maximum date. • Number: A number of days from today. For example 2 represents two days from...
Read more >
How to enable and disable or set maxDate and minDate in the ...
In this article, we have described with an example code, how to enable and disable or set maxDate and minDate in the datepicker....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found