Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Relative dates doesn't work in MiniDateRangeItem: ret.getTime is not a function

    Hello, dear developers!

    I have a simple page: MiniDateRangeItem + a button. When I select range from Yesterday till Tomorrow and press this button, I'm getting an exception.
    If I select ANY date using a calendar, not relative date - it works just fine.

    1. SmartGWT 2.2(19.11.2010 nightly build) + Mozilla Firefox 3.6.12

    3. for a client-side problem, the contents of the Developer Console (see FAQ for usage);
    Code:
    03:37:34.708:INFO:Log:initialized
    03:37:34.719:WARN:Log:NOTE: Firebug is enabled. Firebug greatly slows the performance of applications that make heavy use of JavaScript. Isomorphic highly recommends Firebug for troubleshooting, but Firebug and other development tools should be disabled when assessing the real-world performance of SmartClient applications.
    03:37:35.950:WARN:AutoObserver:Use addInterfaceProperties() to add methods to interface [Class AutoObserver]
    03:37:59.403:INFO:Log:isc.Page is loaded
    4. if there is a JavaScript error, the stack trace logged in the Developer Console (from Internet Explorer if possible);
    Code:
    Uncaught exception escaped : com.google.gwt.core.client.JavaScriptException
    (TypeError): ret.getTime is not a function
     fileName: http://127.0.0.1:8888
     lineNumber: 696
     stack: ("fromDate")@http://127.0.0.1:8888:696
    @:0
    ([object GWTJavaObject],983239,[object GWTJavaObject])@http://127.0.0.1:8888/recondashboard/hosted.html?recondashboard:56
    ([object Object],(void 0))@http://127.0.0.1:8888:897
    ((function () {var param = {};var event = __gwt_makeJavaInvoke(1)(null, 2883703, param);__gwt_makeJavaInvoke(1)(selfJ, 983239, event);var ret = __gwt_makeJavaInvoke(0)(event, 1114114);return !ret;}),[object Object],[object Object])@http://127.0.0.1:8888:77
    @:0
    (null,65630,(function () {var param = {};var event = __gwt_makeJavaInvoke(1)(null, 2883703, param);__gwt_makeJavaInvoke(1)(selfJ, 983239, event);var ret = __gwt_makeJavaInvoke(0)(event, 1114114);return !ret;}),[object Object],[object Object])@http://127.0.0.1:8888/recondashboard/hosted.html?recondashboard:56
    ([object Object],(void 0))@http://127.0.0.1:8888:27
    ([object Object],(void 0))@http://127.0.0.1:8888:13
    isc_StatefulCanvas_handleActivate([object Object],(void 0))@http://127.0.0.1:8888/recondashboard/sc/modules/ISC_Foundation.js:296
    isc_StatefulCanvas_handleClick([object Object],(void 0))@http://127.0.0.1:8888/recondashboard/sc/modules/ISC_Foundation.js:298
    isc_c_EventHandler_bubbleEvent([object Object],"click")@http://127.0.0.1:8888/recondashboard/sc/modules/ISC_Core.js:1493
    isc_c_EventHandler_handleClick([object Object])@http://127.0.0.1:8888/recondashboard/sc/modules/ISC_Core.js:1343
    isc_c_EventHandler__handleMouseUp([object MouseEvent],(void 0))@http://127.0.0.1:8888/recondashboard/sc/modules/ISC_Core.js:1330
    isc_c_EventHandler_handleMouseUp([object MouseEvent])@http://127.0.0.1:8888/recondashboard/sc/modules/ISC_Core.js:1321
    isc_c_EventHandler_dispatch(isc_c_EventHandler_handleMouseUp,[object MouseEvent])@http://127.0.0.1:8888/recondashboard/sc/modules/ISC_Core.js:1556
    anonymous([object MouseEvent])@http://127.0.0.1:8888/recondashboard/sc/modules/ISC_Core.js:38
    
    See the Development console log for details.
    Register a GWT.setUncaughtExceptionHandler(..) for custom uncaught exception handling.
    5. sample code.
    Code:
    VLayout mainVL = new VLayout();
    final MiniDateRangeItem miniItem = new MiniDateRangeItem("miniitem");
    
    DynamicForm dateForm = new DynamicForm();  
    dateForm.setItems(miniItem);
    
    Button getBtn = new Button("Refresh");
    
    getBtn.addClickHandler(new ClickHandler()
    {
        @Override
        public void onClick(ClickEvent event)
        {
            java.util.Date fromDate = miniItem.getFromDate();
            java.util.Date toDate = miniItem.getToDate();
        }
    });
    
    
    HLayout dateRangeHL = new HLayout();
    dateRangeHL.setAlign(Alignment.RIGHT);
    dateRangeHL.setHeight(20);
    dateRangeHL.addMember(dateForm);
    dateRangeHL.addMember(getBtn);
    
    mainVL.addMember(dateRangeHL);
    mainVL.setMargin(5);
    mainVL.setWidth100();
    mainVL.setHeight100();
    
    mainVL.draw();
    6. Exception in Eclipse, in "Development Mode tab":
    Code:
    03:38:26.787 [ERROR] [recondashboard] Uncaught exception escaped
    com.google.gwt.core.client.JavaScriptException: (TypeError): ret.getTime is not a function
     fileName: http://127.0.0.1:8888
     lineNumber: 696
     stack: ("fromDate")@http://127.0.0.1:8888:696
    @:0
    ([object GWTJavaObject],983239,[object GWTJavaObject])@http://127.0.0.1:8888/recondashboard/hosted.html?recondashboard:56
    ([object Object],(void 0))@http://127.0.0.1:8888:897
    ((function () {var param = {};var event = __gwt_makeJavaInvoke(1)(null, 2883703, param);__gwt_makeJavaInvoke(1)(selfJ, 983239, event);var ret = __gwt_makeJavaInvoke(0)(event, 1114114);return !ret;}),[object Object],[object Object])@http://127.0.0.1:8888:77
    @:0
    (null,65630,(function () {var param = {};var event = __gwt_makeJavaInvoke(1)(null, 2883703, param);__gwt_makeJavaInvoke(1)(selfJ, 983239, event);var ret = __gwt_makeJavaInvoke(0)(event, 1114114);return !ret;}),[object Object],[object Object])@http://127.0.0.1:8888/recondashboard/hosted.html?recondashboard:56
    ([object Object],(void 0))@http://127.0.0.1:8888:27
    ([object Object],(void 0))@http://127.0.0.1:8888:13
    isc_StatefulCanvas_handleActivate([object Object],(void 0))@http://127.0.0.1:8888/recondashboard/sc/modules/ISC_Foundation.js:296
    isc_StatefulCanvas_handleClick([object Object],(void 0))@http://127.0.0.1:8888/recondashboard/sc/modules/ISC_Foundation.js:298
    isc_c_EventHandler_bubbleEvent([object Object],"click")@http://127.0.0.1:8888/recondashboard/sc/modules/ISC_Core.js:1493
    isc_c_EventHandler_handleClick([object Object])@http://127.0.0.1:8888/recondashboard/sc/modules/ISC_Core.js:1343
    isc_c_EventHandler__handleMouseUp([object MouseEvent],(void 0))@http://127.0.0.1:8888/recondashboard/sc/modules/ISC_Core.js:1330
    isc_c_EventHandler_handleMouseUp([object MouseEvent])@http://127.0.0.1:8888/recondashboard/sc/modules/ISC_Core.js:1321
    isc_c_EventHandler_dispatch(isc_c_EventHandler_handleMouseUp,[object MouseEvent])@http://127.0.0.1:8888/recondashboard/sc/modules/ISC_Core.js:1556
    anonymous([object MouseEvent])@http://127.0.0.1:8888/recondashboard/sc/modules/ISC_Core.js:38
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:237)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
        at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
        at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
        at java.lang.Thread.run(Thread.java:619)

    Please help. Thanks.

    #2
    This has been fixed, please pick up the next nightly build.

    Sanjiv

    Comment


      #3
      I am getting the same error for the DateRangeItem when I try to retrieve the TO date from the control. This happens in 3.1 but have never seen it in 3.0 or earlier versions.

      Version: SmartGWT 3.1 LGPL official release, Firefox 18.0.1 on MacOSX 10.8.2

      Stack trace:

      Code:
      17:50:05.151 [ERROR] [gwtstandalone] Unable to load module entry point class com.davidb.client.Gwtstandalone (see associated exception for details)
      
      com.google.gwt.core.client.JavaScriptException: (TypeError) @com.smartgwt.client.widgets.form.fields.FormItem::getPropertyAsDate(Ljava/lang/String;)([string: 'toDate']): ret.getTime is not a function
          at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249)
          at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
          at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
          at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
          at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
          at com.smartgwt.client.widgets.form.fields.FormItem.getPropertyAsDate(FormItem.java)
          at com.smartgwt.client.widgets.form.fields.FormItem.getAttributeAsDate(FormItem.java:4234)
          at com.smartgwt.client.widgets.form.fields.DateRangeItem.getToDate(DateRangeItem.java:290)
          at com.davidb.client.Gwtstandalone.onModuleLoad(Gwtstandalone.java:43)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:406)
          at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
          at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:526)
          at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
          at java.lang.Thread.run(Thread.java:680)
      Sample code:
      Code:
      DateRangeItem dateRangeItem = new DateRangeItem();
      dateRangeItem.setShowTitle(false);
      dateRangeItem.setColSpan(2);
      dateRangeItem.setAllowRelativeDates(true);
      dateRangeItem.setDateFormatter(DateDisplayFormat.TOUSSHORTDATE);
      		
      DateRange dateRange = new DateRange();
      dateRange.setRelativeStartDate(RelativeDate.MONTH_AGO);
      dateRange.setRelativeEndDate(RelativeDate.TODAY);
      dateRangeItem.setValue(dateRange);
      		
      DynamicForm form = new DynamicForm();
      form.setItems(dateRangeItem);
      		
      VLayout mainLayout = new VLayout();
      mainLayout.setWidth100();
      mainLayout.setHeight100();
      mainLayout.addMember(form);
      mainLayout.draw();
      		
      //get dates
      Window.alert(dateRangeItem.getFromDate().toString());
      Window.alert(dateRangeItem.getToDate().toString()); //<-- error here

      Comment


        #4
        Please try a fully patched build (please always do so before reporting an issue).

        Comment


          #5
          Originally posted by Isomorphic View Post
          Please try a fully patched build (please always do so before reporting an issue).
          The same problem exists on the nightly 28 Jan 2013

          Code:
          11:12:33.042 [ERROR] [gwtstandalone] Unable to load module entry point class com.davidb.client.Gwtstandalone (see associated exception for details)
          
          com.google.gwt.core.client.JavaScriptException: (TypeError) @com.smartgwt.client.widgets.form.fields.FormItem::getPropertyAsDate(Ljava/lang/String;)([string: 'toDate']): ret.getTime is not a function
              at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249)
              at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
              at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
              at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
              at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
              at com.smartgwt.client.widgets.form.fields.FormItem.getPropertyAsDate(FormItem.java)
              at com.smartgwt.client.widgets.form.fields.FormItem.getAttributeAsDate(FormItem.java:4235)
              at com.smartgwt.client.widgets.form.fields.DateRangeItem.getToDate(DateRangeItem.java:291)
              at com.davidb.client.Gwtstandalone.onModuleLoad(Gwtstandalone.java:43)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:406)
              at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
              at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:526)
              at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
              at java.lang.Thread.run(Thread.java:680)

          Comment


            #6
            This issue persists on the latest patched 4.0 build, Firefox 23.0.1, MacOSX 10.8.4.

            Comment


              #7
              We checked and couldn't reproduce a problem with the originally posted code. However we did notice and fix a related issue that might have looked similar enough that you thought it was the same. The fix for this related issue will be in tomorrow's 4.0 and 4.1 builds.

              Comment

              Working...
              X