tickle
tickle copied to clipboard
Ending Date In Past
If the schedule indicates an ending date then such as in the future everything works as expected:
Tickle.parse("every monday until Jan 1st, 2027")
=> {:next=>2024-12-23 12:00:00 -0500, :expression=>"monday", :starting=>2024-12-20 15:27:16.556525636 -0500, :until=>2027-01-01 12:00:00 -0500}
My sort of naive strategy is to just ask for the "next" date and keep doing that until I get nil or an error (my assumption once we move past Jan 1st, 2027). Testing that by using a year in the past shows this strategy doesn't work:
Tickle.parse("every monday until Jan 1st, 2024")
=> {:next=>2024-12-23 12:00:00 -0500, :expression=>"monday", :starting=>2024-12-20 15:34:12.15277663 -0500, :until=>2025-01-01 12:00:00 -0500}
Note how it gave a next date that is after my end date and it thinks the end date is 1/1/2025. Best I can think to do is capture the until value when I first ask for the schedule since at some point that becomes unreliable. But just wondering if I am missing something.