fix time calc and add drizzle link change

This commit is contained in:
Face 2025-07-15 18:35:30 +03:00
parent 0f13b74ddf
commit 32bfbf816c
4 changed files with 2210 additions and 3 deletions

View file

@ -0,0 +1 @@
ALTER TABLE "notification" ADD COLUMN "link" text;

File diff suppressed because it is too large Load diff

View file

@ -8,6 +8,13 @@
"when": 1750863600119, "when": 1750863600119,
"tag": "0000_chief_korath", "tag": "0000_chief_korath",
"breakpoints": true "breakpoints": true
},
{
"idx": 1,
"version": "7",
"when": 1752593600974,
"tag": "0001_heavy_leo",
"breakpoints": true
} }
] ]
} }

View file

@ -123,7 +123,7 @@ export function formatRelativeTime(timestamp: string | Date): string {
if (hours < 24) { if (hours < 24) {
const extraMinutes = minutes % 60; const extraMinutes = minutes % 60;
return extraMinutes === 0 ? `${hours}hr` : `${hours}hr ${extraMinutes}m`; return extraMinutes === 0 ? `${hours}h` : `${hours}h ${extraMinutes}m`;
} }
if (days < 7) return `${days}d`; if (days < 7) return `${days}d`;
@ -145,11 +145,11 @@ export function formatRelativeTime(timestamp: string | Date): string {
tempDate.setMonth(tempDate.getMonth() + adjustedMonths); tempDate.setMonth(tempDate.getMonth() + adjustedMonths);
const remainingDays = Math.floor((now.getTime() - tempDate.getTime()) / (1000 * 60 * 60 * 24)); const remainingDays = Math.floor((now.getTime() - tempDate.getTime()) / (1000 * 60 * 60 * 24));
const weeks = Math.floor(remainingDays / 7); const weeks = Math.floor(remainingDays / 7);
return weeks === 0 ? `${adjustedMonths}m` : `${adjustedMonths}m ${weeks}w`; return weeks === 0 ? `${adjustedMonths}mo` : `${adjustedMonths}mo ${weeks}w`;
} }
const remainingMonths = adjustedMonths % 12; const remainingMonths = adjustedMonths % 12;
return remainingMonths === 0 ? `${years}y` : `${years}y ${remainingMonths}m`; return remainingMonths === 0 ? `${years}y` : `${years}y ${remainingMonths}mo`;
} }
export function formatTimeAgo(date: string) { export function formatTimeAgo(date: string) {