Fixed issue with rendering calendar incorrectly when first day of a month is Sunday

old
Roman Rott 2016-10-15 14:37:18 +03:00
parent dd1d5d1466
commit 5cea4e3a1b
No known key found for this signature in database
GPG Key ID: F6909DFE38B6B4D3
1 changed files with 2 additions and 1 deletions

View File

@ -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 }%`
};
}
}