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

When seconds option is true expressions with 5 symbols shouldn't be valid #17

Open
ocraciun opened this issue Aug 11, 2021 · 3 comments

Comments

@ocraciun
Copy link

Tried this test and it fails:

it('should not accept 5 symbols if seconds option is true', () => {
  const valid = isValidCron('* * * * *', { seconds: true })
  expect(valid).toBeFalsy()
})

isValidCron('* * * * *', { seconds: true }) should return false when seconds option is true.

@GuillaumeRochat
Copy link
Owner

From memory, I assumed that seconds could be missing from the expression and we'd still have a valid expression, even with seconds: true.

I could change that behavior, but that is a quite different behavior. Would it work if we added a strictSeconds options instead that explicitly requires a second in the expression?

@XueMeijing
Copy link

the difference is that, when i set seconds: true, it shows the length error
image

@GuillaumeRochat
Copy link
Owner

@XueMeijing That is not with this cron-validator package but with cron-validate. : https://github.com/Airfooox/cron-validate

Example:
https://runkit.com/embed/bxfrpxgls3o0

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

No branches or pull requests

3 participants