Skip to content

Commit a56ff87

Browse files
committed
Relax LocalDateTime constructor components optionality for seconds and nanoseconds
1 parent 6da8343 commit a56ff87

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

core/commonMain/src/LocalDateTime.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public expect class LocalDateTime : Comparable<LocalDateTime> {
2323
* @throws IllegalArgumentException if any parameter is out of range, or if [dayOfMonth] is invalid for [month] and
2424
* [year].
2525
*/
26-
public constructor(year: Int, monthNumber: Int, dayOfMonth: Int, hour: Int, minute: Int, second: Int, nanosecond: Int)
26+
public constructor(year: Int, monthNumber: Int, dayOfMonth: Int, hour: Int, minute: Int, second: Int = 0, nanosecond: Int = 0)
2727

2828
public val year: Int
2929
public val monthNumber: Int

core/commonTest/src/InstantTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class InstantTest {
103103
}
104104
}
105105

106-
val instant1 = LocalDateTime(2019, 10, 27, 2, 59, 0, 0).toInstant(zone)
106+
val instant1 = LocalDateTime(2019, 10, 27, 2, 59).toInstant(zone)
107107
checkComponents(instant1.toLocalDateTime(zone), 2019, 10, 27, 2, 59)
108108

109109
val instant2 = instant1.plus(DateTimePeriod(hours = 24), zone)

core/commonTest/src/LocalDateTimeTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class LocalDateTimeTest {
101101
}
102102

103103
@Test
104-
fun constructInvalidDate() = checkInvalidDate { year, month, day -> LocalDateTime(year, month, day, 0, 0, 0, 0).date }
104+
fun constructInvalidDate() = checkInvalidDate { year, month, day -> LocalDateTime(year, month, day, 0, 0).date }
105105

106106
@Test
107107
fun constructInvalidTime() {

0 commit comments

Comments
 (0)