Skip to content

Commit 188f2a9

Browse files
committed
Fix the time overlap right boundary being included in the overlap
Fixes #403 Fixes #399
1 parent bc8adee commit 188f2a9

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

core/common/test/TimeZoneTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ private fun checkOverlap(timeZone: TimeZone, overlapStart: LocalDateTime) {
281281
val instantStart = overlapStart.plusNominalSeconds(-1).toInstant(timeZone).plus(1, DateTimeUnit.SECOND)
282282
// the later occurrence of the overlap
283283
val instantEnd = overlapStart.plusNominalSeconds(1).toInstant(timeZone).minus(1, DateTimeUnit.SECOND)
284+
assertEquals(instantEnd, overlapStart.toInstant(timeZone))
284285
try {
285286
// there is at least a one-second overlap
286287
assertNotEquals(instantStart, instantEnd)

core/native/src/internal/TimeZoneRules.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ internal class RecurringZoneRules(
167167
val ldtAfter = rule.transitionDateTime.toLocalDateTime(rule.offsetAfter)
168168
return if (localDateTime < ldtBefore && localDateTime < ldtAfter) {
169169
OffsetInfo.Regular(rule.offsetBefore)
170-
} else if (localDateTime > ldtBefore && localDateTime >= ldtAfter) {
170+
} else if (localDateTime >= ldtBefore && localDateTime >= ldtAfter) {
171171
offset = rule.offsetAfter
172172
continue
173173
} else if (ldtAfter < ldtBefore) {

0 commit comments

Comments
 (0)