Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add validation Hyphen before year is not allowed #2381

Merged
merged 3 commits into from
Apr 27, 2024

Conversation

Sumit-tech-joshi
Copy link
Contributor

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)
  • References provided in PR (where applicable)

Copy link

codecov bot commented Mar 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (4197b86) to head (eadfad4).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2381   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          107       107           
  Lines         2449      2451    +2     
  Branches       619       620    +1     
=========================================
+ Hits          2449      2451    +2     

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

Copy link
Member

@WikiRik WikiRik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add additional tests

@Sumit-tech-joshi
Copy link
Contributor Author

Hi @WikiRik Can you explain what test case should i add as adding test case for this scenario as below will fail the test case.

'-2020-03-15'

@michiwo1
Copy link

I think it is good except for the tests.

@Sumit-tech-joshi
Copy link
Contributor Author

Added test cases as requested

Copy link
Member

@WikiRik WikiRik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add something like new Date('-2014-03-15') as well? Or does that give an error with the Date library already?

@Sumit-tech-joshi
Copy link
Contributor Author

@WikiRik , When I added the new Date('-2014-03-15') to the test cases, it seems to be failing. Upon investigation, I found that the new Date('-2014-03-15') function returns a valid "full date string" (Sat Mar 15 2014 00:00:00 GMT-0700 (Pacific Daylight Saving Time)). Thank you for your attention to this matter.

Please see the screenshots:
Screenshot 2024-03-29 at 11 13 18 AM
Screenshot 2024-03-29 at 11 13 31 AM

@profnandaa profnandaa merged commit 0836777 into validatorjs:master Apr 27, 2024
9 checks passed
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.

4 participants