Hi I have a lightning data table in which sorting on Date field is only sorting with 'Day' not with Day month and year(complete Date value) in LWC.
Lightning Data Table :
Code I am using for sorting :
Can anybody please help on getting it sorted with full date value
Best Answer
When parsing dates, you should format them in ISO-8601 format (YYYY-MM-DD). This would allow proper sorting. Here's a modification you could do:
This extra parsing step converts dates (particularly dates that were in locale format) to a proper date, allowing proper sorting.