Created
November 11, 2018 07:41
-
-
Save gcoda/37d44921ddd4374219752fbbdc899d1f to your computer and use it in GitHub Desktop.
simplistic date format
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
dateFormat(input) { | |
const date = new Date(input) | |
const timeString = date.toLocaleTimeString(['uk-UA'],{ | |
hour12: false, | |
hour: '2-digit', | |
minute: '2-digit' | |
}) | |
const dateString = date | |
.toLocaleDateString(['uk-UA'], { | |
month: '2-digit', | |
day: '2-digit', | |
// year: 'numeric', // '2-digit' | |
}) | |
.split('.') | |
.reverse() | |
.join('.') | |
return `${dateString} ${timeString}` | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment