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

added isTime validator #1479

Merged
merged 16 commits into from
Jan 22, 2023
Merged

added isTime validator #1479

merged 16 commits into from
Jan 22, 2023

Conversation

francoatmega
Copy link
Contributor

@francoatmega francoatmega commented Oct 11, 2020

Added validator for time formats.

Checklist

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

@rubiin
Copy link
Member

rubiin commented Oct 11, 2020

@francoatmega please fix the tests

@francoatmega
Copy link
Contributor Author

After several tries, I have no idea why the tests no pass...
It's not a joke, but locally they pass...

image

@profnandaa profnandaa added the 🧹 needs-update For PRs that need to be updated before landing label Nov 29, 2020
@ezkemboi
Copy link
Member

ezkemboi commented Dec 9, 2020

This probably will solve issue #1403

@profnandaa
Copy link
Member

Thanks for your PR! 🎉 Please fix the merge conflicts.

@profnandaa
Copy link
Member

@francoatmega -- ping

@rubiin
Copy link
Member

rubiin commented Feb 8, 2021

Fix the merge conflicts if there are any and make sure to pass all tests

@codecov
Copy link

codecov bot commented Feb 11, 2021

Codecov Report

Merging #1479 (16d9f3d) into master (1bb14e8) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master     #1479   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          104       105    +1     
  Lines         2203      2211    +8     
  Branches       477       478    +1     
=========================================
+ Hits          2203      2211    +8     
Impacted Files Coverage Δ
src/index.js 100.00% <100.00%> (ø)
src/lib/isTime.js 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@francoatmega
Copy link
Contributor Author

Some one can check this? All tests passed except for one nos seems to be problems um dependencies. @profnandaa @rubiin

rubiin
rubiin previously approved these changes Feb 12, 2021
Copy link
Member

@rubiin rubiin left a comment

Choose a reason for hiding this comment

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

looks good

@rubiin rubiin added ✅ LGTM and removed 🧹 needs-update For PRs that need to be updated before landing labels Aug 5, 2022
@francoatmega francoatmega requested review from fedeci and rubiin and removed request for fedeci August 11, 2022 02:07
@francoatmega
Copy link
Contributor Author

@tux-tn @fedeci -- ping

@rubiin rubiin requested review from rubiin and removed request for fedeci August 19, 2022 03:49
@@ -153,6 +153,7 @@ Validator | Description
**isUppercase(str)** | check if the string is uppercase.
**isSlug** | Check if the string is of type slug. `Options` allow a single hyphen between string. e.g. [`cn-cn`, `cn-c-c`]
**isStrongPassword(str [, options])** | Check if a password is strong or not. Allows for custom requirements or scoring rules. If `returnScore` is true, then the function returns an integer score for the password rather than a boolean.<br/>Default options: <br/>`{ minLength: 8, minLowercase: 1, minUppercase: 1, minNumbers: 1, minSymbols: 1, returnScore: false, pointsPerUnique: 1, pointsPerRepeat: 0.5, pointsForContainingLower: 10, pointsForContainingUpper: 10, pointsForContainingNumber: 10, pointsForContainingSymbol: 10 }`
**isTime(str [, options])** | Check if the input is a valid time. e.g. [`23:01:59`, new Date().toLocaleTimeString()].<br/><br/> `options` is an object which can contain the keys `hourFormat` or `mode`.<br/><br/>`hourFormat` is a key and defaults to `'hour24'`.<br/><br/>`mode` is a key and defaults to `'default'`. <br/><br/>`hourFomat` can contain the values `'hour12'` or `'hour24'`, `'hour24'` will validate hours in 24 format and `'hour12'` will validate hours in 12 format. <br/><br/>`mode` can contain the values `'default'` or `'withSeconds'`, `'default'` will validate `HH:MM` format, `'withSeconds'` will validate the `HH:MM:SS` format.
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: can back-tick this too: new Date().toLocaleTimeString()

Copy link
Member

Choose a reason for hiding this comment

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

Wondering if we could find a better way of simplifying the options 🤔

@profnandaa profnandaa merged commit 8e004e0 into validatorjs:master Jan 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants