Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow full day states. #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

miracle2k
Copy link

Currently the date range picker has this behaviour, where the start and end
date of a blocked range is actually selectable, and considered to be a "half"
day (internally called am or pm). I think this is not desirable in many cases,
including ours.

This adds a new property fullDayStates (default false) that can be used to change the
behaviour.

As an implementation note, I found the behaviour of the transparent "default"
state ranges that are being inserted a bit confusing; it means that the
DatePicker assumes that the user provided state ranges are (a) ordered (b) do
not overlap (which is not an obvious assumption) and for this change it means
we have to make an change in the way the default ranges are generated, since
otherwise the CalenderDate object has a hard time telling if it is at a range
boundary or not (see the comment in getDateStates).

@jniechcial
Copy link

Any input on that? Will it be merged?

@TimBeyer
Copy link

TimBeyer commented Mar 6, 2016

This would be very useful for me right now. Is there anything that needs to be added for this PR to be merged? I'd be willing to invest some time.

// the other begins; for the block to work, we have to extend the
// ranges by one day.
blockedRanges = blockedRanges.map(r => {
r = r.clone(); r.start.subtract(1, 'day'); r.end.add(1, 'day'); return r; })
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it might be more readable to split this up into multiple lines.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@miracle2k if you could just split these lines up for readability

@susutou
Copy link

susutou commented Apr 26, 2016

It would be great to take a look at this PR and decide whether to merge it or making further changes. This would be very useful for many cases when the range picker is not used for hotel-related dates selection.

@Vincz
Copy link

Vincz commented Dec 1, 2016

Any update about this PR ? I agree that the current behavior doesn't match every use case...

@moimikey
Copy link
Member

moimikey commented Dec 1, 2016

@miracle2k an accompanying test would be nice to have

@miracle2k
Copy link
Author

I don't have time to work on this at this time, but would be glad if someone could help get it merged.

sub added a commit to feries/react-daterange-picker that referenced this pull request Jul 4, 2017
sub added a commit to feries/react-daterange-picker that referenced this pull request Feb 15, 2018
claudioquaglia pushed a commit to feries/react-daterange-picker that referenced this pull request Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants