From ec6b10c1f2c8d24d4a2a1721e70a1e3e7a1391c3 Mon Sep 17 00:00:00 2001 From: ashastral Date: Wed, 18 Sep 2024 18:06:27 -0700 Subject: [PATCH] support year in relative date format --- src/cohost-wc.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cohost-wc.ts b/src/cohost-wc.ts index 6e4c414..cfe0025 100644 --- a/src/cohost-wc.ts +++ b/src/cohost-wc.ts @@ -8,8 +8,15 @@ function formatRelativeTime(date: Date) { const secondsPerMinute = 60; const minutesPerHour = 60; const hoursPerDay = 24; - const daysPerMonth = 30; // JS date handling moment + const daysPerMonth = 365.2425 / 12; // not how it works! + const daysPerYear = 365.2425; // still not how it works!! const intervals = { + year: + millisecondsPerSecond * + secondsPerMinute * + minutesPerHour * + hoursPerDay * + daysPerYear, month: millisecondsPerSecond * secondsPerMinute *