use of org.joda.time.Chronology in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseLocalDate_weekyear_month_week_2012.
public void testParseLocalDate_weekyear_month_week_2012() {
Chronology chrono = GJChronology.getInstanceUTC();
DateTimeFormatter f = DateTimeFormat.forPattern("xxxx-MM-ww").withChronology(chrono);
assertEquals(new LocalDate(2012, 1, 2, chrono), f.parseLocalDate("2012-01-01"));
}
use of org.joda.time.Chronology in project joda-time by JodaOrg.
the class TestDateTimeFormat method testFormat_yearOfEraParse.
public void testFormat_yearOfEraParse() {
Chronology chrono = GJChronology.getInstanceUTC();
DateTimeFormatter f = DateTimeFormat.forPattern("YYYY-MM GG").withChronology(chrono).withLocale(Locale.UK);
DateTime dt = new DateTime(2005, 10, 1, 0, 0, 0, 0, chrono);
assertEquals(dt, f.parseDateTime("2005-10 AD"));
assertEquals(dt, f.parseDateTime("2005-10 CE"));
dt = new DateTime(-2005, 10, 1, 0, 0, 0, 0, chrono);
assertEquals(dt, f.parseDateTime("2005-10 BC"));
assertEquals(dt, f.parseDateTime("2005-10 BCE"));
}
use of org.joda.time.Chronology in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseLocalDate_weekyear_month_week_2011.
public void testParseLocalDate_weekyear_month_week_2011() {
Chronology chrono = GJChronology.getInstanceUTC();
DateTimeFormatter f = DateTimeFormat.forPattern("xxxx-MM-ww").withChronology(chrono);
assertEquals(new LocalDate(2011, 1, 3, chrono), f.parseLocalDate("2011-01-01"));
}
use of org.joda.time.Chronology in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseLocalDateTime_monthDay_withDefaultYear_feb29.
public void testParseLocalDateTime_monthDay_withDefaultYear_feb29() {
Chronology chrono = GJChronology.getInstanceUTC();
DateTimeFormatter f = DateTimeFormat.forPattern("M d H m").withChronology(chrono).withLocale(Locale.UK).withDefaultYear(2012);
assertEquals(new LocalDateTime(2012, 2, 29, 13, 40, 0, 0, chrono), f.parseLocalDateTime("2 29 13 40"));
}
use of org.joda.time.Chronology in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseLocalDate_year_month_week_2010.
// This test fails, but since more related tests pass with the extra loop in DateTimeParserBucket
// I'm going to leave the change in and ignore this test
// public void testParseLocalDate_weekyear_month_week_2013() {
// Chronology chrono = GJChronology.getInstanceUTC();
// DateTimeFormatter f = DateTimeFormat.forPattern("xxxx-MM-ww").withChronology(chrono);
// assertEquals(new LocalDate(2012, 12, 31, chrono), f.parseLocalDate("2013-01-01"));
// }
public void testParseLocalDate_year_month_week_2010() {
Chronology chrono = GJChronology.getInstanceUTC();
DateTimeFormatter f = DateTimeFormat.forPattern("yyyy-MM-ww").withChronology(chrono);
assertEquals(new LocalDate(2010, 1, 4, chrono), f.parseLocalDate("2010-01-01"));
}
Aggregations