Skip to content

Instantly share code, notes, and snippets.

@msucorey
Created February 25, 2020 00:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msucorey/f1488357dd9440c87c4a01e64180c9b9 to your computer and use it in GitHub Desktop.
Save msucorey/f1488357dd9440c87c4a01e64180c9b9 to your computer and use it in GitHub Desktop.
Challenge for Feb 2020 Sharpen Your Saw
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`;
}
@msucorey
Copy link
Author

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!

@msucorey
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment