Skip to content

Instantly share code, notes, and snippets.

@macdonst
Created April 23, 2024 20:43
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 macdonst/1a5e9225bdcd6b8d4ae0a78e490f60ba to your computer and use it in GitHub Desktop.
Save macdonst/1a5e9225bdcd6b8d4ae0a78e490f60ba to your computer and use it in GitHub Desktop.
function isNakedDay() {
const now = new Date();
const year = now.getFullYear();
const start = new Date(year, 3, 24, -14, 0, 0).getTime() / 1000;
const end = new Date(year, 3, 24, 36, 0, 0).getTime() / 1000;
const z = now.getTimezoneOffset() * 60;
const currentTime = now.getTime() / 1000 - z;
return currentTime >= start && currentTime <= end;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment