Last active
June 16, 2020 00:41
-
-
Save troy0820/36a2d2da5adfb899d1e4af612530ef72 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 announcementTime = new Date() | |
const tooEarly = new Date("2020-02-24T04:30:00.001Z") | |
console.log(formatTime(announcementTime, tooEarly)) | |
function formatTime(announcementTime, tooEarly) { | |
const formattedTime = new Date(tooEarly.getTime() + announcementTime.getTimezoneOffset() * 60 * 1000) | |
return `At ${announcementTime} Steve said that ${formattedTime.getHours()}:${formattedTime.getMinutes()} is to early`; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment