Polish contribution

See gh-28038
This commit is contained in:
Arjen Poutsma
2022-02-16 11:16:27 +01:00
parent 7276752e7c
commit 5ab966fbde

View File

@@ -260,7 +260,7 @@ abstract class CronField {
* 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
@@ -269,10 +269,12 @@ abstract class CronField {
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;
}