This repository was archived by the owner on Oct 7, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ async function buildCalendarView(stack) {
148148 dateFormatter . dateFormat = "MMMM" ;
149149
150150 // if calendar is on a small widget make it a bit smaller to fit
151- const spacing = config . widgetFamily === "small" ? 18 : 20 ;
151+ const spacing = config . widgetFamily === "small" ? 18 : 19 ;
152152
153153 // Current month line
154154 const monthLine = rightStack . addStack ( ) ;
@@ -160,9 +160,6 @@ async function buildCalendarView(stack) {
160160 font : Font . boldSystemFont ( 13 ) ,
161161 } ) ;
162162
163- // between the month name and the week calendar
164- rightStack . addSpacer ( 5 ) ;
165-
166163 const calendarStack = rightStack . addStack ( ) ;
167164 calendarStack . spacing = 2 ;
168165
@@ -286,18 +283,22 @@ function buildMonthVertical() {
286283 let index = 1 ;
287284 let offset = 1 ;
288285
286+ // weekdays are 0 indexed starting with sunday
287+ let firstDay = firstOfMonth . getDay ( ) !== 0 ? firstOfMonth . getDay ( ) : 7 ;
288+
289289 if ( startWeekOnSunday ) {
290290 month . unshift ( [ "S" ] ) ;
291291 index = 0 ;
292292 offset = 0 ;
293+ firstDay = firstDay % 7 ;
293294 } else {
294295 month . push ( [ "S" ] ) ;
295296 }
296297
297298 let dayStackCounter = 0 ;
298299
299300 // fill with empty slots
300- for ( ; index < firstOfMonth . getDay ( ) ; index += 1 ) {
301+ for ( ; index < firstDay ; index += 1 ) {
301302 month [ index - offset ] . push ( " " ) ;
302303 dayStackCounter = ( dayStackCounter + 1 ) % 7 ;
303304 }
You can’t perform that action at this time.
0 commit comments