Skip to content

Parse update date before sorting in media list view#19711

Merged
leekelleher merged 2 commits intov13/devfrom
v13/bugfix/correct-sorting-of-media-list-by-date
Jul 16, 2025
Merged

Parse update date before sorting in media list view#19711
leekelleher merged 2 commits intov13/devfrom
v13/bugfix/correct-sorting-of-media-list-by-date

Conversation

@AndyButland
Copy link
Copy Markdown
Contributor

Prerequisites

  • I have added steps to test this contribution in the description below

Resolves: #19695

Description

In the media picker list view, when sorting, date fields are sorted alphabetically.

This PR attempts to parse the date entry to a date before doing the sorting.

Testing

To replicate the original issue you need some media or folders that when ordered alphabetically aren't ordered by date and time.

With the PR applied you should see them ordered by date and time as would be expected.

Copilot AI review requested due to automatic review settings July 11, 2025 09:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where date fields in the media picker list view were being sorted alphabetically instead of chronologically. The change ensures that update dates are properly parsed as Date objects before sorting to provide the expected date-time ordering.

  • Adds date parsing logic to convert string dates to numeric timestamps for proper chronological sorting
  • Maintains fallback behavior for invalid dates by returning the original string value

@leekelleher leekelleher self-requested a review July 16, 2025 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants