potential fix of #65

This commit is contained in:
InsanusMokrassar 2023-09-18 14:15:20 +06:00
parent 93b56c0861
commit c406f883d2
2 changed files with 9 additions and 1 deletions

View File

@ -2,6 +2,8 @@
## 2.2.1 ## 2.2.1
* Potential fix of [#65](https://github.com/InsanusMokrassar/krontab/issues/65)
## 2.2.0 ## 2.2.0
* Versions * Versions

View File

@ -108,13 +108,19 @@ internal fun NearDateTimeCalculatorDays(
} else { } else {
dateTime dateTime
}) })
dateTime.copy( val newDateTime = dateTime.copy(
dayOfMonth = min(dateTime.month.days(dateTime.year), newOne.toInt() + 1), // index1 dayOfMonth = min(dateTime.month.days(dateTime.year), newOne.toInt() + 1), // index1
hour = 0, hour = 0,
minute = 0, minute = 0,
second = 0, second = 0,
milliseconds = 0 milliseconds = 0
) )
// If day of month has not been changed, use old dateTime due to no changes required
if (newDateTime.dayOfMonth == dateTime.dayOfMonth) {
dateTime
} else {
newDateTime
}
} }
) )