Correct Date Sorter utility.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user