mirror of
https://github.com/ersinkoc/vld.git
synced 2026-04-26 22:45:52 +03:00
[PR #1] fix(date): Correct error message handling in chained date validations #1
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vld#1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/ersinkoc/vld/pull/1
State: closed
Merged: Yes
Previously, when chaining date validation methods like
min()andmax(), the error message from the last validation would overwrite any previous messages. This resulted in incorrect error messages when an earlier validation in the chain failed.This commit refactors the
VldDatevalidator to associate each validation check with its own error message. Thechecksarray inDateValidatorConfignow stores objects containing both the validation function and its corresponding message, ensuring that the correct error is thrown when a check fails.A new test case has been added to verify that chained error messages are handled correctly. Additionally, the Jest configuration has been updated to properly handle ES Modules.