Skip to content

Commit 6569d7a

Browse files
authored
Merge pull request #138 from lfester/fix/last-day-of-month-unhighlighted
Fix end of month is start of day
2 parents 68b062a + 296390e commit 6569d7a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/react-chayns-calendar/component/Calendar.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,25 +102,25 @@ export default class Calendar extends Component {
102102
title: monthNames[_leftHidden.getMonth()],
103103
className: 'month',
104104
startDate: _leftHidden,
105-
endDate: new Date(_leftHidden.getFullYear(), _leftHidden.getMonth() + 1, 0),
105+
endDate: new Date(_leftHidden.getFullYear(), _leftHidden.getMonth() + 1, _leftHidden.getDate(), 23, 59, 59, 999),
106106
},
107107
{
108108
title: monthNames[_rightShown.getMonth()],
109109
className: 'month',
110110
startDate: _rightShown,
111-
endDate: new Date(_rightShown.getFullYear(), _rightShown.getMonth() + 1, 0),
111+
endDate: new Date(_rightShown.getFullYear(), _rightShown.getMonth() + 1, _rightShown.getDate(), 23, 59, 59, 999),
112112
},
113113
{
114114
title: monthNames[_focus.getMonth()],
115115
className: 'month',
116116
startDate: new Date(_focus.getFullYear(), _focus.getMonth(), 1),
117-
endDate: new Date(_focus.getFullYear(), _focus.getMonth() + 1, 0),
117+
endDate: new Date(_focus.getFullYear(), _focus.getMonth() + 1, _focus.getDate(), 23, 59, 59, 999),
118118
},
119119
{
120120
title: monthNames[_rightHidden.getMonth()],
121121
className: 'month',
122122
startDate: _rightHidden,
123-
endDate: new Date(_rightHidden.getFullYear(), _rightHidden.getMonth() + 1, 0),
123+
endDate: new Date(_rightHidden.getFullYear(), _rightHidden.getMonth() + 1, _rightHidden.getDate(), 23, 59, 59, 999),
124124
}];
125125

126126
this.newMonths = months;

0 commit comments

Comments
 (0)