Move makeLastUpdatedFriendly into parse-date

This commit is contained in:
Sam Carlton 2021-03-06 21:40:52 -06:00
parent b4f2be414f
commit 86f61b1251
2 changed files with 13 additions and 9 deletions

View file

@ -20,6 +20,17 @@ const getRelativeTime = function (d1, d2 = new Date()) {
}
export function makeLastUpdatedFriendly ( lastUpdated ) {
if ( !lastUpdated ) return null
const options = { month: "long", day: "numeric", year: "numeric" }
const date = new Date( lastUpdated.raw )
const americanDate = new Intl.DateTimeFormat("en-US", options).format(date)
return americanDate
}
export default function (rawDate) {
const date = new Date(rawDate)