Example usage for org.joda.time MonthDay isBefore

List of usage examples for org.joda.time MonthDay isBefore

Introduction

In this page you can find the example usage for org.joda.time MonthDay isBefore.

Prototype

public boolean isBefore(ReadablePartial partial) 

Source Link

Document

Is this partial earlier than the specified partial.

Usage

From source file:org.apereo.portal.events.aggr.dao.jpa.QuarterDetailImpl.java

License:Apache License

@Override
public DateMidnight getStartDateMidnight(ReadableInstant instant) {
    final MonthDay instantMonthDay = new MonthDay(instant);

    //If the quarter wraps a year boundary AND
    //   the instant MonthDay is before the start AND
    //   the end is after the instant MonthDay
    // then shift the start year back by one to deal with the year boundary
    if (this.end.isBefore(this.start) && instantMonthDay.isBefore(this.start)
            && this.end.isAfter(instantMonthDay)) {
        return this.start.toDateTime(new DateTime(instant).minusYears(1)).toDateMidnight();
    }//from w  ww .ja v a  2  s  . c om

    return this.start.toDateTime(instant).toDateMidnight();
}

From source file:org.apereo.portal.events.aggr.dao.jpa.QuarterDetailImpl.java

License:Apache License

@Override
public DateMidnight getEndDateMidnight(ReadableInstant instant) {
    final MonthDay instantMonthDay = new MonthDay(instant);

    //If the quarter wraps a year boundary AND
    //   the end is NOT after the instant MonthDay AND
    //   the instant MonthDay is NOT before the start
    // then shift the end year forward by one to deal with the year boundary
    if (this.end.isBefore(this.start) && !this.end.isAfter(instantMonthDay)
            && !instantMonthDay.isBefore(this.start)) {
        return this.end.toDateTime(new DateTime(instant).plusYears(1)).toDateMidnight();
    }/*w ww  . j  a  v  a2  s . co m*/

    return this.end.toDateTime(instant).toDateMidnight();
}

From source file:org.jasig.portal.events.aggr.dao.jpa.QuarterDetailImpl.java

License:Apache License

@Override
public DateMidnight getEndDateMidnight(ReadableInstant instant) {
    final MonthDay instantMonthDay = new MonthDay(instant);

    //If the quarter wraps a year boundary AND
    //   the end is NOT after the instant MonthDay AND 
    //   the instant MonthDay is NOT before the start
    // then shift the end year forward by one to deal with the year boundary
    if (this.end.isBefore(this.start) && !this.end.isAfter(instantMonthDay)
            && !instantMonthDay.isBefore(this.start)) {
        return this.end.toDateTime(new DateTime(instant).plusYears(1)).toDateMidnight();
    }/*from   www . j a v a2 s.  c o m*/

    return this.end.toDateTime(instant).toDateMidnight();
}