Skip to content

Commit

Permalink
Fix wrong weekday when using startFromMonday on some locale. See #49 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kuyarawa authored and peacechen committed Jun 26, 2018
1 parent dc45e13 commit c31e054
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CalendarPicker/DaysGridView.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ export default function DaysGridView(props) {
// The weekday() method returns the day of the week (from 0 to 6) for the specified date.
// Note: Sunday is 0, Monday is 1, and so on. We will need this to know what
// day of the week to show day 1
const firstWeekDay = firstDayOfMonth.weekday();
// timezone issue fix:
// use isoWeekday() instead of weekday() to get the consistent weekday of all locale
const firstWeekDay = firstDayOfMonth.isoWeekday();
// fill up an array of days with the amount of days in the current month
const days = Array.apply(null, {length: totalDays}).map(Number.call, Number);
const guideArray = [ 0, 1, 2, 3, 4, 5, 6 ];
Expand Down

0 comments on commit c31e054

Please sign in to comment.