File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -234,11 +234,11 @@ class InstantSamples {
234
234
235
235
@Test
236
236
fun minusDateTimeUnit () {
237
- val startInstant = Instant .parse(" 2024-05-02T08:55:40.322Z " )
237
+ val startInstant = Instant .parse(" 2024-03-28T02:04:56.256Z " )
238
238
val twoYearsEarlierInBerlin = startInstant.minus(2 , DateTimeUnit .YEAR , TimeZone .of(" Europe/Berlin" ))
239
- check(twoYearsEarlierInBerlin == Instant .parse(" 2022-05-02T08:55:40.322Z " ))
239
+ check(twoYearsEarlierInBerlin == Instant .parse(" 2022-03-28T01:04:56.256Z " ))
240
240
val twoYearsEarlierInCairo = startInstant.minus(2 , DateTimeUnit .YEAR , TimeZone .of(" Africa/Cairo" ))
241
- check(twoYearsEarlierInCairo == Instant .parse(" 2022-05-02T09:55:40.322Z " ))
241
+ check(twoYearsEarlierInCairo == Instant .parse(" 2022-03-28T02:04:56.256Z " ))
242
242
}
243
243
244
244
@Test
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ package kotlinx.datetime.test.samples
7
7
8
8
import kotlinx.datetime.*
9
9
import kotlinx.datetime.format.*
10
+ import kotlin.random.*
10
11
import kotlin.test.*
11
12
12
13
class TimeZoneSamples {
@@ -174,16 +175,15 @@ class TimeZoneSamples {
174
175
check(instant == Instant .parse(" 2023-06-02T11:00:00Z" ))
175
176
}
176
177
177
- @Ignore // fails on Windows; TODO investigate
178
178
@Test
179
179
fun atStartOfDayIn () {
180
- val zone = TimeZone .of(" America/Cuiaba " )
180
+ val zone = TimeZone .of(" Africa/Cairo " )
181
181
// The normal case where `atStartOfDayIn` returns the instant of 00:00:00 in the given time zone.
182
182
val normalDate = LocalDate (2023 , 6 , 2 )
183
183
val startOfDay = normalDate.atStartOfDayIn(zone)
184
184
check(startOfDay.toLocalDateTime(zone) == normalDate.atTime(hour = 0 , minute = 0 ))
185
185
// The edge case where 00:00:00 does not exist in this time zone on this date due to clocks moving forward.
186
- val dateWithoutMidnight = LocalDate (1985 , 11 , 2 )
186
+ val dateWithoutMidnight = LocalDate (2023 , 4 , 28 )
187
187
val startOfDayWithoutMidnight = dateWithoutMidnight.atStartOfDayIn(zone)
188
188
check(startOfDayWithoutMidnight.toLocalDateTime(zone) == dateWithoutMidnight.atTime(hour = 1 , minute = 0 ))
189
189
}
You can’t perform that action at this time.
0 commit comments