BR-KSA-F-01: Dates must use the YYYY-MM-DD format

Explained by Matheel from ZATCA's rule text and the condition SDK 3.4.8 executes · Updated

Error: the invoice is rejectedAll invoicesFields: —

Checks cbc:IssueDate, cbc:DueDate, cbc:TaxPointDate, cac:Delivery/cbc:ActualDeliveryDate and cbc:LatestDeliveryDate, the billing-reference cac:InvoiceDocumentReference/cbc:IssueDate and line cac:DocumentReference/cbc:IssueDate: each must be exactly 10 characters and a valid calendar date. The executed check uses a pattern that also requires the year to be between 2000 and 9999 (no time zone suffix); the published test only requires a value castable as xs:date.

How to fix it

Write each date as exactly YYYY-MM-DD with no time or time zone, e.g. <cbc:IssueDate>2024-03-15</cbc:IssueDate>.

ZATCA's official text

[BR-KSA-F-01]-A 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.
Source: ZATCA SDK 3.4.8 · ZATCA KSA rules

Fails when (the condition ZATCA's SDK runs)

not(string-length(.) = 10 and matches( string(.), '[2-9][0-9]([0-9]{2}[\-]((0[13578]|1[02])[\-](0[1-9]|[12][0-9]|3[01])|(0[469]|11)[\-](0[1-9]|[12][0-9]|30)|(02)[\-](0[1-9]|1[0-9]|2[0-8]))|([02468][048]|[13579][26])[\-](02)[\-]29)') )

Related rules

Validate your invoice against ZATCA's rules

Paste the XML and see every error and warning. It runs in your browser; the invoice goes nowhere.

Validate an invoice or try Matheel