Package org.joda.time

Examples of org.joda.time.LocalDate


        LocalDate expected = new LocalDate(2007, 6, 30, GJ_CHRONOLOGY);
        assertEquals(expected, date.plusYears(2004));
    }

    public void test_plusYears_positiveToZero_crossCutover() {
        LocalDate date = new LocalDate(2003, 6, 30, GJ_CHRONOLOGY);
        LocalDate expected = new LocalDate(-1, 6, 30, GJ_CHRONOLOGY);
        assertEquals(expected, date.plusYears(-2003));
    }
View Full Code Here


        LocalDate expected = new LocalDate(-1, 6, 30, GJ_CHRONOLOGY);
        assertEquals(expected, date.plusYears(-2003));
    }

    public void test_plusYears_positiveToNegative_crossCutover() {
        LocalDate date = new LocalDate(2003, 6, 30, GJ_CHRONOLOGY);
        LocalDate expected = new LocalDate(-2, 6, 30, GJ_CHRONOLOGY);
        assertEquals(expected, date.plusYears(-2004));
    }
View Full Code Here

        LocalDate expected = new LocalDate(-2, 6, 30, GJ_CHRONOLOGY);
        assertEquals(expected, date.plusYears(-2004));
    }

    public void test_plusYears_negativeToPositive_crossCutover() {
        LocalDate date = new LocalDate(-3, 6, 30, GJ_CHRONOLOGY);
        LocalDate expected = new LocalDate(2002, 6, 30, GJ_CHRONOLOGY);
        assertEquals(expected, date.plusYears(2004));
    }
View Full Code Here

        assertEquals(expected, date.plusYears(2004));
    }

    //-----------------------------------------------------------------------
    public void test_plusWeekyears_positiveToZero_crossCutover() {
        LocalDate date = new LocalDate(2003, 6, 30, GJ_CHRONOLOGY);
        LocalDate expected = new LocalDate(-1, 6, 30, GJ_CHRONOLOGY).withWeekOfWeekyear(date.getWeekOfWeekyear()).withDayOfWeek(date.getDayOfWeek());
        assertEquals(expected, date.weekyear().addToCopy(-2003));
    }
View Full Code Here

        LocalDate expected = new LocalDate(-1, 6, 30, GJ_CHRONOLOGY).withWeekOfWeekyear(date.getWeekOfWeekyear()).withDayOfWeek(date.getDayOfWeek());
        assertEquals(expected, date.weekyear().addToCopy(-2003));
    }

    public void test_plusWeekyears_positiveToNegative_crossCutover() {
        LocalDate date = new LocalDate(2003, 6, 30, GJ_CHRONOLOGY);
        LocalDate expected = new LocalDate(-2, 6, 30, GJ_CHRONOLOGY).withWeekOfWeekyear(date.getWeekOfWeekyear()).withDayOfWeek(date.getDayOfWeek());
        assertEquals(expected, date.weekyear().addToCopy(-2004));
    }
View Full Code Here

        assertEquals(expected, date.weekyear().addToCopy(-2004));
    }

    //-----------------------------------------------------------------------
    public void test_cutoverPreZero() {
        DateTime cutover = new LocalDate(-2, 6, 30, ISOChronology.getInstanceUTC()).toDateTimeAtStartOfDay(DateTimeZone.UTC);
        try {
            GJChronology.getInstance(DateTimeZone.UTC, cutover);
            fail();
        } catch (IllegalArgumentException ex) {
            // expected
View Full Code Here

       
        final LinkRepresentation updateLink = domainObjectRepr.getLinkWithRel(Rel.UPDATE);
       
        final JsonRepresentation argRepr = updateLink.getArguments();
       
        final LocalDate ld = new LocalDate(2013,5,1);
        final LocalDateTime ldt = new LocalDateTime(2013,2,1,14,15,0);
        final DateTime dt = new DateTime(2013,2,1,14,15,0, DateTimeZone.UTC);
        final String s = "New string";
       
        argRepr.mapPut("localDateProperty.value", "2013-05-01");
View Full Code Here

    @Ignore("breaking in CET")
    @Test
    public void jodaPropertiesUpdated() throws Exception {

        // LocalDate
        final LocalDate ld = new LocalDate(2013,5,1);
        modifyLink = getObjectPropertyReprModifyLink("JODA", "82", "localDateProperty");
        argRepr = modifyLink.getArguments().mapPut("value", "2013-05-01");
        assertThat(followedRepr(modifyLink,argRepr).getString("value"), is("2013-05-01")); // hacky

        // LocalDateTime
View Full Code Here

                    if (st.hasMoreTokens()) {
                        str = st.nextToken();
                        zoneChar = parseZoneChar(str.charAt(str.length() - 1));
                        if (str.equals("24:00")) {
                            LocalDate date = (day == -1 ?
                                    new LocalDate(2001, month, 1).plusMonths(1) :
                                    new LocalDate(2001, month, day).plusDays(1));
                            advance = (day != -1 && dayOfWeek != 0);
                            month = date.getMonthOfYear();
                            day = date.getDayOfMonth();
                            if (dayOfWeek != 0) {
                                dayOfWeek = ((dayOfWeek - 1 + 1) % 7) + 1;
                            }
                        } else {
                            millis = parseTime(str);
View Full Code Here

        assertNotNull(f2.parseDateTime("Thu 1970-01-01T00:00:00Z"));
    }

    //-----------------------------------------------------------------------
    public void testParseLocalDate_simple() {
        assertEquals(new LocalDate(2004, 6, 9), g.parseLocalDate("2004-06-09T10:20:30Z"));
        assertEquals(new LocalDate(2004, 6, 9), g.parseLocalDate("2004-06-09T10:20:30+18:00"));
        assertEquals(new LocalDate(2004, 6, 9), g.parseLocalDate("2004-06-09T10:20:30-18:00"));
        assertEquals(new LocalDate(2004, 6, 9, BUDDHIST_PARIS),
                g.withChronology(BUDDHIST_PARIS).parseLocalDate("2004-06-09T10:20:30Z"));
        try {
            g.parseDateTime("ABC");
            fail();
        } catch (IllegalArgumentException ex) {}
View Full Code Here

TOP

Related Classes of org.joda.time.LocalDate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.