Skip to content

Instantly share code, notes, and snippets.

@iambriansreed
Last active February 25, 2020 00:17
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 iambriansreed/99683ba339a0653b0bcaa7302e887261 to your computer and use it in GitHub Desktop.
Save iambriansreed/99683ba339a0653b0bcaa7302e887261 to your computer and use it in GitHub Desktop.
function datesToLocalTime(...times){
const [announcementTimeStr, tooEarlyTimeStr] = times
.map((date) => date.toLocaleString().split(', ')[1].toLowerCase().replace(/:00/g, ''));
return `At ${announcementTimeStr} Steve said that ${tooEarlyTimeStr} is too early.`;
}
console.log(datesToLocalTime(
new Date('2020-03-08T19:47:00.000Z'),
new Date('2020-03-08T04:30:00.000Z')
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment