Created
March 3, 2022 18:13
-
-
Save sunnymui/5b714a45e3170c729c38006d7014ffbd to your computer and use it in GitHub Desktop.
Get the Day of the Week for a Time Zone
This file contains hidden or 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 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