I am working with an API that only provides a UTC date/time as it's publishedDate
. I want to convert that field into a specific date format, for example, d-m-Y
or H:i
. An example API field would be.
{
"title": "This is a title"
"thumbnail": "/path/to/image.jpg"
"slug": "slug-of-story"
"publishedDate": "2019-07-02T13:38:15.215Z"
}
Is there a way in vanilla javascript I can convert this value into a human readable date format that I specify?
I am using VueJS to render the API fields so I can attach a method to this specific field during the rendering phase. However, I am keen not use momentJS
as I don't want to introduce a dependency for one JSON field.