Created
August 19, 2022 09:25
-
-
Save ramirezsandin/907b599eef2b2d495985201ae05d2ff6 to your computer and use it in GitHub Desktop.
Helper funcctions to work with dates
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 formatToHTMLInput = (date: Date) => { | |
const year = date.getFullYear(); | |
const month = date.getMonth(); | |
const day = date.getDate(); | |
return `${year}-${`0${month}`.slice(-2)}-${`0${day}`.slice(-2)}`; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment