Angular component Input Date does not accept null

Posted by: htn on 9 March 2020, 8:41 pm EST

  • Posted 9 March 2020, 8:41 pm EST

    I have upgraded to the latest version 646 of Wijmo in order to use it with Angular 9 Ivy. However, wj-input-date is broken with null value, even when isRequired is false.

    Example:
    <wj-input-date [value]="null" [isRequired]="false"></wj-input-date>

    Runtime error:
    ERROR ** Assertion failed in Wijmo: Date expected. Error
    at assert (http://localhost:4200/vendor.js:62317:10879)
    at asDate (http://localhost:4200/vendor.js:62317:11698)
    at WjInputDate.set [as value] (http://localhost:4200/vendor.js:62159:103412)
    at setInputsForProperty (http://localhost:4200/vendor.js:18986:35)
    at elementPropertyInternal (http://localhost:4200/vendor.js:17801:9)
    at Module.ɵɵproperty (http://localhost:4200/vendor.js:25895:9)
    at AppComponent_Template (http://localhost:4200/main.js:417:65)
    at executeTemplate (http://localhost:4200/vendor.js:17340:9)
    at refreshView (http://localhost:4200/vendor.js:17187:13)
    at refreshComponent (http://localhost:4200/vendor.js:18627:9)
    defaultErrorLogger @ core.js:5871


    I can't even open a ticket for the support because of javascript error at: https://supportone.componentone.com/newcase
  • Replied 10 March 2020, 8:16 pm EST

    Hi Hoang,

    We are really sorry for the inconvenience. There may be an issue with the server of SupportOne but it is fixed now.

    Regarding the InputDate, we have forwarded a bug report to the dev team with internal tracking id 424951. We will update you as soon as the issue is fixed.

    Regards,
    Ashwin
  • Replied 16 March 2020, 11:51 pm EST

    Hi,

    Before Ivy, the order was specified on the component level, in the @Component decorator’s ‘inputs’ property. This way every Wijmo component had embedded info about the correct initialization order. So even if you wrote:
    <wj-input-date [value]="null" [isRequired]="false" />

    , isRequired=false was assigned first, before value=null, and this definition worked correctly.

    With Ivy, the initialization order is the same as the order of the attributes specified on the element, so the definition above stops working: value=null will be assigned before isRequired=false. To bring it to work, you must specify attributes in the correct order yourself:
    <wj-input-date [isRequired]="false" [value]="null" />

    ~regards
  • Replied 27 March 2020, 1:21 am EST

    Hi,
    Thank you for your reply. It does work.
    However, I consider it a workaround: We should not rely on the order, it is very dangerous and not documented anywhere. Moreover, in my case, it breaks the application by stopping the render.
    I hope the issue will be fixed soon.

    Regards
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels