List of usage examples for java.time.temporal ChronoField ALIGNED_WEEK_OF_MONTH
ChronoField ALIGNED_WEEK_OF_MONTH
To view the source code for java.time.temporal ChronoField ALIGNED_WEEK_OF_MONTH.
Click Source Link
From source file:org.silverpeas.core.calendar.Recurrence.java
private Temporal computeDateForMonthlyFrequencyFrom(final Temporal source, DayOfWeekOccurrence dayOfWeek) { Temporal current = source;// ww w . j av a 2s .c om if (dayOfWeek.nth() > 1) { current = current.with(ChronoField.ALIGNED_WEEK_OF_MONTH, dayOfWeek.nth()); } else if (dayOfWeek.nth() < 0) { current = current.with(ChronoField.DAY_OF_MONTH, 1).plus(1, ChronoUnit.MONTHS).minus(1, ChronoUnit.DAYS) .plus(dayOfWeek.nth(), ChronoUnit.WEEKS).with(dayOfWeek.dayOfWeek()); } return current; }