Package com.google.ical.values

Examples of com.google.ical.values.DateTimeValueImpl


          DateTimeZone.UTC);
    }
  }

  static DateValue dateTimeToDateValue(ReadableDateTime dt) {
    return new DateTimeValueImpl(
        dt.getYear(), dt.getMonthOfYear(), dt.getDayOfMonth(),
        dt.getHourOfDay(), dt.getMinuteOfHour(), dt.getSecondOfMinute());
  }
View Full Code Here


    RDateList rd3 =
      new RDateList("RDATE:20060412T120000,20060413T153000Z", PST);
    assertEquals(1, rd1.getDatesUtc().length);
    assertEquals(new DateValueImpl(2006, 4, 12), rd1.getDatesUtc()[0]);
    assertEquals(1, rd2.getDatesUtc().length);
    assertEquals(new DateTimeValueImpl(2006, 4, 12, 19, 0, 0),
                 rd2.getDatesUtc()[0]);
    assertEquals(2, rd3.getDatesUtc().length);
    assertEquals(new DateTimeValueImpl(2006, 4, 12, 19, 0, 0),
                 rd3.getDatesUtc()[0]);
    assertEquals(new DateTimeValueImpl(2006, 4, 13, 15, 30, 0),
                 rd3.getDatesUtc()[1]);
  }
View Full Code Here

  public void testRDateListParsingWithExplicitTzid() throws Exception {
    RDateList rd = new RDateList(
        "RDATE;TZID=\"America/New_York\":20060412T120000", PST);
    assertEquals(1, rd.getDatesUtc().length);
    assertEquals(new DateTimeValueImpl(2006, 4, 12, 16, 0, 0),
                 rd.getDatesUtc()[0]);
  }
View Full Code Here

  public void testComparisonSameAsDateValueImpl() throws Exception {
    // It's more important for DateValueComparison to be a total ordering
    // (see the class comments) than it be consistent with DateValue.
    DateValue[] inOrder = {
      new DateValueImpl(2006, 4, 11),
      new DateTimeValueImpl(2006, 4, 11, 0, 0, 0),
      new DateTimeValueImpl(2006, 4, 11, 0, 0, 1),
      new DateTimeValueImpl(2006, 4, 11, 12, 30, 15),
      new DateTimeValueImpl(2006, 4, 11, 23, 59, 59),
      new DateValueImpl(2006, 4, 12),
      new DateValueImpl(2006, 4, 13),
      new DateTimeValueImpl(2006, 4, 14, 12, 0, 0),
      new DateTimeValueImpl(2006, 4, 14, 15, 0, 0),
    };

    for (int i = 1; i < inOrder.length; ++i) {
      assertTrue(DateValueComparison.comparable(inOrder[i - 1]) <
                 DateValueComparison.comparable(inOrder[i]));
View Full Code Here

      // The actual iterator implementation is responsible for anything
      // < dtStart.
      switch (freq) {
        case YEARLY:
          start = dtStart instanceof TimeValue
              ? new DateTimeValueImpl(start.year(), 1, 1, 0, 0, 0)
              : new DateValueImpl(start.year(), 1, 1);
          break;
        case MONTHLY:
          start = dtStart instanceof TimeValue
              ? new DateTimeValueImpl(start.year(), start.month(), 1, 0, 0, 0)
              : new DateValueImpl(start.year(), start.month(), 1);
          break;
        case WEEKLY:
          int d = (7 + wkst.ordinal() - Weekday.valueOf(dtStart).ordinal()) % 7;
          start = TimeUtils.add(dtStart, new DateValueImpl(0, 0, -d));
View Full Code Here

    assertEquals(new DateValueImpl(2006, 1, 2),
                 new DTBuilder(2005, 12, 33).toDate());
  }

  public void testToDateTime() throws Exception {
    assertEquals(new DateTimeValueImpl(2006, 1, 2, 0, 0, 0),
                 new DTBuilder(2006, 1, 2).toDateTime());
    assertEquals(new DateTimeValueImpl(2006, 1, 2, 12, 30, 45),
                 new DTBuilder(2006, 1, 2, 12, 30, 45).toDateTime());
    // test normalization
    assertEquals(new DateTimeValueImpl(2006, 1, 2, 0, 0, 0),
                 new DTBuilder(2005, 12, 33, 0, 0, 0).toDateTime());
    assertEquals(new DateTimeValueImpl(2006, 1, 2, 12, 0, 0),
                 new DTBuilder(2005, 12, 31, 60, 0, 0).toDateTime());
  }
View Full Code Here

    assertTrue(
        new DTBuilder(2005, 6, 16).compareTo(new DateValueImpl(2005, 6, 15))
        > 0);
    assertTrue(
        new DTBuilder(2005, 6, 15, 12, 0, 0).compareTo(
            new DateTimeValueImpl(2005, 6, 15, 12, 0, 0))
        == 0);
    assertTrue(
        new DTBuilder(2005, 6, 15, 11, 0, 0).compareTo(
            new DateTimeValueImpl(2005, 6, 15, 12, 0, 0))
        < 0);
    assertTrue(
        new DTBuilder(2005, 6, 15, 13, 0, 0).compareTo(
            new DateTimeValueImpl(2005, 6, 15, 12, 0, 0))
        > 0);
  }
View Full Code Here

TOP

Related Classes of com.google.ical.values.DateTimeValueImpl

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.