VRBL-INV-SA-1p2-65

Basic Info

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

Implementation

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