Date and time value in format 205

Error BR-FXEXT-CII-DT-097a Factur-X

Date time string with format attribute 205 shall be YYYYMMDDHHMMSS.

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 tested pattern for year, month, day, hour and minute. The message text, however, specifies the YYYYMMDDHHMMSS format; the test actually checks a 12-digit pattern without seconds.

What the rule means

According to the message, format identifier 205 denotes a date and time value. The discrepancy between the specified format with seconds and the tested pattern is significant because the check rejects values that include seconds.

Please check the date and time value in format 205

The value in udt:DateTimeString does not match the numeric pattern expected by this check. Note that the check’s pattern differs from the format with seconds stated in the message text.

What to do
  1. Check the content of udt:DateTimeString with format="205".
  2. Compare the value with the tested pattern, which expects 12 digits for the year, month, day, hour and minute.
  3. Take into account that the message text also requires seconds, unlike the current test.
  4. Generate the invoice again and validate it once more.
What it looks like
✗ Triggers the message
<udt:DateTimeString format="205">20240131123045</udt:DateTimeString>
✓ Correct
<udt:DateTimeString format="205">202401311230</udt:DateTimeString>
Technical details

The test uses matches() with a regular expression that permits surrounding whitespace and checks month, day, hour and minute using digit ranges. The expression has no seconds group and does not validate the calendar day for the given month.

Where the rule applies

The rule applies to udt:DateTimeString elements with the attribute format="205".

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