Package com.google.gwt.i18n.client.constants

Examples of com.google.gwt.i18n.client.constants.TimeZoneConstants


  @SuppressWarnings("deprecation")
  public void testDynamicTimeZone() {
    TestAnnotatedMessages m = GWT.create(TestAnnotatedMessages.class);
    Date date = new Date(Date.UTC(2010 - 1900, 1, 2, 3, 4, 5));
    TimeZoneConstants timeZoneData = GWT.create(TimeZoneConstants.class);
    String str = timeZoneData.americaLosAngeles();
    TimeZoneInfo tzInfo = TimeZoneInfo.buildTimeZoneData(str);
    TimeZone tz = TimeZone.createTimeZone(tzInfo);
    assertEquals("in timezone: 2/1/2010, 7:04:05 PM", m.inTimezone(date, tz));

    assertEquals("in timezone: 2/1/2010, 7:04:05 PM", m.inTimezoneAsSafeHtml(date, tz).asString());
View Full Code Here


  private TimeZoneInfo anchorage;
  private TimeZoneInfo madrid;

  @Override
  protected void gwtSetUp() throws Exception {
    TimeZoneConstants timeZoneConstants = GWT.create(TimeZoneConstants.class);
    mawson = TimeZoneInfo.buildTimeZoneData(timeZoneConstants.antarcticaMawson());
    anchorage = TimeZoneInfo.buildTimeZoneData(timeZoneConstants.americaAnchorage());
    madrid = TimeZoneInfo.buildTimeZoneData(timeZoneConstants.europeMadrid());
  }
View Full Code Here

  public void test_daylightTimeTransition() {
    // US PST transitioned to PDT on 2006/4/2 2:00am, jump to 2006/4/2 3:00am.
    // That's UTC time 2006/4/2 10:00am

    TimeZoneConstants timeZoneData = GWT.create(TimeZoneConstants.class);
    String str = timeZoneData.americaLosAngeles();
    TimeZone usPacific = TimeZone.createTimeZone(str);

    Date date = new Date();
    date.setTime(Date.UTC(2006 - 1900, 3, 2, 9, 59, 0));
    assertEquals("04/02/2006 01:59:00 PST", DateTimeFormat.getFormat(
View Full Code Here

  }

  public void test_predefinedFormat() {
    Date date = new Date(2006 - 1900, 7, 4, 13, 49, 24);

    TimeZoneConstants timeZoneData = GWT.create(TimeZoneConstants.class);
    String str = timeZoneData.americaLosAngeles();
    TimeZone usPacific = TimeZone.createTimeZone(TimeZoneInfo.buildTimeZoneData(str));

    String fullDateFormat = DateTimeFormat.getFullDateFormat().format(date);
    assertEquals("Friday, August 4, 2006", fullDateFormat);
View Full Code Here

    date = new Date(999);
    assertEquals("999", DateTimeFormat.getFormat("SSS").format(date));
  }

  public void test_timezonev() {
    TimeZoneConstants timeZoneData = GWT.create(TimeZoneConstants.class);
    String str = timeZoneData.americaLosAngeles();
    TimeZone usPacific = TimeZone.createTimeZone(str);

    Date date = new Date();
    date.setTime(Date.UTC(2006 - 1900, 6, 27, 13, 10, 10));
View Full Code Here

        DateTimeFormat.getFormat("MM/dd/yyyy HH:mm:ss vvvv").format(date,
            usPacific));
  }

  public void test_timezonez() {
    TimeZoneConstants timeZoneData = GWT.create(TimeZoneConstants.class);
    String str = timeZoneData.americaLosAngeles();
    TimeZone usPacific = TimeZone.createTimeZone(str);

    Date date = new Date();
    date.setTime(Date.UTC(2006 - 1900, 6, 27, 13, 10, 10));
View Full Code Here

    DateTimeFormat format = DateTimeFormat.getFormat("MMM d, yyyy h:mm:ss a z");
    assertEquals(date, format.parse(format.format(date)));
  }

  public void test_timezoneZ() {
    TimeZoneConstants timeZoneData = GWT.create(TimeZoneConstants.class);
    String str = timeZoneData.americaLosAngeles();
    TimeZone usPacific = TimeZone.createTimeZone(str);

    Date date = new Date();
    date.setTime(Date.UTC(2006 - 1900, 6, 27, 13, 10, 10));
View Full Code Here

  public String getModuleName() {
    return "com.google.gwt.i18n.TimeZoneTest";
  }

  public void testGetters() {
    final TimeZoneConstants timeZoneConstants = GWT.create(TimeZoneConstants.class);
    TimeZone usPacific =
      TimeZone.createTimeZone(TimeZoneInfo.buildTimeZoneData(timeZoneConstants.americaLosAngeles()));
   
    assertEquals(480, usPacific.getStandardOffset());
    assertEquals("America/Los_Angeles", usPacific.getID());
  }
View Full Code Here

    // We create the dates with fmt.parse because this allows us to specify
    // the time zone to which they pertain -- trying to create them by
    // directly manipulating Date objects was making our tests fail when run in
    // timezones outside of California.
   
    TimeZoneConstants timeZoneData = GWT.create(TimeZoneConstants.class);
    String str = timeZoneData.americaLosAngeles();
    TimeZone usPacific = TimeZone.createTimeZone(TimeZoneInfo.buildTimeZoneData(str));
   
    DateTimeFormat fmt = DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_LONG);
   
    Date dateMarchBefore = fmt.parse("March 11, 2007 at 01:00:00 AM GMT-800");
View Full Code Here

    assertTrue("Early November should be DST", usPacific.isDaylightTime(dateNovemberBefore));
  }
 
  @SuppressWarnings("deprecation")
  public void testNames() {
    final TimeZoneConstants timeZoneConstants = GWT.create(TimeZoneConstants.class);
    TimeZone usPacific = TimeZone.createTimeZone(
        TimeZoneInfo.buildTimeZoneData(timeZoneConstants.americaLosAngeles()));
    Date dt = new Date(2007 - 1900, 7 - 1, 1);
    assertTrue(usPacific.isDaylightTime(dt));
    assertEquals("PDT", usPacific.getShortName(dt));
    assertEquals("Pacific Daylight Time", usPacific.getLongName(dt));
   
View Full Code Here

TOP

Related Classes of com.google.gwt.i18n.client.constants.TimeZoneConstants

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.