Created
June 26, 2020 12:34
-
-
Save velotiotech/bf8508c9de1121e5aa66064945884799 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
export const formatDate = (date) => { | |
var d = new Date(date), | |
month = '' + (d.getMonth() + 1), | |
day = '' + d.getDate(), | |
year = d.getFullYear(); | |
if (month.length < 2) | |
month = '0' + month; | |
if (day.length < 2) | |
day = '0' + day; | |
return [year, month, day].join('-'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment