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

Support "last weekday of the month" expressions #245

Merged
merged 11 commits into from
Oct 12, 2021

Conversation

albertorestifo
Copy link
Contributor

This PR implements support for the expressions like "last Monday of the month" (0 0 0 * * 1L) by adding support for \dL in the weekday part of the cron expression.

@albertorestifo
Copy link
Contributor Author

@harrisiirak Can you spare some time to review this PR? 🙏

We need this functionality fairly soon, and I would like to avoid the need to release a fork

@harrisiirak harrisiirak self-assigned this Oct 7, 2021
@harrisiirak
Copy link
Owner

@albertorestifo sure, I'll try go through the PR during this weekend. Sorry about the delay!

Copy link
Owner

@harrisiirak harrisiirak left a comment

Choose a reason for hiding this comment

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

@albertorestifo thanks for your hard work, this looks very good and promising!

My main concerns and questions are:

  • It has support of multiple multiple expressions, which could be definitely useful, but it's non-standard feature and possibly adds some unexpected behaviour; see my longer comment in PR, we can discuss it further over there.
  • It would be also nice to have serialization/stringify support (see this example for last day of month) for this feature
  • Some code style issues (nitpicking, I know, existing code in this repo could need some cleanup + better linting rules); added some comments and suggestions

lib/expression.js Outdated Show resolved Hide resolved
lib/expression.js Outdated Show resolved Hide resolved
lib/expression.js Outdated Show resolved Hide resolved
lib/expression.js Outdated Show resolved Hide resolved
lib/expression.js Outdated Show resolved Hide resolved
test/date.js Outdated Show resolved Hide resolved
test/parser_day_of_month.js Show resolved Hide resolved
lib/expression.js Show resolved Hide resolved
@albertorestifo
Copy link
Contributor Author

@harrisiirak thanks for taking the time to review the PR.

I've addressed all your comments, as well as written some documentation for the newly added feature.

@harrisiirak harrisiirak self-requested a review October 11, 2021 13:48
Copy link
Owner

@harrisiirak harrisiirak left a comment

Choose a reason for hiding this comment

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

Added comment about one additional test case that stringify functionality could have, otherwise looks good to me!

lib/expression.js Outdated Show resolved Hide resolved
test/stringify.js Show resolved Hide resolved
albertorestifo and others added 2 commits October 11, 2021 16:40
Co-authored-by: Harri Siirak <harri@siirak.ee>
Copy link
Owner

@harrisiirak harrisiirak left a comment

Choose a reason for hiding this comment

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

LGTM! I'll try to merge and release this later today or tomorrow.

@harrisiirak harrisiirak merged commit d18ad74 into harrisiirak:master Oct 12, 2021
@harrisiirak
Copy link
Owner

Closes #242

@harrisiirak
Copy link
Owner

Release: https://github.com/harrisiirak/cron-parser/releases/tag/4.1.0

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.

None yet

2 participants