Fix date format validation: accept YYYY-MM-DD, auto-convert to DD-MM-YYYY for AEAT XSD#49
Draft
Fix date format validation: accept YYYY-MM-DD, auto-convert to DD-MM-YYYY for AEAT XSD#49
Conversation
…ializer Co-authored-by: Eseperio <5459366+Eseperio@users.noreply.github.com>
…e docs Co-authored-by: Eseperio <5459366+Eseperio@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix operation date validation error for invoices
Fix date format validation: accept YYYY-MM-DD, auto-convert to DD-MM-YYYY for AEAT XSD
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Validators were checking for
DD-MM-YYYYvia regex but error messages advertisedYYYY-MM-DD, causing a paradoxical failure when users supplied the documented format. The AEAT XSD schema requiresDD-MM-YYYY, but PHP's nativedate('Y-m-d')returnsYYYY-MM-DD.Changes
InvoiceId,InvoiceSubmission): Changed all date regexes fromDD-MM-YYYYtoYYYY-MM-DD(ISO 8601). Error messages now match what's actually accepted.InvoiceSerializer): AddedformatDate()helper that convertsYYYY-MM-DD→DD-MM-YYYYbefore writing to XML, preserving XSD compliance transparently. Applied to all date fields:FechaExpedicionFactura,FechaOperacion, rectified/substituted invoice dates, chaining previous invoice dates, cancellation dates, and query dates.DD-MM-YYYYdate strings anddate('d-m-Y')calls toYYYY-MM-DD/date('Y-m-d'). Serializer test XML output assertions remainDD-MM-YYYY(correct expected output).Example
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/Bacon/BaconQrCode/zipball/36a1cb2b81493fa5b82e50bf8068bf84d1542563/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/jjY3od /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/DASPRiD/Enum/zipball/b5874fa9ed0043116c72162ec7f4fb50e02e7cce/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/jjY3od /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/nikic/PHP-Parser/zipball/50f0d9c9d0e3cff1163c959c50aaaaa4a7115f08/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/phpstan/phpstan/zipball/3222c523fdb250b9f9a1f6d36f10e653c2d1b2e8/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/jjY3od /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/079406160fa9290d5a7f585602e0fe5b5f003756/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/9f7c12369107fdb7a91016bf88f27d39872a88ea/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/sebastianbergmann/code-unit/zipball/807b5e65ab7b7b16e1928d924c7973aa451fa295/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/sebastianbergmann/comparator/zipball/8d8209833d5f3f3eb8da4401a975302c58da4e64/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/sebastianbergmann/complexity/zipball/72cbad467aed5fc740e4e4c00218f4f4a6ad4297/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/sebastianbergmann/diff/zipball/74776e712e4b0c27d7e421b88af13875adb5999b/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/f3a9f1083457e342c2f9a0b577c511d9c20be488/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/ded04261fddbfb6755b7176685fd7975b874a128/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/jjY3od /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/e16b906e486daae949005a62576318be23e31670/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/jjY3od /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/11775ba4125a1e8ab6ab9c21e0607d9a484744dd/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/97ecb4b0a29cf3befdf5bef6d7c5872a5f7129b4/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/d1ddfa07b25ece41c8e5ee3f3bdd4fd969b0b395/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/33ec41b1b3bc7b06f3e5443183d5be875a6a613c/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/sebastianbergmann/php-timer/zipball/fb4639c8b216b81813c588d0adf1fe88ec66239e/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2b64fcfd962e68d303f86608aca2cf882adbca74/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/jjY3od /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/sebastianbergmann/type/zipball/68153740a6f11fc82a96e260ef47041967ee1c58/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/jjY3od /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/sebastianbergmann/version/zipball/c8104a729707d949f2132fad0a41c42b7cac080f/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/jjY3od /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)https://api.github.com/repos/theseer/tokenizer/zipball/b7489ce515e168639d17feec34b8847c326b0b3c/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/k9nSc4 /usr/bin/composer install --no-scripts(http block)www.w3.org/usr/bin/php php /usr/local/bin/phpunit --testsuite=Unit git ls-f�� --exclude-standa/home/REDACTED/.cache/composer/vcs/https---github.com-sebastianbergmann-code-unit-bash --others mann/object-reflector.git /https---github.git(dns block)/usr/bin/php php /usr/local/bin/phpunit --testsuite=Unit git bran�� -a --no-color mann/code-unit.git /https---github.sh(dns block)/usr/bin/php php /usr/local/bin/phpunit --testsuite=Unit owner --uid-owner 0 -j ACCEPT(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.