import moment from 'moment';
const datesArr = ['2020-03-01', '2020-01-10', '2020-02-07'];
const result = datesArr.sort((d1, d2) => moment(d1) - moment(d2));
console.log(result); // asc sort
Created
June 9, 2020 15:31
-
-
Save anuk79/4c180dc44b09776ef26d3dac4c1db2d4 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment