Skip to content

Instantly share code, notes, and snippets.

@gcoda
Created November 11, 2018 07:41
Show Gist options
  • Save gcoda/37d44921ddd4374219752fbbdc899d1f to your computer and use it in GitHub Desktop.
Save gcoda/37d44921ddd4374219752fbbdc899d1f to your computer and use it in GitHub Desktop.
simplistic date format
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