next() yields a time in the past
See original GitHub issueWhen executing the next() function on a cron with weekdays we sometimes get None or a localdatetime in the past (same for prev() …):
import java.time._
import cron4s.lib.javatime._
import cron4s._
object Cron4Spec {
def main(args: Array[String]): Unit = {
val Right(cron) = Cron("0 0 0 * * 1-3")
for (dayOfMonth <- 1 to 30) {
val from = LocalDateTime.of(2017, 3, dayOfMonth, 2, 0, 0)
cron.next(from) match {
case Some(next) =>
println(s" $from: after ${next.isAfter(from)}")
case None =>
println(s"Cannot get next from: $from")
}
cron.prev(from) match {
case Some(prev) =>
println(s" $from: before ${prev.isBefore(from)}")
case None =>
println(s"Cannot get prev from: $from")
}
}
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Behaviour of Python's "yield" - Stack Overflow
The next time .next() is called, the function execution is resumed until the next yield , etc. until the function returns something.
Read more >33 - Generator Functions ( yield; next ) | Python Tutorials
Generators are iterators that calculate and return a value and then wait for you to call them again with the next() function.
Read more >Python Generators - Programiz
So we can iterate through the items using next() . Once the function yields, the function is paused and the control is transferred...
Read more >How to Use Generators and Yield in Python | CBT Nuggets
This is done by using the generator method called __next()__. (That is two underscores before and after "next()".
Read more >Asynchronous Iterators in JavaScript | Codementor
The interface of next() returns the tuple { value, done } and the values of value and done need to be known at...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Works for us now after fix (0.3.2)! Thanks for fixing.
This has been fixed in branch 0.3.x and version 0.3.2 released to Maven Central (it may take a while until is mirrorred everywhere).