@Test public void testGetFirstWeekCurrentMonth() throws Exception { LocalDate today = LocalDate.now(); LocalDate firstMonday = today.withDayOfMonth(1).withDayOfWeek(DateTimeConstants.MONDAY); int week = Days.daysBetween(firstMonday, today).dividedBy(DateTimeConstants.DAYS_PER_WEEK).getDays(); assertEquals(week, mRangeUnit.getFirstWeek(today)); }
public int getFirstWeek(@Nullable LocalDate firstDayOfMonth) { LocalDate from = getFrom(); LocalDate date; if (mMinDate != null && mMinDate.isAfter(from)) { date = mMinDate; } else { date = firstDayOfMonth; } return getWeekInMonth(date); }
RangeUnit extends CalendarUnit { public int getFirstWeek(@Nullable LocalDate firstDayOfMonth) { LocalDate from = getFrom(); LocalDate date; if (mMinDate != null && mMinDate.isAfter(from)) { date = mMinDate; } else { date = firstDayOfMonth; } return getWeekInMonth(date); } }
RangeUnit extends CalendarUnit { public int getFirstWeek(@Nullable LocalDate firstDayOfMonth) { LocalDate from = getFrom(); LocalDate date; if (mMinDate != null && mMinDate.isAfter(from)) { date = mMinDate; } else { date = firstDayOfMonth; } return getWeekInMonth(date); } protected  RangeUnit(@NonNull LocalDate from, @NonNull LocalDate to, @NonNull LocalDate today,
            @Nullable LocalDate minDate, @Nullable LocalDate maxDate); }
RangeUnit extends CalendarUnit { public int getFirstWeek(@Nullable LocalDate firstDayOfMonth) { LocalDate from = getFrom(); LocalDate date; if (mMinDate != null && mMinDate.isAfter(from)) { date = mMinDate; } else { date = firstDayOfMonth; } return getWeekInMonth(date); } protected  RangeUnit(@NonNull LocalDate from, @NonNull LocalDate to, @NonNull LocalDate today,
            @Nullable LocalDate minDate, @Nullable LocalDate maxDate); @Nullable LocalDate getMinDate(); @Nullable LocalDate getMaxDate(); int getFirstWeek(@Nullable LocalDate firstDayOfMonth); }
RangeUnit extends CalendarUnit { public int getFirstWeek(@Nullable LocalDate firstDayOfMonth) { LocalDate from = getFrom(); LocalDate date; if (mMinDate != null && mMinDate.isAfter(from)) { date = mMinDate; } else { date = firstDayOfMonth; } return getWeekInMonth(date); } protected  RangeUnit(@NonNull LocalDate from, @NonNull LocalDate to, @NonNull LocalDate today,
            @Nullable LocalDate minDate, @Nullable LocalDate maxDate); @Nullable LocalDate getMinDate(); @Nullable LocalDate getMaxDate(); int getFirstWeek(@Nullable LocalDate firstDayOfMonth);  }