Skip to content

The :now option doesn't seem to work very well #4

@gampleman

Description

@gampleman

I have an app that supports cancelling the next occurrence of an event, but for this we need to calculate the next occurrence of the event for an event in the future, i.e.:

Time.now 
# => 2015-10-05 18:13:15 +0100
Tickle.parse('monday', now: Time.now)
# => {:next=>2015-10-12 12:00:00 +0100, :expression=>"monday", :starting=>2015-10-05 18:13:18 +0100, :until=>nil}
Tickle.parse('monday', now: Time.now + 1.day)
# => {:next=>2015-10-12 12:00:00 +0100, :expression=>"monday", :starting=>2015-10-05 18:13:26 +0100, :until=>nil}
Tickle.parse('monday', now: Time.parse('2015-10-12 12:00:00 +0100'))
# => {:next=>2015-10-12 12:00:00 +0100, :expression=>"monday", :starting=>2015-10-05 18:13:53 +0100, :until=>nil}
Tickle.parse('monday', now: Time.parse('2015-10-13 12:00:00 +0100'))
# => {:next=>2015-10-12 12:00:00 +0100, :expression=>"monday", :starting=>2015-10-05 18:14:37 +0100, :until=>nil}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions