Search code examples
javajavascriptdategwtjsni

How to return from JavaScript object with type java.util.Date?


I'm calling in JS some javaMethod(java.util.Date date).

I can't change code on java-side. How can I create java.util.Date object from JS-side (at least empty date)?


Solution

  • Solved it in a not very good way, but still..

    So now I'm just added to that method with JS just one more Date arg. Now it looks like

    native void doSomething(Object object, Date date) /*-{
      .....
      .....::setDate(Ljava/util/Date;)(date);
      .....
    }-*/;
    

    and calling it like doSomething(var1, new Date());