Closed mattheys closed 6 months ago
@mattheys you Linux example is based on the fact that the two crontabs are mutually exclusive. If there was overlap crontab would happily run your script twice. I would guess this library (Cronos) is meant to parse cron expressions only. Your use-case goes beyond that, and as you mention is easily implemented in your own code without having to add this to Cronos.
I think this can be implemented manually by creating multiple instances of the CronExpression
class, and checking what date returned by GetNextOccurrence
goes first.
My users have just asked if they can change the current schedule of every 30 mins between 10am and 5pm to also include 5pm.
I can't see a way of doing this without also including 5:30pm therefore i would like to have an array of two expressions built into one so that GetNextOccurrence will get the next one from either expression.
I've reworked my app to handle this in my IHostedService manually but there might be others who will need something like this in the future too, it's easy enough to do in a Linux crontab because you just run the same script twice.