Announcement

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

    BUG REPORT: DateItem::getValueAsDate throws exception with custom Format and InputFormat

    The code:

    Code:
    DateItem dateItem = new DateItem();
    dateItem.setFormat("dd/MM/yyyy");
    dateItem.setInputFormat("dd/MM/yyyy");
    dateItem.setUseTextField(true);
    
    ButtonItem buttonItem = new ButtonItem();
    buttonItem.addClickHandler(new ClickHandler()
    {
        @Override
        public void onClick(ClickEvent event)
        {
            Date date = dateItem.getValueAsDate();
            SC.logWarn(date.toString());
        }
    });
    
    DynamicForm form = new DynamicForm();
    form.setItems(dateItem, buttonItem);
    form.draw();
    Select a date, like today's (07/16/2018) and click the form button.

    You'll get this:
    Code:
    05:20:09.831:MUP1:WARN:Log:com.google.gwt.core.client.JavaScriptException: (TypeError) : ret_0_g$.getTime is not a function
        at p2i_g$(gwtreference-0.js@48:153101)
        at KCd_g$(gwtreference-0.js@39:17623)
        at foj_g$(gwtreference-0.js@16:159696)
        at eoj_g$(gwtreference-0.js@8:159688)
        at k9b_g$(gwtreference-0.js@8:7917)
        at mjc_g$(gwtreference-0.js@14:8223)
        at xjc_g$(gwtreference-0.js@9:8321)
        at Djc_g$(gwtreference-0.js@8:8394)
        at ejc_g$(gwtreference-0.js@24:8172)
        at nJd_g$(gwtreference-0.js@23:20177)
        at anonymous(gwtreference-0.js@16:151159)
        at qL_g$(gwtreference-0.js@28:4414)
        at tL_g$(gwtreference-0.js@16:4470)
        at anonymous(gwtreference-0.js@14:4450)
        at RXi_g$.obj_0_g$.click(gwtreference-0.js@12:151166)
        at isc_FormItem__fireStandardHandler(http://127.0.0.1:8888/gwtreference/sc/modules/ISC_Forms.js@143:1296)
        at isc_FormItem_handleClick(http://127.0.0.1:8888/gwtreference/sc/modules/ISC_Forms.js@41:1298)
        at _2.handleActivate(http://127.0.0.1:8888/gwtreference/sc/modules/ISC_Forms.js@114:1740)
        at isc_StatefulCanvas_handleClick(http://127.0.0.1:8888/gwtreference/sc/modules/ISC_Foundation.js@13:229)
        at isc_c_Class_invokeSuper(http://127.0.0.1:8888/gwtreference/sc/modules/ISC_Core.js@93:305)
        at isc_c_Class_Super(http://127.0.0.1:8888/gwtreference/sc/modules/ISC_Core.js@170:297)
        at _2.handleClick(http://127.0.0.1:8888/gwtreference/sc/modules/ISC_Forms.js@142:1738)
        at isc_c_EventHandler_bubbleEvent(http://127.0.0.1:8888/gwtreference/sc/modules/ISC_Core.js@89:2115)
        at isc_c_EventHandler_handleClick(http://127.0.0.1:8888/gwtreference/sc/modules/ISC_Core.js@50:1961)
        at isc_c_EventHandler__handleMouseUp(http://127.0.0.1:8888/gwtreference/sc/modules/ISC_Core.js@11:1946)
        at isc_c_EventHandler_handleMouseUp(http://127.0.0.1:8888/gwtreference/sc/modules/ISC_Core.js@57:1937)
        at isc_c_EventHandler_dispatch(http://127.0.0.1:8888/gwtreference/sc/modules/ISC_Core.js@108:2202)
        at eval(eval at isc__makeFunction (http://127.0.0.1:8888/gwtreference/sc/modules/ISC_Core.js@122:76)
    Happened with v12.0p_2018-06-06

    #2
    inputFormat isn't expected to be a full custom date-format - it's a three-character string that specifies the order of date-elements - in this case, it should be "DMY".

    Let us know if that doesn't fix it for you.

    Comment


      #3
      Originally posted by Isomorphic View Post
      inputFormat isn't expected to be a full custom date-format - it's a three-character string that specifies the order of date-elements - in this case, it should be "DMY".

      Let us know if that doesn't fix it for you.
      That's on me, thank you

      Comment

      Working...
      X