Correct Date Sorter utility.
This commit is contained in:
@@ -1,11 +1,5 @@
|
|||||||
import moment from "moment";
|
|
||||||
export function alphaSort(a, b) {
|
export function alphaSort(a, b) {
|
||||||
let A;
|
return (a ? a.toLowerCase() : "").localeCompare(b ? b.toLowerCase() : "");
|
||||||
let B;
|
|
||||||
A = a ? a.toLowerCase() : "";
|
|
||||||
B = b ? b.toLowerCase() : "";
|
|
||||||
|
|
||||||
return A.localeCompare(B);
|
|
||||||
|
|
||||||
// if (A < B)
|
// if (A < B)
|
||||||
// //sort string ascending
|
// //sort string ascending
|
||||||
@@ -15,11 +9,5 @@ export function alphaSort(a, b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function dateSort(a, b) {
|
export function dateSort(a, b) {
|
||||||
return moment(a).isBefore(moment(b));
|
return new Date(b) - new Date(a);
|
||||||
|
|
||||||
// if (A < B)
|
|
||||||
// //sort string ascending
|
|
||||||
// return -1;
|
|
||||||
// if (A > B) return 1;
|
|
||||||
// return 0; //default return value (no sorting)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user