telco

Contract law

End of term, last day to cancel, termination dates, renewal and the bill's contract block — computed from the terms, each naming the rule that decided.

On this page

A contract's dates are law. German law fixes how long a consumer may be bound, how long the notice may be, what happens when nobody cancels, and which dates every bill must print. telco_core::contract computes all of them from the terms. The functions are pure, with the receipt date as a parameter, and every result that a law decided names its rule.

Terms

use telco_core::contract::{Terms, initial_term_end, last_day_to_cancel, renewal_notice_due, validate};
use time::macros::date;

let terms = Terms {
    consumer: true,
    start: date!(2026 - 10 - 01),
    initial_months: 24,     // § 56 Abs. 1 TKG: at most 24 for consumers
    notice_months: 1,       // § 309 Nr. 9 lit. c BGB: at most one month
    renews: true,           // tacitly into an indefinite contract
};
validate(&terms)?;
assert_eq!(initial_term_end(&terms), Some(date!(2028 - 09 - 30)));
assert_eq!(last_day_to_cancel(&terms), Some(date!(2028 - 08 - 31)));
assert_eq!(renewal_notice_due(&terms, 30), Some(date!(2028 - 08 - 01)));
# Ok::<(), telco_core::Refusal>(())

The last day to cancel is 31 August, not 30 August. A notice received on 31 August runs one month, and since September has no 31st it ends on 30 September (§ 188 Abs. 3 BGB).

Counting months (§§ 187, 188 BGB)

FunctionCountsExample
term_end(start, n)A term from the start of a day ends the day before the same-numbered day01.10.2026 + 24 → 30.09.2028
after_event(date, n)A period after an event ends on the same-numbered day10.09.2028 + 1 → 10.10.2028
eitherA missing day means the last day of the month31.01.2029 + 1 → 28.02.2029

Termination

use telco_core::contract::{Basis, Terms, termination};
use time::macros::date;

let terms = Terms { consumer: true, start: date!(2026 - 10 - 01), initial_months: 24, notice_months: 1, renews: true };

// In time: ends with the initial term.
let t = termination(&terms, date!(2028 - 08 - 15), None);
assert_eq!((t.effective, t.basis), (date!(2028 - 09 - 30), Basis::InitialTermEnd));

// Too late: the contract renews and ends one month after receipt (§ 56 Abs. 3 TKG).
let t = termination(&terms, date!(2028 - 09 - 10), None);
assert_eq!((t.effective, t.rule), (date!(2028 - 10 - 10), Some("DE-TKG-56-3-renewed")));

// A later date the customer asked for wins.
let t = termination(&terms, date!(2028 - 08 - 15), Some(date!(2028 - 12 - 31)));
assert!(t.requested_later);

The functions are checked against a table of more than 30 cases worked out by hand, covering month ends, 29 February, late notices, contracts that do not renew, indefinite contracts and business contracts. Property tests add thousands of random dates.

The bill's contract block (TK-TransparenzV § 4)

Every consumer bill must state the contract start, the current end of the minimum term, the notice period and the last day a termination must arrive. transparency(&terms, on, salutation) returns those fields and the German lines, ready for the bill. Contracts with an initial term of one month or less carry no block.

use telco_core::contract::{Salutation, Terms, transparency};
use time::macros::date;

let terms = Terms { consumer: true, start: date!(2026 - 10 - 01), initial_months: 24, notice_months: 1, renews: true };
let block = transparency(&terms, date!(2026 - 11 - 30), Salutation::Sie).unwrap();
assert_eq!(block.lines[1], "Mindestvertragslaufzeit bis: 30.09.2028");
assert!(block.lines[3].contains("spätestens am 31.08.2028"));

Add-ons (§ 66 Abs. 3 TKG)

addon_extension refuses an add-on whose own minimum term would outlast the contract, unless the customer consented expressly. With consent, it returns the contract's new initial term.

The lifecycle

ordered → active ⇄ restricted → terminating → ended, plus ordered → voided for a contract whose late summary was never approved (§ 54 Abs. 3 TKG). transition() refuses every other step with subscription.transition.

Download Markdown