From 5cea4e3a1bc2307ebd2be37ffa3ace85de84772a Mon Sep 17 00:00:00 2001 From: Roman Rott Date: Sat, 15 Oct 2016 14:37:18 +0300 Subject: [PATCH] Fixed issue with rendering calendar incorrectly when first day of a month is Sunday --- components/date_picker/CalendarDay.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/date_picker/CalendarDay.js b/components/date_picker/CalendarDay.js index c61ac43e..12829f91 100644 --- a/components/date_picker/CalendarDay.js +++ b/components/date_picker/CalendarDay.js @@ -20,8 +20,9 @@ class Day extends Component { dayStyle () { if (this.props.day === 1) { const e = (this.props.sundayFirstDayOfWeek) ? 0 : 1; + const firstDay = time.getFirstWeekDay(this.props.viewDate) - e; return { - marginLeft: `${(time.getFirstWeekDay(this.props.viewDate) - e) * 100 / 7}%` + marginLeft: `${ (firstDay >= 0 ? firstDay : 6) * 100 / 7 }%` }; } }