Skip to content

Commit 81b0c87

Browse files
author
Tautvilas Mecinskas
committed
fix: change how scroll to month is calculated
1 parent 3313cbf commit 81b0c87

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/calendar-list/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ class CalendarList extends Component {
8383
scrollToMonth(m) {
8484
const month = parseDate(m);
8585
const scrollTo = month || this.state.openDate;
86-
let diffMonths = this.state.openDate.diffMonths(scrollTo);
87-
diffMonths = diffMonths < 0 ? Math.ceil(diffMonths) : Math.floor(diffMonths);
86+
let diffMonths = Math.round(this.state.openDate.clone().setDate(1).diffMonths(scrollTo.clone().setDate(1)));
8887
const scrollAmount = (calendarHeight * this.pastScrollRange) + (diffMonths * calendarHeight);
8988
//console.log(month, this.state.openDate);
9089
//console.log(scrollAmount, diffMonths);

0 commit comments

Comments
 (0)