Skip to content

Instantly share code, notes, and snippets.

@sunnymui
Created March 3, 2022 18:13
Show Gist options
  • Save sunnymui/5b714a45e3170c729c38006d7014ffbd to your computer and use it in GitHub Desktop.
Save sunnymui/5b714a45e3170c729c38006d7014ffbd to your computer and use it in GitHub Desktop.
Get the Day of the Week for a Time Zone
const getDayOfWeek = () => {
// uses the date object and the browser time to get the day of week name
// ie "Monday", etc, uses timezone iana formats from http://www.iana.org/time-zones
const options = { weekday: 'long', timeZone: 'Pacific/Honolulu' };
return new Date().toLocaleDateString('en-us', options)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment