Skip to content

Commit

Permalink
fix: fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wildergd committed May 22, 2020
1 parent 335cf2f commit 746feaa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/components/Calendar/day.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ function DayComponent(props) {
<StyledDayButton
ref={buttonRef}
tabIndex={tabIndex}
onClick={() => onChange(new Date(date))}
onMouseEnter={() => privateOnHover(new Date(date))}
onClick={() => onChange(date)}
onMouseEnter={() => privateOnHover(date)}
isSelected={isSelected}
isHovered={!isSelected && isRangeEndDate}
data-selected={isSelected}
Expand Down
8 changes: 5 additions & 3 deletions src/components/Calendar/helpers/isDateWithinRange.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import compareDates from './compareDates';

export default function isDateWithinRange(date, range) {
if (!date || !Array.isArray(range) || range.length <= 1) return false;
const [rangeStart, rangeEnd] = range;
return compareDates(date, rangeStart) >= 0 && compareDates(date, rangeEnd) <= 0;
if (date && Array.isArray(range) && range.length > 1) {
const [rangeStart, rangeEnd] = range;
return compareDates(date, rangeStart) >= 0 && compareDates(date, rangeEnd) <= 0;
}
return false;
}
4 changes: 2 additions & 2 deletions src/components/Calendar/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ import React from 'react';
import { Card, Calendar, Avatar } from 'react-rainbow-components';

initialState = { range: [
new Date(2019, 0, 5),
new Date(2019, 0, 6)
new Date(2019, 0, 3),
new Date(2019, 0, 15)
] };
const calendarContainerStyles = {
width: '28rem',
Expand Down

0 comments on commit 746feaa

Please sign in to comment.