Skip to content

Cron.prev method to get the last time that a cron ran #5666

@tmcw

Description

@tmcw

What is the problem this feature would solve?

This would allow a Cron instance to produce the last time that it would have triggered. This is useful if you're showing a UI that shows a progress bar of 'time till next run' and you want that to represent the time between cron invocations.

What is the feature you are proposing to solve the problem?

A method called Cron.prev, or internally, possibly a method that can calculate 'next' in both a forward and reverse time direction. This would also make computing a sequence of previous cron values possible.

What alternatives have you considered?

This is admittedly a niche issue, but there is precedent for this method in libraries like cron-parser.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions