Skip to content

Commit

Permalink
Polish contribution
Browse files Browse the repository at this point in the history
  • Loading branch information
poutsma committed Feb 16, 2022
1 parent 7276752 commit 5ab966f
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public <T extends Temporal & Comparable<? super T>> T elapseUntil(T temporal, in
* Roll forward the give temporal until it reaches the next higher
* order field. Calling this method is equivalent to calling
* {@link #elapseUntil(Temporal, int)} with goal set to the
* minimum value of this field's range, except for daylight saving.
* minimum value of this field's range.
* @param temporal the temporal to roll forward
* @param <T> the type of temporal
* @return the rolled forward temporal
Expand All @@ -269,10 +269,12 @@ public <T extends Temporal & Comparable<? super T>> T rollForward(T temporal) {
int current = get(temporal);
ValueRange range = temporal.range(this.field);
long amount = range.getMaximum() - current + 1;
T result = this.field.getBaseUnit().addTo(temporal, amount);
//adjust daylight saving
if (get(result) != range.getMinimum()) {
result = this.field.adjustInto(result,result.range(this.field).getMinimum());
T result = this.field.getBaseUnit().addTo(temporal, amount);
current = get(result);
range = result.range(this.field);
// adjust for daylight savings
if (current != range.getMinimum()) {
result = this.field.adjustInto(result, range.getMinimum());
}
return result;
}
Expand Down

0 comments on commit 5ab966f

Please sign in to comment.