Rechtliches: jederzeit kuendbare Vertraege brauchen kein Beginn-Datum
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
82c2460835
commit
fa23732217
2 files changed
+8
-1
No files matched your search
+4
-1
@@ -50,11 +50,14 @@ export function nextCancellationDate(contract, today) {
|
||||
if (isSet(contract.cancelledAt)) {
|
||||
return { state: 'cancelled', periodEnd: contract.endsAt || null, noticeBy: null }
|
||||
}
|
||||
// Jederzeit kuendbar braucht keinen Beginn (z. B. Stripe, Cloud-Server)
|
||||
if (isSet(contract.termMonths) && Number(contract.termMonths) === 0) {
|
||||
return { state: 'anytime', periodEnd: null, noticeBy: null }
|
||||
}
|
||||
if (!isSet(contract.startDate) || !isSet(contract.termMonths)) {
|
||||
return { state: 'incomplete', periodEnd: null, noticeBy: null }
|
||||
}
|
||||
const term = Number(contract.termMonths)
|
||||
if (term === 0) return { state: 'anytime', periodEnd: null, noticeBy: null }
|
||||
|
||||
const renewal = Number(contract.renewalMonths) || 0
|
||||
let periodEnd = addMonthsClamped(contract.startDate, term)
|
||||
|
||||
@@ -145,3 +145,7 @@ test('Verlaengerungen ab dem 31. driften nicht auf den 28.', () => {
|
||||
assert.equal(r.periodEnd, '2025-04-30')
|
||||
assert.equal(r.noticeBy, '2025-04-29')
|
||||
})
|
||||
|
||||
test('jederzeit kuendbar braucht kein Beginn-Datum', () => {
|
||||
assert.equal(nextCancellationDate({ termMonths: 0 }, '2026-09-30').state, 'anytime')
|
||||
})
|
||||
Reference in new issue
Block a user