Created
February 25, 2020 00:13
-
-
Save msucorey/f1488357dd9440c87c4a01e64180c9b9 to your computer and use it in GitHub Desktop.
Challenge for Feb 2020 Sharpen Your Saw
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 dateTranslate = (annTimeUtc, tooEarlyTimeUtc) => { | |
const time = new Date(); | |
const annTime = annTimeUtc.toTimeString().slice(0,5).split(':').join(''); | |
const tooEarlyTime = tooEarlyTimeUtc.toTimeString().slice(0,5).split(':').join('') | |
const timeZoneOffset = time.getTimezoneOffset() | |
const correctedTime = tooEarlyTime - timeZoneOffset / 60; | |
return `At ${annTime}, Steve said that ${correctedTime} was too early to get up`; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bah! Realizing my math's wrong here. Hours are in the hundreds place and never coerced the string to begin with. That's what happen when you don't test!