ZonedDateTime oldDateTime) {
// ensure rules used are appropriate if zone has a floating version
ZoneRules rules = (oldDateTime != null ? oldDateTime.getApplicableRules() : zone.getRules());
OffsetInfo info = rules.getOffsetInfo(newDateTime);
if (info.isTransition() == false) {
return OffsetDateTime.from(newDateTime, info.getOffset());
}
ZoneOffsetTransition discontinuity = info.getTransition();
OffsetDateTime result = discontinuity.isGap() ?
handleGap(zone, rules, discontinuity, newDateTime, oldDateTime != null ? oldDateTime.toOffsetDateTime() : null) :
handleOverlap(zone, rules, discontinuity, newDateTime, oldDateTime != null ? oldDateTime.toOffsetDateTime() : null);
// validate the result