VRBL-INV-SA-1p2-121

Basic Info

Rule The Invoice Line Document Reference Issue Date must be formatted YYYY-MM-DD, in accordance to the "Calendar date complete representation" as specified by ISO 8601:2004, format YYYY-MM-DD.
Context /ubl:Invoice/cac:InvoiceLine
Pattern vrbl-invoice-sa-1p2
Severity fatal

Implementation

not(cac:DocumentReference/cbc:IssueDate) or string-length(cac:DocumentReference/cbc:IssueDate) = 10 and substring(cac:DocumentReference/cbc:IssueDate, 5, 1) = '-' and substring(cac:DocumentReference/cbc:IssueDate, 8, 1) = '-' and number(substring(cac:DocumentReference/cbc:IssueDate, 1, 4)) >= 1000 and number(substring(cac:DocumentReference/cbc:IssueDate, 1, 4)) <= 9999 and number(substring(cac:DocumentReference/cbc:IssueDate, 6, 2)) >= 1 and number(substring(cac:DocumentReference/cbc:IssueDate, 6, 2)) <= 12 and number(substring(cac:DocumentReference/cbc:IssueDate, 9, 2)) >= 1 and number(substring(cac:DocumentReference/cbc:IssueDate, 9, 2)) <= 31