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

[fix] later.schedule().isValid returns true even when the passed schedule is not. #24

Open
2 tasks done
mat813 opened this issue Apr 22, 2022 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@mat813
Copy link

mat813 commented Apr 22, 2022

Describe the bug

  • Later version: 4.1.0
  • Node.js version: v16.13.2
  • OS & version: Arch Linux updated yesterday

When later.parse.text has errors, passing its result to later.schedule gives valid schedule

Actual behavior

If I give an invalid text string to later.parse.text, say, at 20h, the result has errors but when passed to later.schedule, it generates something that is correct, but never runs. It breaks Bree, which runs (in src/job-utils.js):

    const schedule = later.schedule(later.parse.text(value));
    if (schedule.isValid()) return later.parse.text(value);

Expected behavior

I expect isValid to return false when the schedule is not valid.

Code to reproduce

> later.parse.text('at 20h').error
3
> later.schedule(later.parse.text('at 20h')).isValid()
true

Checklist

  • I have read the documentation.
  • I have tried my code with the latest version of Node.js and @breejs/later.
@mat813 mat813 added the bug Something isn't working label Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant