support year in relative date format

This commit is contained in:
ashastral 2024-09-18 18:06:27 -07:00
parent aab735bd39
commit ec6b10c1f2

View file

@ -8,8 +8,15 @@ function formatRelativeTime(date: Date) {
const secondsPerMinute = 60; const secondsPerMinute = 60;
const minutesPerHour = 60; const minutesPerHour = 60;
const hoursPerDay = 24; 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 = { const intervals = {
year:
millisecondsPerSecond *
secondsPerMinute *
minutesPerHour *
hoursPerDay *
daysPerYear,
month: month:
millisecondsPerSecond * millisecondsPerSecond *
secondsPerMinute * secondsPerMinute *