Vue Date Filter

PHOTO EMBED

Tue Dec 15 2020 00:52:18 GMT+0000 (Coordinated Universal Time)

Saved by @robertjbass #javascript

export default (value) => {
  const date = new Date(value)
  if (!value) return ""
  else return date.toLocaleString(['en-US'], {month: 'short', day: '2-digit', year: 'numeric'})

  // THE DATE MAY BE OFF DUE TO TIME ZONES - USE toLocaleDateString and add a timezone to prevent that
  // as long as time isn't being used, this is the better option:
  return date.toLocaleDateString(['en-US'], {month: 'short', day: '2-digit', year: 'numeric', timeZone: 'UTC'})

}
content_copyCOPY

ProjectNext.app

https://stackoverflow.com/questions/32877278/tolocaledatestring-is-subtracting-a-day/32877402