forked from calcom/cal.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I18n's the i18n language dropdown & weekday using Intl (calcom#955)
* I18n's the i18n language dropdown & weekday using Intl * Some type fixes * Trigger locale changes instantly (calcom#958) * Trigger locale changes instantly * Restored types * Capitalize languages across the board Co-authored-by: Omar López <[email protected]> Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
b5e176a
commit ce8e9c1
Showing
3 changed files
with
270 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// By default starts on Sunday (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday) | ||
export function weekdayNames(locale: string | string[], weekStart = 0, type: "short" | "long" = "long") { | ||
return Array.from(Array(7).keys()).map((d) => nameOfDay(locale, d + weekStart, type)); | ||
} | ||
|
||
export function nameOfDay(locale: string | string[], day: number, type: "short" | "long" = "long") { | ||
return new Intl.DateTimeFormat(locale, { weekday: type }).format(new Date(1970, 0, day + 4)); | ||
} |
Oops, something went wrong.