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

asString() output for cron containing weekdays #536

Open
jmuis opened this issue Aug 17, 2022 · 4 comments
Open

asString() output for cron containing weekdays #536

jmuis opened this issue Aug 17, 2022 · 4 comments

Comments

@jmuis
Copy link

jmuis commented Aug 17, 2022

Hi,

First of all thanks very much for this library. Only recently discovered it but it is extremely useful for us while moving away from a certain scheduler and replacing it with another one.

Our expressions typically contain written weekdays such as MON, TUE, etc. Parsing that up works great, but I can not find a way to get the output as such when building a CRON and getting the expression. (Cron#asString) It always seems to output integer values for the weekdays, which unfortunately, we can't deal with in our legacy solution.

Any idea / hints on how to get named weekdays instead of integers?

Thanks very much!

@jmrozanec
Copy link
Owner

jmrozanec commented Aug 17, 2022

@jmuis, perhaps we can add a visitor or some post-processing step to achieve this? What would be an acceptable timeline for you so we deliver a solution? Thank you for the positive feedback! We are glad cron-utils is useful to you! 😄 🚀

@jmuis
Copy link
Author

jmuis commented Aug 17, 2022

@jmrozanec thanks for your quick and positive response. There is no immediate pressure as we can deal with it for the foreseeable future, but would love to drop the legacy stuff altogether rather sooner than later :)

Had a quick look at the visitor pattern already, but I did not get the results as expected for some reason and wasn't entirely sure either that building up the expression myself was the right way forward as we would be building a one off solution once more instead of using 'standard' functionality.

More than happy to help out though where possible, although I'm not entirely familiar yet with your lib. Having that said, I won't be available for the next 4 weeks due to traveling.

What I believe could be a solution is to be able to provide a formatting hint on the CronFields. I've seen that you already have a string to int mapping function and perhaps the other way around would already solve it. That could make it fully backwards compatible and easy to use while still keeping the asString calling conventions.

@jmrozanec
Copy link
Owner

@jmuis, great! We will look into the code and provide a solution. Have a good travel! 😄 And check for a new cron-utils release on your return! 🚀

@jmuis
Copy link
Author

jmuis commented Aug 17, 2022

@jmrozanec will do! Thanks very much again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants