mirror of
https://github.com/InsanusMokrassar/krontab.git
synced 2025-12-03 03:26:02 +00:00
tests and fixes in week work
This commit is contained in:
@@ -54,7 +54,7 @@ internal fun CronDateTime.toNearDateTime(relativelyTo: DateTime = DateTime.now()
|
||||
current = (current + diff.days).startOfDay
|
||||
|
||||
val next = toNearDateTime(current)
|
||||
if (next ?.dayOfWeek ?.index0 == weekDay) {
|
||||
if (next == null || next.dayOfWeek.index0 == weekDay) {
|
||||
return next
|
||||
}
|
||||
} while (true)
|
||||
|
||||
@@ -27,8 +27,8 @@ internal data class CronDateTimeScheduler internal constructor(
|
||||
*
|
||||
* @see toNearDateTime
|
||||
*/
|
||||
override suspend fun next(relatively: DateTime): DateTime {
|
||||
return cronDateTimes.mapNotNull { it.toNearDateTime(relatively) }.minOrNull() ?: getAnyNext(relatively)
|
||||
override suspend fun next(relatively: DateTime): DateTime? {
|
||||
return cronDateTimes.mapNotNull { it.toNearDateTime(relatively) }.minOrNull()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user