Created
July 5, 2022 14:19
-
-
Save muhrusdi/b9b5ba5af808e2603a9ce29558cdab66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const months = useMemo(() => { | |
return new Array(12).fill(null).map((n, i) => { | |
return format(new Date(new Date().getFullYear(), i), "MMM") | |
}) | |
}, []) | |
const years = useMemo(() => { | |
const y = new Array(10).fill(null) | |
const min = new Date().getFullYear() - y.length | |
return y | |
.map((n, i) => { | |
return format(new Date(min + i + 1, i), "yyyy") | |
}) | |
.reverse() | |
}, []) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment