Issue with date formatting

Posted by: chintavenkata.jayaprakash on 28 July 2020, 6:48 pm EST

  • Posted 28 July 2020, 6:48 pm EST

    Hi team ,

    I have the date format coming as string from the json response,i am binding the json directly it is shoeing as sting in ui .is there a way to format date and also the filters to dd/MM/yy.please suggest some approach other than modifying the json because we are dealing with lakhs of records it is slowing our performance
  • Replied 29 July 2020, 3:49 pm EST

    Hi,

    The easiest solution for you case is to iterate over each data and convert the date string into a Date object but since you have a very large amount of data, it may not be possible.
    Other solution is to use the formatItem event. This event is fired for each cell so you can convert the string to date object by using this event. Please refer to the sample link below for reference:

    https://stackblitz.com/edit/js-18n5sf

    Regards,
    Ashwin
  • Replied 30 July 2020, 5:26 am EST

    HI Team I have tried implementing the approach but but
    i still see the issues in filters even in the stackblitz this is present ,please let me know how to solve this.
  • Replied 30 July 2020, 7:36 pm EST

    Hi,

    Sorry, I must have missed this. Unfortunately, there is no solution for this issue. There is only one solution for your main issue that is to iterate over each value and convert it from string to date manually. The previous solution also does the same but it converts string to date for the visible data only so that the performance is not affected. But since, there are still some data left which have not been converted, they will be displayed on the filter editor.
    So, ultimately, you will have to iterate over each data for conversion. You can also add a spinner (refer to the link at the bottom) while converting the data so that the user will think the data is still being loaded.

    Sample: https://www.grapecity.com/wijmo/demos/Core/CollectionView/LoadingData/Spinners/purejs

    Sorry for the inconvenience caused.

    ~regards
  • Replied 4 August 2020, 8:13 pm EST

    Hi Team,

    Can we achieve this using any kind of pipe which can be written in a custom way.
Need extra support?

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

Learn More

Forum Channels