Skip to content

fix(isISO8601): reject tab and newline as date-time separator - #2972

Open
Ganesh1729-ui wants to merge 1 commit into
validatorjs:masterfrom
Ganesh1729-ui:fix/iso8601-whitespace-separator
Open

Ganesh1729-ui wants to merge 1 commit into
validatorjs:masterfrom
Ganesh1729-ui:fix/iso8601-whitespace-separator

Conversation

@Ganesh1729-ui

Copy link
Copy Markdown

The ISO 8601 regex used [T\s] to match the separator between date and time. This lets \t and \n through as valid separators, but ISO 8601 only allows T (or a space for SQL/extended usage).

I changed [T\s] to [T ] so only a literal space or T is accepted. The strictSeparator regex already uses just [T], so this brings the default regex closer to spec.

Added two invalid cases to the test array to cover the tab and newline cases.

@codecov

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (9ff3424) to head (a9998f4).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2972   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          114       114           
  Lines         2599      2599           
  Branches       658       658           
=========================================
  Hits          2599      2599           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants