Custom List - Date & Time Column - Column Header Filter

Question

I've created a custom list which includes a date based 'Week Commencing' column. The list view has been set to sort items in this column in descending order (see below).

Is there a way to set a similar 'descending' sort on the column header filter? As it stands this still displays items in ascending order (see below). This will become frustrating for users as the list of dates increases, as they will need to scroll
down an increasingly long list to find the most recent date.

Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact
tnmff@microsoft.com.

SharePoint Server 2019 has been released, you can click
here to download it.
Click here to learn new features. Visit the dedicated
forum to
share, explore and talk to experts about SharePoint Server 2019.

Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact
tnmff@microsoft.com.

SharePoint Server 2019 has been released, you can click
here to download it.
Click here to learn new features. Visit the dedicated
forum to
share, explore and talk to experts about SharePoint Server 2019.

Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact
tnmff@microsoft.com.

SharePoint Server 2019 has been released, you can click
here to download it.
Click here to learn new features. Visit the dedicated
forum to
share, explore and talk to experts about SharePoint Server 2019.

I think you may used the wrong field internal name in the script. What's the field internal name of the 'Week Commencing' column? You could check it in the url of the column setting.

Then change it in the script:

myCustomSort["WEEK_x0020_COMMENCING"] = descDateComparer;

Best Regards,

Michael Han

Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact
tnmff@microsoft.com.

SharePoint Server 2019 has been released, you can click
here to download it.
Click here to learn new features. Visit the dedicated
forum to
share, explore and talk to experts about SharePoint Server 2019.

I'd forgotten that at some point I'd changed the column name from 'Date' to 'Week Commencing' and that the internal field wouldn't have changed.

Updating the internal field name in the code has helped to display the filter dates in descending order. However there is still one slight problem - because I'm in the UK, the dd/mm/yyyy format is resulting in the dates being sorted in
descending order by 'day'. For example, 26/08/2019 is appearing appear above 02/09/2019 in the list (see below).

Is it possible for the code be tweaked to recognise the UK date format?

Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact
tnmff@microsoft.com.

SharePoint Server 2019 has been released, you can click
here to download it.
Click here to learn new features. Visit the dedicated
forum to
share, explore and talk to experts about SharePoint Server 2019.