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

Fix for the start date of the range to allow it to contain a time. #62

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Surreal9
Copy link

We needed to support a date range with a time for the start date, and it wasn't being highlighted properly in the calendar even though it worked fine without a time.

@@ -41,15 +41,23 @@ const CalendarMonth = React.createClass({
let isSelectedRangeStart;
let isSelectedRangeEnd;

if (!hideSelection && value && moment.isMoment(value) && value.isSame(d, 'day')) {
isSelectedDate = true;
} else if (!hideSelection && value && isMomentRange(value) && value.contains(d)) {
Copy link
Author

Choose a reason for hiding this comment

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

The problem was that value.contains would return false when d was say midnight august 2nd and value.start was 5 pm august 2nd. This was only an issue for the start date since the end date of midnight would still be within a date range specified for a time later that same day.

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.

1 participant