PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: kevincianfarini/cardiologist (kotlin)

Issue:
`2023-10-04T00:00:59.000000001` next match at seconds 1 is incorrect
The following test fails: 

```kt
    @Test
    fun foo() = assertEquals(
        expected = stubDatetime.copy(minute = 1, second = 1),
        actual = stubDatetime.copy(second = 59, nanosecond = 1).nextMatch { atSeconds(1) },
    )
```

References #28

Pull request:
Closes #125

Patch:
diff --git a/src/commonMain/kotlin/io/github/kevincianfarini/cardiologist/impl/LocalDateTime.kt b/src/commonMain/kotlin/io/github/kevincianfarini/cardiologist/impl/LocalDateTime.kt
index fe66816..83e74ce 100644
--- a/src/commonMain/kotlin/io/github/kevincianfarini/cardiologist/impl/LocalDateTime.kt
+++ b/src/commonMain/kotlin/io/github/kevincianfarini/cardiologist/impl/LocalDateTime.kt
@@ -155,7 +155,7 @@ private fun LocalDateTime.nextSecond(
     val incrementedSecond = if (nanosecond > 0) (second + 1) % 60 else second
     return when {
         incrementedSecond < second -> nextMinute(atMinutes, atHours, onDaysOfMonth, inMonths, increment = true).copy(
-            second = incrementedSecond
+            second = minSecond
         )
         incrementedSecond in atSeconds -> copy(second = incrementedSecond)
         incrementedSecond < minSecond -> copy(second = minSecond)


Test patch:
diff --git a/src/commonTest/kotlin/io/github/kevincianfarini/cardiologist/impl/LocalDateTimeTest.kt b/src/commonTest/kotlin/io/github/kevincianfarini/cardiologist/impl/LocalDateTimeTest.kt
index c26ccb7..19ecd68 100644
--- a/src/commonTest/kotlin/io/github/kevincianfarini/cardiologist/impl/LocalDateTimeTest.kt
+++ b/src/commonTest/kotlin/io/github/kevincianfarini/cardiologist/impl/LocalDateTimeTest.kt
@@ -389,6 +389,14 @@ class LocalDateTimeTest {
             atSeconds(10, 0, 5)
         },
     )
+
+    @Test
+    fun check_2023_10_04T00_00_59_000000001_next_match_is_correct() = assertEquals(
+        expected = stubDatetime.copy(minute = 1, second = 1),
+        actual = stubDatetime.copy(second = 59, nanosecond = 1).nextMatch {
+            atSeconds(1)
+        },
+    )
 }
 
 private fun LocalDateTime.assertGap(