use of org.joda.time.YearMonthDay in project joda-time by JodaOrg.
the class TestGJChronology method testSubtractDays.
public void testSubtractDays() {
// This is a test for a bug in version 1.0. The dayOfMonth range
// duration field did not match the monthOfYear duration field. This
// caused an exception to be thrown when subtracting days.
DateTime dt = new DateTime(1112306400000L, GJChronology.getInstance(DateTimeZone.forID("Europe/Berlin")));
YearMonthDay ymd = dt.toYearMonthDay();
while (ymd.toDateTimeAtMidnight().getDayOfWeek() != DateTimeConstants.MONDAY) {
ymd = ymd.minus(Period.days(1));
}
}
use of org.joda.time.YearMonthDay in project joda-time by JodaOrg.
the class TestGJChronology method testPartialGetAsText.
public void testPartialGetAsText() {
GJChronology chrono = GJChronology.getInstance(TOKYO);
assertEquals("January", new YearMonthDay("2005-01-01", chrono).monthOfYear().getAsText());
assertEquals("Jan", new YearMonthDay("2005-01-01", chrono).monthOfYear().getAsShortText());
}
use of org.joda.time.YearMonthDay in project joda-time by JodaOrg.
the class TestGJChronology method testMaximumValue.
public void testMaximumValue() {
DateMidnight dt = new DateMidnight(1570, 1, 1, GJChronology.getInstance());
while (dt.getYear() < 1590) {
dt = dt.plusDays(1);
YearMonthDay ymd = dt.toYearMonthDay();
assertEquals(dt.year().getMaximumValue(), ymd.year().getMaximumValue());
assertEquals(dt.monthOfYear().getMaximumValue(), ymd.monthOfYear().getMaximumValue());
assertEquals(dt.dayOfMonth().getMaximumValue(), ymd.dayOfMonth().getMaximumValue());
}
}
Aggregations