Examples of JsDate


Examples of com.google.gwt.core.client.JsDate

    int hours = jsdate.getHours();
    if ((hours % 24) != (requestedHours % 24)) {
      // Hours passed to the constructor don't match the hours in the created JavaScript Date; this
      // might be due either because they are outside 0-24 range, there was overflow from
      // minutes:secs:millis or because we are in the situation GAP and has to be fixed.
      JsDate copy = JsDate.create(jsdate.getTime());
      copy.setDate(copy.getDate() + 1);
      int timeDiff = jsdate.getTimezoneOffset() - copy.getTimezoneOffset();

      // If the time zone offset is changing, advance the hours and
      // minutes from the initially requested time by the change amount
      if (timeDiff > 0) {
        // The requested time falls into a non-existent time range due to
        // local time advancing into daylight savings time. If so, push the requested
        // time forward out of the non-existent range.
        int timeDiffHours = timeDiff / 60;
        int timeDiffMinutes = timeDiff % 60;
        int day = jsdate.getDate();
        int badHours = jsdate.getHours();
        if (badHours + timeDiffHours >= 24) {
          day++;
        }
        JsDate newTime = JsDate.create(jsdate.getFullYear(), jsdate.getMonth(),
            day, requestedHours + timeDiffHours, jsdate.getMinutes() + timeDiffMinutes,
            jsdate.getSeconds(), jsdate.getMilliseconds());
        jsdate.setTime(newTime.getTime());
      }
      return;
    }

    // Check for situation OVERLAP by advancing the clock by 1 hour and see if getHours() returns
View Full Code Here

Examples of com.google.gwt.core.client.JsDate

    try {
      return new Date(Long.parseLong(date));
    } catch (NumberFormatException ignored) {
    }
    try {
      JsDate js = JsDate.create(date);
      return new Date((long) js.getTime());
    } catch (JavaScriptException ignored) {
    }
    return null;
  }
View Full Code Here

Examples of com.google.gwt.core.client.JsDate

        $wnd.jQuery('#' + id).fullCalendar('changeView', viewName);
    }-*/;

    public void goToDate(final Date d) {
        if (d != null) {
          JsDate date = JsDate.create((double) d.getTime());
            goToDate(getElement().getId(), date);
        }
    }
View Full Code Here

Examples of com.google.gwt.core.client.JsDate

    private native void next(String id) /*-{
        $wnd.jQuery('#' + id).fullCalendar('next');
    }-*/;

    public Date getDate() {
        final JsDate jsDate = getDate(getElement().getId());
        final long time = (long) jsDate.getTime();
        return new Date(time);
    }
View Full Code Here

Examples of com.google.gwt.core.client.JsDate

    try {
      return new Date(Long.parseLong(date));
    } catch (NumberFormatException ignored) {
    }
    try {
      JsDate js = JsDate.create(date);
      return new Date((long) js.getTime());
    } catch (JavaScriptException ignored) {
    }
    return null;
  }
View Full Code Here

Examples of com.google.gwt.core.client.JsDate

    int hours = jsdate.getHours();
    if ((hours % 24) != (requestedHours % 24)) {
      // Hours passed to the constructor don't match the hours in the created JavaScript Date; this
      // might be due either because they are outside 0-24 range, there was overflow from
      // minutes:secs:millis or because we are in the situation GAP and has to be fixed.
      JsDate copy = JsDate.create(jsdate.getTime());
      copy.setDate(copy.getDate() + 1);
      int timeDiff = jsdate.getTimezoneOffset() - copy.getTimezoneOffset();

      // If the time zone offset is changing, advance the hours and
      // minutes from the initially requested time by the change amount
      if (timeDiff > 0) {
        // The requested time falls into a non-existent time range due to
        // local time advancing into daylight savings time. If so, push the requested
        // time forward out of the non-existent range.
        int timeDiffHours = timeDiff / 60;
        int timeDiffMinutes = timeDiff % 60;
        int day = jsdate.getDate();
        int badHours = jsdate.getHours();
        if (badHours + timeDiffHours >= 24) {
          day++;
        }
        JsDate newTime = JsDate.create(jsdate.getFullYear(), jsdate.getMonth(),
            day, requestedHours + timeDiffHours, jsdate.getMinutes() + timeDiffMinutes,
            jsdate.getSeconds(), jsdate.getMilliseconds());
        jsdate.setTime(newTime.getTime());
      }
      return;
    }

    // Check for situation OVERLAP by advancing the clock by 1 hour and see if getHours() returns
View Full Code Here

Examples of com.google.gwt.core.client.JsDate

   * local time advancing into daylight savings time. If so, push the requested
   * time forward out of the non-existent range.
   */
  private void fixDaylightSavings(int hours) {
    if ((jsdate.getHours() % 24) != (hours % 24)) {
      JsDate copy = JsDate.create(jsdate.getTime());
      copy.setDate(copy.getDate() + 1);
      int timeDiff = jsdate.getTimezoneOffset() - copy.getTimezoneOffset();

      // If the time zone offset is changing, advance the hours and
      // minutes from the initially requested time by the change amount
      if (timeDiff > 0) {
        int timeDiffHours = timeDiff / 60;
        int timeDiffMinutes = timeDiff % 60;
        int day = jsdate.getDate();
        int badHours = jsdate.getHours();
        if (badHours + timeDiffHours >= 24) {
          day++;
        }
        JsDate newTime = JsDate.create(jsdate.getFullYear(), jsdate.getMonth(),
            day, hours + timeDiffHours, jsdate.getMinutes() + timeDiffMinutes,
            jsdate.getSeconds(), jsdate.getMilliseconds());
        jsdate.setTime(newTime.getTime());
      }
    }
  }
View Full Code Here

Examples of com.google.gwt.core.client.JsDate

    public native boolean isDate(JavaScriptObject array, int i) /*-{
        return Boolean(array[i].getMonth);
    }-*/;

    public Date getDate(JavaScriptObject array, int i) {
        JsDate jsDate = getJsDate(array, i);

        return new Date((long) jsDate.getTime());
    }
View Full Code Here

Examples of com.google.gwt.core.client.JsDate

    }

    @Test
    public void testDateInAndOut() throws Throwable {
        String json = Resources.INSTANCE.minimalDateMeta().getText();
        JsDate dateIn = JsDate.create();
        dateIn.setUTCFullYear(1914);
        dateIn.setUTCMonth(4);
        dateIn.setUTCDate(15);
        dateIn.setUTCHours(22);
        dateIn.setUTCMinutes(13);
        test(json, "SELECT dob FROM person WHERE dob = ?", args(dateIn), null);

        builder.fireDirty();

        assertEquals(1, getLastArgs(conf).length());
        JsDate dateOut = getLastArgs(conf).getObject(0);
        assertEquals(1914, dateOut.getUTCFullYear());
        assertEquals(4, dateOut.getUTCMonth());
        assertEquals(15, dateOut.getUTCDate());
        assertEquals(22, dateOut.getUTCHours());
        assertEquals(13, dateOut.getUTCMinutes());
    }
View Full Code Here

Examples of com.google.gwt.core.client.JsDate

        builder.fireDirty();
    }

    public void testJsList() throws Throwable {
        JsDate dateIn = JsDate.create();
        dateIn.setUTCFullYear(1914);
        dateIn.setUTCMonth(4);
        dateIn.setUTCDate(15);
        dateIn.setUTCHours(22);
        dateIn.setUTCMinutes(13);

        JsArrayMixed mixed = (JsArrayMixed) JsArrayMixed.createArray();
        mixed.push(dateIn);
        mixed.push(new Double(123.12d));
        mixed.push("123");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.