1
1
mirror of https://github.com/ellie/atuin.git synced 2024-08-18 01:10:37 +03:00

fix(gui): weekInfo call on Edge (#2252)

This commit is contained in:
Ellie Huxtable 2024-07-10 17:11:34 +01:00 committed by GitHub
parent 35bbaea0e4
commit 69def05f75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 2 deletions

View File

@ -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");
}

View File

@ -17,6 +17,7 @@ import {
import { invoke } from "@tauri-apps/api/core";
import { sessionToken, settings } from "./client";
import { getWeekInfo } from "@/lib/utils";
// I'll probs want to slice this up at some point, but for now a
// big blobby lump of state is fine.
@ -47,8 +48,7 @@ let state = (set: any, get: any): AtuinState => ({
shellHistory: [],
calendar: [],
// @ts-ignore
weekStart: new Intl.Locale(navigator.language).getWeekInfo().firstDay,
weekStart: getWeekInfo().firstDay,
refreshAliases: () => {
invoke("aliases").then((aliases: any) => {