Created
November 12, 2021 21:05
-
-
Save webinista/c210a5677735a4d6359037d9c95ba03b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const formatDate = ( dateStr ) => { | |
let returned = ''; | |
if( 'Intl' in window ) { | |
const dateObj = new Date( dateStr ); | |
const options = { | |
month: 'long', | |
timeZone: 'America/Los_Angeles', | |
day: 'numeric', | |
year: 'numeric' | |
}; | |
let dte = new Intl.DateTimeFormat( 'en-US', options ).format( dateObj ); | |
returned = dte; | |
} | |
return returned; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment