var dayjs = require("dayjs")
let n = [ '2018-10-05T10:30:00',
'2018-10-05T08:05:00',
'2018-10-05T08:20:00',
'2018-10-05T08:30:00',
'2018-10-05T10:10:00',
'2018-10-05T10:30:00',
'2018-10-05T11:15:00',
'2018-10-05T11:25:00',
'2018-10-05T12:00:00',
'2018-10-05T17:10:00',
'2018-10-05T22:05:00' ]
console.log(n.sort((a, b) => (dayjs(a).isAfter(dayjs(b)) ? 1 : -1)))
Created
September 29, 2024 10:46
-
-
Save MirzaLeka/b94e66cb91f3b20b62c5b9f8a6fb3a60 to your computer and use it in GitHub Desktop.
Dayjs sort by Date
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment