fix(reminders): don't assume 30 days are always a month
This commit is contained in:
parent
1a792e0667
commit
928b338cf2
@ -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)
|
||||
}
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user