mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-19 19:25:51 +00:00
Compare commits
1 Commits
31ff09c093
...
events-upd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09b1a8401d |
@@ -26,8 +26,8 @@ export const frontmatter = {
|
|||||||
};
|
};
|
||||||
export const sortEvents = (arr, asc = true) => {
|
export const sortEvents = (arr, asc = true) => {
|
||||||
return arr.sort((a, b) => {
|
return arr.sort((a, b) => {
|
||||||
const dateA = moment(a.end_date, "MMMM D, YYYY");
|
const dateA = moment(a.date, "MMMM D, YYYY");
|
||||||
const dateB = moment(b.end_date, "MMMM D, YYYY");
|
const dateB = moment(b.date, "MMMM D, YYYY");
|
||||||
return asc ? dateB.diff(dateA) : dateA.diff(dateB); // Returns a negative value if dateA is before dateB, positive if after, and 0 if the same
|
return asc ? dateB.diff(dateA) : dateA.diff(dateB); // Returns a negative value if dateA is before dateB, positive if after, and 0 if the same
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user