aboutsummaryrefslogtreecommitdiffstats
path: root/ui/src/lib/utils.ts
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@atuin.sh>2024-07-10 17:11:34 +0100
committerGitHub <noreply@github.com>2024-07-10 17:11:34 +0100
commit69def05f759f29384ca242f57adc8600aff6de72 (patch)
tree160d523ef8a938ad0b701ed5d320bbda2030ad4c /ui/src/lib/utils.ts
parentchore(deps): update prost-types (#2251) (diff)
downloadatuin-69def05f759f29384ca242f57adc8600aff6de72.zip
fix(gui): weekInfo call on Edge (#2252)
Diffstat (limited to 'ui/src/lib/utils.ts')
-rw-r--r--ui/src/lib/utils.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/ui/src/lib/utils.ts b/ui/src/lib/utils.ts
index c56d3687..db66b3be 100644
--- a/ui/src/lib/utils.ts
+++ b/ui/src/lib/utils.ts
@@ -29,3 +29,20 @@ const twMerge = extendTailwindMerge({
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
+
+// edge still uses the old one
+export function getWeekInfo() {
+ let locale = new Intl.Locale(navigator.language);
+
+ // @ts-ignore
+ if (locale.getWeekInfo) {
+ // @ts-ignore
+ return locale.getWeekInfo();
+ // @ts-ignore
+ } else if (locale.weekInfo) {
+ // @ts-ignore
+ return locale.weekInfo;
+ }
+
+ throw new Error("Could not fetch week info via new or old api");
+}