AttestwireRule referenceBR-30

BR-30 An invoice line period must not end before it starts

noun · EN 16931 · fatal · BT-134 / BT-135

For a sample invoice, the library reports: Line 1 has an invoice line period running from "2026-07-31" (BT-134) to "2026-07-01" (BT-135), which ends before it starts. The end must be later than or equal to the start; a single-day period with both dates equal is fine.

Business term
BT-134 / BT-135
Severity
fatal

The fix

Swap line.period.startDate and line.period.endDate, or correct whichever is wrong. Check the loop that generates the slice if several lines are affected.

A passing value

the shape this field expects
"period": { "startDate": "2026-07-01", "endDate": "2026-07-15" }

What the library returns

The full error returned by @attestwire/en16931. It includes the rule ID, affected field and suggested correction. Developers can use this object in their application:

TeachingError
{
  "rule": "BR-30",
  "field": [
    "BT-134",
    "BT-135"
  ],
  "severity": "fatal",
  "message": "Line 1 has an invoice line period running from \"2026-07-31\" (BT-134) to \"2026-07-01\" (BT-135), which ends before it starts. The end must be later than or equal to the start; a single-day period with both dates equal is fine. Line periods are the field most often built by slicing a billing run programmatically, which is exactly the code path where an off-by-one on the boundary produces an inverted period rather than an obviously wrong one.",
  "fix": "Swap line.period.startDate and line.period.endDate, or correct whichever is wrong. Check the loop that generates the slice if several lines are affected.",
  "example": "\"period\": { \"startDate\": \"2026-07-01\", \"endDate\": \"2026-07-15\" }",
  "xpath": "/ubl:Invoice/cac:InvoiceLine[1]/cac:InvoicePeriod/cbc:EndDate",
  "docsUrl": "https://attestwire.com/rules/BR-30"
}

xpath is always a UBL path. On a CII invoice, look for the matching CII field instead.