feat: Edit relative reminders #3248
|
@ -14,7 +14,7 @@
|
|||
v-model="periodInput.duration.days"
|
||||
type="number"
|
||||
min="0"
|
||||
/> {{ $t('task.reminder.daysShort') }}
|
||||
/> {{ $t('task.reminder.days') }}
|
||||
ce72 marked this conversation as resolved
Outdated
|
||||
<input
|
||||
:disabled="disabled"
|
||||
class="input"
|
||||
|
@ -166,7 +166,7 @@ function formatDuration(reminderPeriod: number): string {
|
|||
return '00:00'
|
||||
}
|
||||
const duration = secondsToPeriod(Math.abs(reminderPeriod))
|
||||
return (duration.days > 0 ? duration.days + ' d ' : '') +
|
||||
return (duration.days > 0 ? `${duration.days} ${t('task.reminder.days')} `: '') +
|
||||
('' + duration.hours).padStart(2, '0') + ':' +
|
||||
('' + duration.minutes).padStart(2, '0')
|
||||
}
|
||||
|
|
|
@ -3,12 +3,13 @@ import {SECONDS_A_DAY, SECONDS_A_HOUR, SECONDS_A_MINUTE} from '@/constants/date'
|
|||
/**
|
||||
* Convert time period given as seconds to days, hour, minutes, seconds
|
||||
*/
|
||||
export function secondsToPeriod(seconds: number): {days: number, hours: number, minutes: number, seconds: number} {
|
||||
const d = Math.floor(seconds / SECONDS_A_DAY)
|
||||
const h = Math.floor(seconds % SECONDS_A_DAY / 3600)
|
||||
const m = Math.floor(seconds % SECONDS_A_HOUR / 60)
|
||||
const s = Math.floor(seconds % 60)
|
||||
return {days: d, hours: h, minutes: m, seconds: s}
|
||||
export function secondsToPeriod(seconds: number): {days: number, hours: number, minutes: number, seconds: number} {
|
||||
dpschen marked this conversation as resolved
Outdated
konrad
commented
Can you add a type hint for the return value? Can you add a type hint for the return value?
ce72
commented
ok ok
dpschen
commented
Couldn't we instead define the return via Couldn't we instead define the return via `as const`?
Also we don' really need the declaration of the variables but could inline those definitions in the returned object directly
ce72
commented
OK concerning the inlining. Can you please make a suggestion on how to replace the function using OK concerning the inlining. Can you please make a suggestion on how to replace the function using `as const`? My typescript might be not sufficient here.
|
||||
return {
|
||||
days: Math.floor(seconds / SECONDS_A_DAY),
|
||||
hours: Math.floor(seconds % SECONDS_A_DAY / 3600),
|
||||
minutes: Math.floor(seconds % SECONDS_A_HOUR / 60),
|
||||
seconds: Math.floor(seconds % 60),
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -723,7 +723,8 @@
|
|||
"reminder": {
|
||||
"hoursShort": "HH",
|
||||
"minutesShort": "MM",
|
||||
"daysShort": "d"
|
||||
"daysShort": "d",
|
||||
"days": "days"
|
||||
},
|
||||
"repeat": {
|
||||
"everyDay": "Every Day",
|
||||
|
|
Reference in New Issue
Please add a translation string for the
d
. (It does not look like much, but still)Same for the placeholders.
ok
To be honest I was confused by the
d
when I first saw the interface.Why don't we write it out?
ok