Skip to content

Commit 00a7406

Browse files
author
Marie Shulgina
committed
changed the month view to start from Monday
1 parent 0978c6d commit 00a7406

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,8 @@ <h1>Codam Calendar</h1>
866866
function buildMonthCells(cursor) {
867867
const first = startOfMonth(cursor);
868868
const last = new Date(cursor.getFullYear(), cursor.getMonth() + 1, 0);
869-
const startOffset = first.getDay();
869+
const startDay = first.getDay();
870+
const startOffset = startDay === 0 ? 6 : startDay - 1;
870871
const totalCells = Math.ceil((startOffset + last.getDate()) / 7) * 7;
871872

872873
const cells = [];
@@ -882,7 +883,7 @@ <h1>Codam Calendar</h1>
882883
function renderMonthView(eventsByDay) {
883884
const cursor = state.monthCursor;
884885
const cells = buildMonthCells(cursor);
885-
const weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
886+
const weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
886887
const todayKey = dayKey(new Date());
887888

888889
const html = `

0 commit comments

Comments
 (0)