VRBL-INV-SA-1p2-59

Basic Info

Rule The Invoice 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:BillingReference
Pattern vrbl-invoice-sa-1p2
Severity fatal

Implementation

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