It can change mid-sort causing the sorting results to be inconsistent,
which will crash many implementations of std::stable_sort.
Also, fix an issue where it kept resorting after it didn't need to and
make it strictly ordered for equal dates/sizes.
Fixes#11892.