Date format 102 must follow the YYYYMMDD pattern

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 with format 102 does not match the expected pattern: four year digits, a month from 01 to 12, and a day from 01 to 31. The test also allows whitespace before and after the date.

What the rule means

Format 102 represents a date in year, month, day order. The fixed pattern enables consistent transmission of the date value.

Please write the date in YYYYMMDD format

A date in udt:DateTimeString with format 102 does not match the expected pattern. Use four year digits followed by the month and day to match the format.

What to do
  1. Locate the affected udt:DateTimeString element with format 102.
  2. Enter the value with four year digits, a two-digit month, and a two-digit day.
  3. Generate the invoice again and validate it.
What it looks like
✗ Triggers the message
<udt:DateTimeString format="102">2024-10-03</udt:DateTimeString>
✓ Correct
<udt:DateTimeString format="102">20241003</udt:DateTimeString>
Technical details

The regular expression checks for eight digits in YYYYMMDD order and limits the month and day to 01–12 and 01–31. The test does not include a full validation of calendar-date validity.

Where the rule applies

The rule applies to each udt:DateTimeString element whose format attribute is 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*$')