@ascentgl/ads-ui 21.86.0 → 21.87.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7555,7 +7555,18 @@ class AdsColumnSortFilterMenuComponent {
|
|
|
7555
7555
|
};
|
|
7556
7556
|
});
|
|
7557
7557
|
// Apply sort order to filter options (default: ascending)
|
|
7558
|
-
|
|
7558
|
+
const isDateSort = this.config.sortType === 'date';
|
|
7559
|
+
if (isDateSort) {
|
|
7560
|
+
// For date columns, sort by the raw value (ISO string or date-only string)
|
|
7561
|
+
// so that chronological order is preserved regardless of display format (e.g. MM/DD/YYYY).
|
|
7562
|
+
options.sort((a, b) => {
|
|
7563
|
+
const aTime = new Date(String(a.rawValue ?? '')).getTime();
|
|
7564
|
+
const bTime = new Date(String(b.rawValue ?? '')).getTime();
|
|
7565
|
+
const diff = aTime - bTime;
|
|
7566
|
+
return this.config.filterOptionsSortOrder === 'desc' ? -diff : diff;
|
|
7567
|
+
});
|
|
7568
|
+
}
|
|
7569
|
+
else if (this.config.filterOptionsSortOrder === 'desc') {
|
|
7559
7570
|
options.sort((a, b) => b.label.localeCompare(a.label));
|
|
7560
7571
|
}
|
|
7561
7572
|
else {
|
|
@@ -7963,8 +7974,19 @@ class AdsFilterMenuComponent {
|
|
|
7963
7974
|
const label = formatter ? formatter(rawValue) : String(rawValue ?? '');
|
|
7964
7975
|
unsortedEntries.push([key, label]);
|
|
7965
7976
|
});
|
|
7966
|
-
// Sort entries by label according to filterOptionsSortOrder (default: ascending)
|
|
7967
|
-
|
|
7977
|
+
// Sort entries by label according to filterOptionsSortOrder (default: ascending).
|
|
7978
|
+
// For date columns, sort chronologically by the raw ISO key instead of the
|
|
7979
|
+
// formatted MM/DD/YYYY label (which would sort lexicographically and produce wrong order).
|
|
7980
|
+
const isDateSort = config.sortType === 'date';
|
|
7981
|
+
if (isDateSort) {
|
|
7982
|
+
unsortedEntries.sort((a, b) => {
|
|
7983
|
+
const aTime = new Date(a[0]).getTime();
|
|
7984
|
+
const bTime = new Date(b[0]).getTime();
|
|
7985
|
+
const diff = aTime - bTime;
|
|
7986
|
+
return config.filterOptionsSortOrder === 'desc' ? -diff : diff;
|
|
7987
|
+
});
|
|
7988
|
+
}
|
|
7989
|
+
else if (config.filterOptionsSortOrder === 'desc') {
|
|
7968
7990
|
unsortedEntries.sort((a, b) => b[1].localeCompare(a[1]));
|
|
7969
7991
|
}
|
|
7970
7992
|
else {
|