Skip to content

Allow full day states.#57

Open
miracle2k wants to merge 1 commit into
onefinestay:masterfrom
miracle2k:fullday-ranges
Open

Allow full day states.#57
miracle2k wants to merge 1 commit into
onefinestay:masterfrom
miracle2k:fullday-ranges

Conversation

@miracle2k

Copy link
Copy Markdown

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
Copy Markdown

Any input on that? Will it be merged?

@TimBeyer

TimBeyer commented Mar 6, 2016

Copy link
Copy Markdown

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.

Comment thread src/DateRangePicker.jsx
// 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
Copy Markdown

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
Copy Markdown
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

susutou commented Apr 26, 2016

Copy link
Copy Markdown

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

Vincz commented Dec 1, 2016

Copy link
Copy Markdown

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

@moimikey

moimikey commented Dec 1, 2016

Copy link
Copy Markdown
Member

@miracle2k an accompanying test would be nice to have

@miracle2k

Copy link
Copy Markdown
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