Fix sortable date column ordering for 12 AM (midnight) times - #27032
Fix sortable date column ordering for 12 AM (midnight) times#27032thswlsqls wants to merge 5 commits into
Conversation
|
@thswlsqls I was unable to find any example in Jenkins where I could test this to confirm that it works as expected. Can you provide screenshots of a place in Jenkins where a sortable time column is displayed? |
|
@MarkEWaite Thanks again for looking at this. I replied with before/after harness screenshots on July 23 — flagging it here in case that comment didn't reach you. Whenever you have time, I'd appreciate your call on whether this is worth carrying without an in-product reproduction; I'm fine either way. |
I believe that there might be a case where a sortable date column is used in the lockable resources plugin. However, that needs more time to confirm it. If it is used there, then that gives me a location where it can be tested. Let's leave the pull request open for now. |
|
@MarkEWaite Thanks for the pointer. I checked the lockable-resources plugin and its sortable tables don't reach this path either — So I still don't have an in-product reproduction to offer. I'm fine either way on keeping this open or closing it — your call. |


Sortable date columns parse each cell with
Sortable.sorter.date.toDate(), which converts PM times (hours += 12) but has no branch for 12 AM. So "12:30 AM" keepshours = 12and sorts after every same-day AM time instead of before them.sortable.jsis vendored from kryogenix.org (MIT); this is a Jenkins-local correctness fix, not an upstream resync — one symmetric AM-midnight branch added beside the existing PM branch.Testing done
No JS unit-test framework exists in this tree (jest/vitest), so no automated test was added; the change was exercised with Node and frontend lint.
Node reproduction with the file's own
date_pattern, same date so only the time differs:toDate("12:30 AM") - toDate("1:00 AM") = +41400000(wrong — midnight sorts last).-1800000(correct — midnight sorts first). Resolved hours for "12:30 AM": 12 → 0.Frontend lint clean:
eslintandprettier --checkon the file both pass (yarn lint:js).Manual: a
<table class="sortable">with rows "12:30 AM" and "1:00 AM" orders midnight ahead of 1 AM after clicking the header.Screenshots (UI changes only)
Before
N/A (sort-order behavior; not a visual change)
After
N/A
Proposed changelog entries
Proposed changelog category
/label bug, web-ui
Proposed upgrade guidelines
N/A
Submitter checklist
@Restrictedor have@since TODOJavadocs, as appropriate.@Deprecated(since = "TODO")or@Deprecated(forRemoval = true, since = "TODO"), if applicable.evalto ease future introduction of Content Security Policy (CSP) directives (see documentation).Desired reviewers
@mention
Before the changes are marked as
ready-for-merge:Maintainer checklist
upgrade-guide-neededlabel is set and there is a Proposed upgrade guidelines section in the pull request title (see example).lts-candidateto be considered.