-
Notifications
You must be signed in to change notification settings - Fork 120
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
Autodetect parse with seconds #8
Comments
The If your values only include seconds as a six-part expressions, then you can use the |
Thanks, i will use counting method - i wasn't sure that simple field counting will be enough. Also it could be new feature to Cronos to also autodetect the same way, because Cronos do not use any other six-part syntax than seconds as documented (or support but it is not documented?). |
Maybe years will be added, may be not (I don't see any useful use case for them, but let's wait and see), but in general case (with years), reliable automatic parsing can't be performed. The only we can do to avoid any ambiguities is to add a static method that counts how much fields there is in a given cron expression to retain the parsing logic encapsulated, and not to shoot one's foot later. |
Thanks and Happy Easter :-). |
Not a problem, I'm just trying to avoid ambiguities as much as possible, because completely tired of them😳. |
I think this is the best place to leave this comment, but one thing that really got me confused recently was the following issue:
Question: Why does the Parse method expect no seconds by default (I know CronFormat.IncludeSeconds exists), but the ToString() returns seconds format by default? I would expect this to be a repeatable pattern. |
Wow reading this issue last but this also relates to #15 |
@odinserj I wondered why cron does not include years for detecting special holidays or special open/closed periods that only exist in that specific year. This relates to cron expression used in Asterisk dialplans where you want to be closed in 2022 on the 10 of October. But the ambiguity with seconds is also something |
Hi,
I'm using Cronos inside application which read user configurations which could have standard minutes form or extended with seconds. Problem is, i do not know if user enter one or another and
Parse()
method without second parameter throwsCronos.CronFormatException: Unexpected character '*'.
.How should i detect if it is standard form or extended when Cronos can't detect it by itself?
The text was updated successfully, but these errors were encountered: