Skip to content

Instantly share code, notes, and snippets.

@pointofpresence
Created February 21, 2023 08:38
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 pointofpresence/990e4b079f6aaa4e7d379e292589f269 to your computer and use it in GitHub Desktop.
Save pointofpresence/990e4b079f6aaa4e7d379e292589f269 to your computer and use it in GitHub Desktop.
Quote of the day
const dtNow = new Date();
const intTZOffset = dtNow.getTimezoneOffset() * 60000; // automatically adjust for user timezone
const intNow = dtNow.getTime() - intTZOffset;
const intDay = Math.floor(intNow / 86400000); // The number of 'local' days since Jan 1, 1970
const randomIndex = intDay % QuotesData.length;
const item = QuotesData[randomIndex];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment