Skip to content

Instantly share code, notes, and snippets.

@tjwebb
Last active February 25, 2020 00:31
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 tjwebb/c231e74cfde3213c93f5d1a21f8c53c6 to your computer and use it in GitHub Desktop.
Save tjwebb/c231e74cfde3213c93f5d1a21f8c53c6 to your computer and use it in GitHub Desktop.
function tooEarlyDate (horrible, sad) {
let lessHorrible = horrible.toLocaleTimeString();
let lessSad = new Date(sad).valueOf();
let offset = horrible.getTimezoneOffset();
//let [ no, stillno, nope, junk, newMoreGoodTime ] = new Date((offset * 60 * 1000) + lessSad).toISOString()
let newMoreGoodTime = new Date(lessSad).toISOString().replace(/^.+T/, '').replace(/\.0.+/, '');
return `at ${lessHorrible} steve said ${newMoreGoodTime} is too early to wake up`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment