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'}) }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter