Skip to content

Commit

Permalink
fuck the linter
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniDigger committed Aug 16, 2024
1 parent 445d470 commit 5bccb5c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions frontend/src/composables/useTime.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import type { Composer } from "vue-i18n";

export function lastUpdated(date: Date | string, i18n?: Composer): string {
i18n = i18n ?? useI18n();
// some dum linter hates me
const lang = (i18n ?? useI18n())!;
date = new Date(date);
const today: Date = new Date();
const todayTime = today.getTime();
const dateTime = date.getTime();
const todayDays = Math.floor(todayTime / (1000 * 60 * 60 * 24));
const dateDays = Math.floor(dateTime / (1000 * 60 * 60 * 24));
if (todayDays === dateDays) {
return i18n.t("general.today") + " " + i18n.d(date, "clock");
return lang.t("general.today") + " " + lang.d(date, "clock");
} else if (todayDays === dateDays + 1) {
return i18n.t("general.yesterday") + " " + i18n.d(date, "clock");
return lang.t("general.yesterday") + " " + lang.d(date, "clock");
} else if (todayDays - dateDays < 7) {
return i18n.d(date, "shortweektime");
return lang.d(date, "shortweektime");
} else {
return i18n.d(date, "date");
return lang.d(date, "date");
}
}

0 comments on commit 5bccb5c

Please sign in to comment.