Date format YYYYMMDD

Error CII-DT-097 Syntax (UBL/CII)

Date time string with format attribute 102 shall be YYYYMMDD.

Mandatory rule: As long as it is violated, the invoice is invalid and will be rejected by validators.
What is wrong

The content of udt:DateTimeString does not match the required pattern of four digits for the year, two for the month, and two for the day. The check allows months from 01 to 12 and days from 01 to 31.

What the rule means

Format 102 represents a date in year, month, day order without separators. A consistent format allows the date to be processed as structured data.

Please enter the date as YYYYMMDD

The date in udt:DateTimeString does not match the expected format for format="102". You can update it by putting the year, month, and day in the required order.

What to do
  1. Write the four-digit year first, followed by the two-digit month and then the two-digit day.
  2. Do not include separators between the digits.
  3. Generate the invoice again and validate it once more.
What it looks like
✗ Triggers the message
<udt:DateTimeString format="102">2024-01-02</udt:DateTimeString>
✓ Correct
<udt:DateTimeString format="102">20240102</udt:DateTimeString>
Technical details

The XPath applies a regular expression to the text content of udt:DateTimeString with format="102". It checks the digit pattern and the month and day ranges, not the calendar validity of the date.

Where the rule applies

The rule applies to udt:DateTimeString when its format attribute has the value 102.

Context (rule/@context)
//udt:DateTimeString[@format = '102']
Test expression (assert/@test)
matches(.,'^\s*(\d{4})(1[0-2]|0[1-9]){1}(3[01]|[12][0-9]|0[1-9]){1}\s*$')