Skip to content

Incorrect sorting by "Last Modified" in MODX browser #16731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
halftrainedharry opened this issue Apr 14, 2025 · 2 comments · May be fixed by #16734
Open

Incorrect sorting by "Last Modified" in MODX browser #16731

halftrainedharry opened this issue Apr 14, 2025 · 2 comments · May be fixed by #16734
Assignees
Labels
bug The issue in the code or project, which should be addressed.

Comments

@halftrainedharry
Copy link
Contributor

Bug report

Summary

In the MODX browser the files don't get correctly sorted by the "last modified" date, if the system setting manager_date_format doesn't have the default value.

Step to reproduce

  • Change the system setting manager_date_format to d.m.Y
  • Open the MODX browser (menu "Media" -> "Media Browser")
  • Change the dropdown "Sort By:" to "Last Modfied"
  • Verify that the order of the files is incorrect

Environment

MODX 3.1.2-pl

Cause

The processor Browser/Directory/GetFiles used to return the timestamp of a file (in the field "lastmod"). The formatting of the timestamps was done in JS. The sorting of the files was also done in JS using the timestamp.

With #16604 the processor now already returns the formatted time string. The sorting is done in JS using this already formatted strings.

@halftrainedharry halftrainedharry added the bug The issue in the code or project, which should be addressed. label Apr 14, 2025
@modxcommunity
Copy link
Collaborator

This issue has been mentioned on MODX Community. There might be relevant details there:

https://community.modx.com/t/problems-in-the-media-browser-not-sorting-by-last-modified/8499/4

@smg6511
Copy link
Collaborator

smg6511 commented Apr 16, 2025

I'm taking a look at this. The file browser is pretty lacking in usability regardless—even if the sorting was working correctly, there's no way to easily see in the list (or grid) view what the sort direction is, and there's no control over that sort direction (of any column). It might take a little while to untangle...

UPDATE: I have a quick fix for the basic issue I'll post later today. Will look into better UI sorting control separately.

@smg6511 smg6511 self-assigned this Apr 16, 2025
@smg6511 smg6511 linked a pull request Apr 17, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue in the code or project, which should be addressed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants