Browse Source

Polish contribution

See gh-28038
pull/28119/head
Arjen Poutsma 3 years ago
parent
commit
5ab966fbde
  1. 10
      spring-context/src/main/java/org/springframework/scheduling/support/CronField.java

10
spring-context/src/main/java/org/springframework/scheduling/support/CronField.java

@ -260,7 +260,7 @@ abstract class CronField { @@ -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
@ -270,9 +270,11 @@ abstract class CronField { @@ -270,9 +270,11 @@ abstract class CronField {
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());
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;
}

Loading…
Cancel
Save