Skip to content
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

Previous Occurrence #170

Closed
azuby opened this issue May 13, 2013 · 4 comments
Closed

Previous Occurrence #170

azuby opened this issue May 13, 2013 · 4 comments

Comments

@azuby
Copy link

azuby commented May 13, 2013

Is there a way to get the previous occurrence, similar to next_occurrence? If not, any suggestions on accomplishing this?

@avit
Copy link
Collaborator

avit commented May 15, 2013

Here's a possible workaround:

schedule.occurrences_between(now, t1)[-2]

It's a good idea though. I think we can wrap up a helper method for this.

@avit
Copy link
Collaborator

avit commented May 15, 2013

See related discussion on #155 and #117.

@azuby
Copy link
Author

azuby commented May 15, 2013

That seems like it would generate a large amount of models. We have daily recurrence rules for years...

On May 15, 2013, at 12:55 PM, Andrew Vit notifications@github.com wrote:

Here's a possible workaround:

schedule.occurrences_between(now, t1)[-2]

It's a good idea though. I think we can wrap up a helper method for this.


Reply to this email directly or view it on GitHub.

@avit
Copy link
Collaborator

avit commented May 15, 2013

You mean object allocations? I agree, building up an array from now until your target time is not ideal. We should make it smarter by looking at the rules & intervals to narrow the start of the range.

@avit avit closed this as completed in 1576fd3 May 21, 2013
rlivsey pushed a commit to rlivsey/ice_cube that referenced this issue Jun 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants