arqex / react-datetime

A lightweight but complete datetime picker react component.
2k stars 872 forks source link

Option to set start and end range of date / time #371

Open guoyunhe opened 7 years ago

guoyunhe commented 7 years ago

I'm Submitting a ...

[ ] Bug report
[x] Feature request
[ ] Support request

Steps to Reproduce

By giving from and to property, users can control how many days will be shown on data time picker.

<Datetime from={new Date('2017-08-31')} to={new Date('2017-08-01')} />

It is different from the isValid property. isValid will disable some dates but still show them. It is not convenient for users to navigate if the restricted date is not in this month but several months later.

Expected Results

Actual Results

Minimal Reproduction of the Problem

Other Information (e.g. stacktraces, related issues, suggestions how to fix)

ramjak commented 7 years ago

I second this. We can add default value to make navigation less hassle but the defaultValue also add an input value which is not good for UX

shawninder commented 7 years ago

Seems this issue was closed because of a duplicate, but that duplicate is also closed... Is this a mistake or has this feature request been turned down?

By the way @ramjak , it's pretty simple to make a datetime range picker by using 2 instances of this datetime picker, each associated to either "from" or "to". Perhaps that could be a solution for you?

ramjak commented 7 years ago

It's been a while since I wrote this, I have found the solution. I might be miss it because it is not found on the documentation. Ty for the reply anyway

kjell commented 6 years ago

Hi - I have a date picker where the first isValidDate is often in the next month and I'd like to only show months with valid days in them. I can't find an option to do so in the documentation - @ramjak would you mind sharing how you solved this?

update: defaultValue works well enough to start in the right place. It would still be nice to disable anything outside of a start / end range.

simeg commented 6 years ago

@shawninder This issue is not closed.

I labeled this issue as a v3 candidate, meaning it would be nice to have this in v3. This means it will probably not happen for a while, but it's on our roadmap.