Java Code Examples for org.joda.time.LocalDate#withMonthOfYear()

The following examples show how to use org.joda.time.LocalDate#withMonthOfYear() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FinancialYearOctExpiryDayValidator.java    From dhis2-android-datacapture with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected LocalDate getMaxDateCanEdit() {
    LocalDate periodDate = LocalDate.parse(period,
            DateTimeFormat.forPattern(DATE_FORMAT));
    periodDate = periodDate.withMonthOfYear(monthOfYear());
    periodDate = periodDate.plusMonths(plusMonths());
    return periodDate.plusDays(expiryDays - 2);
}
 
Example 2
Source File: SixMonthlyExpiryDayValidator.java    From dhis2-android-datacapture with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected LocalDate getMaxDateCanEdit() {
    int periodNumber = Character.getNumericValue(period.charAt(period.length() - 1));
    LocalDate periodDate = LocalDate.parse(period.substring(0, period.length() - 1),
            DateTimeFormat.forPattern(getDateFormat()));
    periodDate = periodDate.withMonthOfYear(monthOfYear(periodNumber));
    periodDate = periodDate.plusMonths(plusMonths());
    return periodDate.plusDays(expiryDays - 2);
}
 
Example 3
Source File: FinancialYearJulyExpiryDayValidator.java    From dhis2-android-datacapture with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected LocalDate getMaxDateCanEdit() {
    LocalDate periodDate = LocalDate.parse(period,
            DateTimeFormat.forPattern(DATE_FORMAT));
    periodDate = periodDate.withMonthOfYear(monthOfYear());
    periodDate = periodDate.plusMonths(plusMonths());
    return periodDate.plusDays(expiryDays - 2);
}
 
Example 4
Source File: FinancialYearAprilExpiryDayValidator.java    From dhis2-android-datacapture with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected LocalDate getMaxDateCanEdit() {
    LocalDate periodDate = LocalDate.parse(period,
            DateTimeFormat.forPattern(DATE_FORMAT));
    periodDate = periodDate.withMonthOfYear(monthOfYear());
    periodDate = periodDate.plusMonths(plusMonths());
    return periodDate.plusDays(expiryDays - 2);
}
 
Example 5
Source File: BimonthlyExpiryDayValidator.java    From dhis2-android-datacapture with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected LocalDate getMaxDateCanEdit() {
    int periodNumber = Integer.parseInt(period.substring(4, 6));
    LocalDate periodDate = LocalDate.parse(period.substring(0, 4),
            DateTimeFormat.forPattern(DATE_FORMAT));
    periodDate = periodDate.withMonthOfYear(monthOfYear(periodNumber));
    periodDate = periodDate.plusMonths(plusMonths());
    return periodDate.plusDays(expiryDays - 2);
}