Skip to content

Commit

Permalink
potential fix of #65
Browse files Browse the repository at this point in the history
  • Loading branch information
InsanusMokrassar committed Sep 18, 2023
1 parent 93b56c0 commit c406f88
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## 2.2.1

* Potential fix of [#65](https://github.com/InsanusMokrassar/krontab/issues/65)

## 2.2.0

* Versions
Expand Down
8 changes: 7 additions & 1 deletion src/commonMain/kotlin/internal/NearDateTimeCalculator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,19 @@ internal fun NearDateTimeCalculatorDays(
} else {
dateTime
})
dateTime.copy(
val newDateTime = dateTime.copy(
dayOfMonth = min(dateTime.month.days(dateTime.year), newOne.toInt() + 1), // index1
hour = 0,
minute = 0,
second = 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
}
}
)

Expand Down

0 comments on commit c406f88

Please sign in to comment.