fix(reminders): don't assume 30 days are always a month

This commit is contained in:
kolaente 2023-06-13 12:06:00 +02:00
parent 1a792e0667
commit 928b338cf2
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 1 additions and 3 deletions

View File

@ -226,8 +226,6 @@ function translateUnit(amount: number, unit: PeriodUnit): string {
return t('time.units.days', amount)
case 'weeks':
return t('time.units.weeks', amount)
case 'months':
return t('time.units.months', amount)
case 'years':
return t('time.units.years', amount)
}

View File

@ -17,7 +17,7 @@ export function secondsToPeriod(seconds: number): { unit: PeriodUnit, amount: nu
if (seconds % SECONDS_A_WEEK === 0) {
return {unit: 'weeks', amount: seconds / SECONDS_A_WEEK}
} else if (seconds % SECONDS_A_MONTH === 0) {
return {unit: 'months', amount: seconds / SECONDS_A_MONTH}
return {unit: 'days', amount: seconds / SECONDS_A_MONTH * 30}
} else if (seconds % SECONDS_A_YEAR === 0) {
return {unit: 'years', amount: seconds / SECONDS_A_YEAR}
} else {