Example usage for com.google.gwt.core.client JsDate create

List of usage examples for com.google.gwt.core.client JsDate create

Introduction

In this page you can find the example usage for com.google.gwt.core.client JsDate create.

Prototype

public static native JsDate create(String dateString) ;

Source Link

Document

Creates a new date from a string to be parsed.

Usage

From source file:gwt.material.design.addins.client.datetimepicker.MaterialDateTimePicker.java

License:Apache License

private JsDate convertDate(Date date) {
    return JsDate.create((double) date.getTime());
}

From source file:gwt.material.design.client.ui.MaterialDatePicker.java

License:Apache License

/**
 * Sets the current date of the picker./* w  w  w  . j  a va2 s .c  o m*/
 *
 * @param date - must not be <code>null</code>
 */
public void setDate(Date date) {
    if (date == null) {
        return;
    }
    this.date = date;
    if (initialized) {
        setPickerDate(JsDate.create((double) date.getTime()), pickatizedDateInput);
        label.addStyleName("active");
    }
}

From source file:gwt.material.design.client.ui.MaterialDatePicker.java

License:Apache License

public void setDateMin(Date dateMin) {
    this.dateMin = dateMin;
    if (initialized && dateMin != null) {
        setPickerDateMin(JsDate.create((double) dateMin.getTime()), pickatizedDateInput);
    }//from  w ww. ja  va 2  s  . c  om
}

From source file:gwt.material.design.client.ui.MaterialDatePicker.java

License:Apache License

public void setDateMax(Date dateMax) {
    this.dateMax = dateMax;
    if (initialized && dateMax != null) {
        setPickerDateMax(JsDate.create((double) dateMax.getTime()), pickatizedDateInput);
    }//from   ww  w .  j a v  a  2 s.  com
}

From source file:java.util.Date.java

License:Apache License

public Date(long date) {
    jsdate = JsDate.create(date);
}

From source file:java.util.Date.java

License:Apache License

/**
 * For use by {@link #createFrom(double)}, should inline away.
 */
Date(double milliseconds, boolean dummyArgForOverloadResolution) {
    jsdate = JsDate.create(milliseconds);
}

From source file:java.util.Date.java

License:Apache License

/**
 * Detects if 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.
 *//*from w ww  .j  av  a  2  s.  c om*/
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());
        }
    }
}

From source file:org.gwt.dynamic.common.client.features.FeatureAResult.java

License:MIT License

public final void setDate(Date date) {
    date(date != null ? JsDate.create(date.getTime()) : null);
}

From source file:org.gwt.dynamic.common.client.util.JsUtils.java

License:MIT License

/**
 * Assigns arbitrary property in given JSO as {@link Date} value.
 * //  w  ww  .  j a  v a 2  s  .  c om
 * @param jso
 *          JSO to be modified
 * @param name
 *          Property name that should be assigned/changed
 * @param value
 *          New property value
 */
public static void setProperty(JavaScriptObject jso, String name, Date value) {
    if (value != null)
        setProperty(jso, name, JsDate.create(value.getTime()));
}

From source file:org.gwtbootstrap3.extras.fullcalendar.client.ui.FullCalendar.java

License:Apache License

public void goToDate(final Date d) {
    if (d != null) {
        JsDate date = JsDate.create((double) d.getTime());
        goToDate(getElement().getId(), date);
    }// ww  w .  j  av  a2s .  co m
}