Correct Date Sorter utility.

This commit is contained in:
Patrick Fic
2021-04-27 19:12:23 -07:00
parent 87b5814630
commit 2cff5417b8

View File

@@ -1,11 +1,5 @@
import moment from "moment";
export function alphaSort(a, b) {
let A;
let B;
A = a ? a.toLowerCase() : "";
B = b ? b.toLowerCase() : "";
return A.localeCompare(B);
return (a ? a.toLowerCase() : "").localeCompare(b ? b.toLowerCase() : "");
// if (A < B)
// //sort string ascending
@@ -15,11 +9,5 @@ export function alphaSort(a, b) {
}
export function dateSort(a, b) {
return moment(a).isBefore(moment(b));
// if (A < B)
// //sort string ascending
// return -1;
// if (A > B) return 1;
// return 0; //default return value (no sorting)
return new Date(b) - new Date(a);
}