File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 88 "files" : [" **.ts" ],
99 "rules" : {
1010 "no-useless-constructor" : " off" ,
11- "@typescript-eslint/no-useless-constructor" : " error"
11+ "@typescript-eslint/no-useless-constructor" : " error" ,
12+ "jsdoc/require-returns-type" : " off"
1213 }
1314 },
1415 {
Original file line number Diff line number Diff line change @@ -8,15 +8,17 @@ import { getCanonicalLocale } from './locale'
88
99declare let window : Nextcloud . v27 . WindowWithGlobals
1010
11+ export type WeekDay = 0 | 1 | 2 | 3 | 4 | 5 | 6
12+
1113/**
1214 * Get the first day of the week
1315 *
14- * @return { number }
16+ * @return The first day where 0 is Sunday, 1 is Monday etc.
1517 */
16- export function getFirstDay ( ) : number {
18+ export function getFirstDay ( ) : WeekDay {
1719 // Server rendered
1820 if ( typeof window . firstDay !== 'undefined' ) {
19- return window . firstDay
21+ return window . firstDay as WeekDay
2022 }
2123
2224 // Try to fallback to Intl
@@ -33,7 +35,7 @@ export function getFirstDay(): number {
3335 const weekInfo : WeekInfo = intl . getWeekInfo ?.( ) ?? intl . weekInfo
3436 if ( weekInfo ) {
3537 // Convert 1..7 to 0..6 format
36- return weekInfo . firstDay % 7
38+ return weekInfo . firstDay % 7 as WeekDay
3739 }
3840
3941 // Fallback to Monday
You can’t perform that action at this time.
0 commit comments