How to get date object from wijmo date time input

Posted by: nilesh_nichal on 30 November 2017, 2:47 am EST

    • Post Options:
    • Link

    Posted 30 November 2017, 2:47 am EST

    Hello,

    We are using WjInputDateTime as follows:

    
    let inputContainer = this.elementRef.nativeElement.querySelector('#inputContainer');
    let inputDom = new wjcInput.InputDateTime(inputContainer);
    replaceInput.format = 'M/d/yy h:mm a';
    
    this.renderer.listen(inputDom.inputElement,'blur', (event) => {          
    	console.log('value', event.target.value);
    })
    
    

    We want date in following:

    Example:

    Selection in Date Time → 12th Oct 2012 and 12:30 AM

    ‘12-10-12 12:30 AM’ → (displaying currently as a string format on blur event) So can’t identify whether it is 2012 or 1912 likewise.

    ‘12-10-2012 12:30 AM’ (expected string format) or Date object will be more preferred.

    Thanks

  • Posted 3 December 2017, 8:34 pm EST

    Hi,

    WjInputDateTime has a property format, which you can set. Wny not use that? Are there some limitations in your architecture to use this property?

    ~nilay

  • Posted 5 December 2017, 8:27 pm EST

    Hello Nilay,

    We are using format attribute but these formats are dynamic as you can see in above code (currently it is static value). But actual issue is about value returned on blur event after editing. At this time it gives date string in given format but we want date object instead of string.

    Thanks

  • Posted 6 December 2017, 10:44 pm EST

    Hi Nilesh,

    You can use Control value property for the same which will return Date object. You can format this value as per need.

    ~Manish

Need extra support?

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

Learn More

Forum Channels