Einheit für Erinnerung hinzugefügt

This commit is contained in:
2026-01-08 10:06:14 +01:00
parent 4f2541144c
commit 6edddb8249
2 changed files with 139 additions and 40 deletions

View File

@@ -237,12 +237,23 @@ function getCachedStoreStatus(storeId) {
}
function normalizeJournalReminder(reminder = {}) {
const unit = ['days', 'weeks', 'months'].includes(reminder.beforeUnit) ? reminder.beforeUnit : 'days';
const parsedBeforeValue = Number(reminder.beforeValue);
const parsedDaysBefore = Number(reminder.daysBefore);
const beforeValue = Number.isFinite(parsedBeforeValue)
? Math.max(0, parsedBeforeValue)
: Number.isFinite(parsedDaysBefore)
? Math.max(0, parsedDaysBefore)
: 42;
const daysBefore = unit === 'weeks' ? beforeValue * 7 : unit === 'months' ? beforeValue * 30 : beforeValue;
return {
enabled: !!reminder.enabled,
interval: ['monthly', 'quarterly', 'yearly'].includes(reminder.interval)
? reminder.interval
: 'yearly',
daysBefore: Number.isFinite(reminder.daysBefore) ? Math.max(0, reminder.daysBefore) : 42
beforeUnit: unit,
beforeValue,
daysBefore
};
}