mirror of https://github.com/nocodb/nocodb
Wing-Kam Wong
2 years ago
1 changed files with 25 additions and 0 deletions
@ -0,0 +1,25 @@
|
||||
export function getWeekdayByText(v: string) { |
||||
const m = { |
||||
monday: 0, |
||||
tuesday: 1, |
||||
wednesday: 2, |
||||
thursday: 3, |
||||
friday: 4, |
||||
saturday: 5, |
||||
sunday: 6, |
||||
}; |
||||
return m[v?.toLowerCase() || 'monday']; |
||||
} |
||||
|
||||
export function getWeekdayByIndex(idx: number): string { |
||||
const m = { |
||||
0: 'monday', |
||||
1: 'tuesday', |
||||
2: 'wednesday', |
||||
3: 'thursday', |
||||
4: 'friday', |
||||
5: 'saturday', |
||||
6: 'sunday', |
||||
}; |
||||
return m[idx || 0]; |
||||
} |
Loading…
Reference in new issue