private DateInterval toDayIsoInterval( DateTimeUnit dateTimeUnit, int offset, int length ) { DateTime from = dateTimeUnit.toJodaDateTime( chronology ); if ( offset > 0 ) { from = from.plusDays( offset ); } else if ( offset < 0 ) { from = from.minusDays( -offset ); } DateTime to = new DateTime( from ).plusDays( length ); DateTimeUnit fromDateTimeUnit = DateTimeUnit.fromJodaDateTime( from ); DateTimeUnit toDateTimeUnit = DateTimeUnit.fromJodaDateTime( to ); fromDateTimeUnit.setDayOfWeek( isoWeekday( fromDateTimeUnit ) ); toDateTimeUnit.setDayOfWeek( isoWeekday( toDateTimeUnit ) ); return new DateInterval( toIso( fromDateTimeUnit ), toIso( toDateTimeUnit ), DateIntervalType.ISO8601_DAY ); }
private DateInterval toMonthIsoInterval( DateTimeUnit dateTimeUnit, int offset, int length ) { DateTime from = dateTimeUnit.toJodaDateTime( chronology ); if ( offset > 0 ) { from = from.plusMonths( offset ); } else if ( offset < 0 ) { from = from.minusMonths( -offset ); } DateTime to = new DateTime( from ).plusMonths( length ).minusDays( 1 ); DateTimeUnit fromDateTimeUnit = DateTimeUnit.fromJodaDateTime( from ); DateTimeUnit toDateTimeUnit = DateTimeUnit.fromJodaDateTime( to ); fromDateTimeUnit.setDayOfWeek( isoWeekday( fromDateTimeUnit ) ); toDateTimeUnit.setDayOfWeek( isoWeekday( toDateTimeUnit ) ); return new DateInterval( toIso( fromDateTimeUnit ), toIso( toDateTimeUnit ), DateIntervalType.ISO8601_MONTH ); }
private DateInterval toDayIsoInterval( DateTimeUnit dateTimeUnit, int offset, int length ) { DateTimeUnit from = new DateTimeUnit( dateTimeUnit ); if ( offset > 0 ) { from = plusDays( from, offset ); } else if ( offset < 0 ) { from = minusDays( from, -offset ); } DateTimeUnit to = new DateTimeUnit( from ); to = plusDays( to, length ); from = toIso( from ); to = toIso( to ); return new DateInterval( from, to, DateIntervalType.ISO8601_DAY ); }
private DateInterval toWeekIsoInterval( DateTimeUnit dateTimeUnit, int offset, int length ) { DateTime from = dateTimeUnit.toJodaDateTime( chronology ); if ( offset > 0 ) { from = from.plusWeeks( offset ); } else if ( offset < 0 ) { from = from.minusWeeks( -offset ); } DateTime to = new DateTime( from ).plusWeeks( length ).minusDays( 1 ); DateTimeUnit fromDateTimeUnit = DateTimeUnit.fromJodaDateTime( from ); DateTimeUnit toDateTimeUnit = DateTimeUnit.fromJodaDateTime( to ); fromDateTimeUnit.setDayOfWeek( isoWeekday( fromDateTimeUnit ) ); toDateTimeUnit.setDayOfWeek( isoWeekday( toDateTimeUnit ) ); return new DateInterval( toIso( fromDateTimeUnit ), toIso( toDateTimeUnit ), DateIntervalType.ISO8601_WEEK ); }
private DateInterval toYearIsoInterval( DateTimeUnit dateTimeUnit, int offset, int length ) { DateTime from = dateTimeUnit.toJodaDateTime( chronology ); if ( offset > 0 ) { from = from.plusYears( offset ); } else if ( offset < 0 ) { from = from.minusYears( -offset ); } DateTime to = new DateTime( from ).plusYears( length ).minusDays( 1 ); DateTimeUnit fromDateTimeUnit = DateTimeUnit.fromJodaDateTime( from ); DateTimeUnit toDateTimeUnit = DateTimeUnit.fromJodaDateTime( to ); fromDateTimeUnit.setDayOfWeek( isoWeekday( fromDateTimeUnit ) ); toDateTimeUnit.setDayOfWeek( isoWeekday( toDateTimeUnit ) ); return new DateInterval( toIso( fromDateTimeUnit ), toIso( toDateTimeUnit ), DateIntervalType.ISO8601_YEAR ); }
private DateInterval toDayIsoInterval( DateTimeUnit dateTimeUnit, int offset, int length ) { DateTimeUnit from = new DateTimeUnit( dateTimeUnit ); if ( offset >= 0 ) { from = plusDays( from, offset ); } else if ( offset < 0 ) { from = minusDays( from, -offset ); } DateTimeUnit to = new DateTimeUnit( from ); to = plusDays( to, length ); from = toIso( from ); to = toIso( to ); return new DateInterval( from, to, DateIntervalType.ISO8601_DAY ); }
private DateInterval toMonthIsoInterval( DateTimeUnit dateTimeUnit, int offset, int length ) { DateTimeUnit from = new DateTimeUnit( dateTimeUnit ); if ( offset > 0 ) { from = plusMonths( from, offset ); } else if ( offset < 0 ) { from = minusMonths( from, -offset ); } DateTimeUnit to = new DateTimeUnit( from ); to = plusMonths( to, length ); to = minusDays( to, 1 ); from = toIso( from ); to = toIso( to ); return new DateInterval( from, to, DateIntervalType.ISO8601_MONTH ); }
private DateInterval toYearIsoInterval( DateTimeUnit dateTimeUnit, int offset, int length ) { DateTimeUnit from = new DateTimeUnit( dateTimeUnit ); if ( offset > 0 ) { from = plusYears( from, offset ); } else if ( offset < 0 ) { from = minusYears( from, -offset ); } DateTimeUnit to = new DateTimeUnit( from ); to = plusYears( to, length ); to = minusDays( to, length ); from = toIso( from ); to = toIso( to ); return new DateInterval( from, to, DateIntervalType.ISO8601_YEAR ); }
private DateInterval toMonthIsoInterval( DateTimeUnit dateTimeUnit, int offset, int length ) { DateTimeUnit from = new DateTimeUnit( dateTimeUnit ); if ( offset > 0 ) { from = plusMonths( from, offset ); } else if ( offset < 0 ) { from = minusMonths( from, -offset ); } DateTimeUnit to = new DateTimeUnit( from ); to = plusMonths( to, length ); to = minusDays( to, 1 ); from = toIso( from ); to = toIso( to ); return new DateInterval( from, to, DateIntervalType.ISO8601_MONTH ); }
private DateInterval toYearIsoInterval( DateTimeUnit dateTimeUnit, int offset, int length ) { DateTimeUnit from = new DateTimeUnit( dateTimeUnit ); if ( offset > 0 ) { from = plusYears( from, offset ); } else if ( offset < 0 ) { from = minusYears( from, -offset ); } DateTimeUnit to = new DateTimeUnit( from ); to = plusYears( to, length ); to = minusDays( to, length ); from = toIso( from ); to = toIso( to ); return new DateInterval( from, to, DateIntervalType.ISO8601_YEAR ); }
private DateInterval toWeekIsoInterval( DateTimeUnit dateTimeUnit, int offset, int length ) { DateTimeUnit from = new DateTimeUnit( dateTimeUnit ); if ( offset > 0 ) { from = plusWeeks( from, offset ); } else if ( offset < 0 ) { from = minusWeeks( from, -offset ); } DateTimeUnit to = new DateTimeUnit( from ); to = plusWeeks( to, length ); to = minusDays( to, 1 ); from = toIso( from ); to = toIso( to ); return new DateInterval( from, to, DateIntervalType.ISO8601_WEEK ); }
private DateInterval toWeekIsoInterval( DateTimeUnit dateTimeUnit, int offset, int length ) { DateTimeUnit from = new DateTimeUnit( dateTimeUnit ); if ( offset > 0 ) { from = plusWeeks( from, offset ); } else if ( offset < 0 ) { from = minusWeeks( from, -offset ); } DateTimeUnit to = new DateTimeUnit( from ); to = plusWeeks( to, length ); to = minusDays( to, 1 ); from = toIso( from ); to = toIso( to ); return new DateInterval( from, to, DateIntervalType.ISO8601_WEEK ); }
return new DateInterval( dateTimeUnit, dateTimeUnit ); return new DateInterval( start, end ); return new DateInterval( start, end ); return new DateInterval( start, end ); return new DateInterval( start, end ); return new DateInterval( start, end ); return new DateInterval( start, end ); return new DateInterval( start, end ); return new DateInterval( start, end ); return new DateInterval( start, end ); return new DateInterval( start, end ); return new DateInterval( start, end ); return new DateInterval( start, end ); return new DateInterval( start, end );