Skip to content

Instantly share code, notes, and snippets.

@mirojones
Last active May 5, 2025 09:44
Show Gist options
  • Save mirojones/c1292a890f73ebb7657598aaaa3f1c88 to your computer and use it in GitHub Desktop.
Save mirojones/c1292a890f73ebb7657598aaaa3f1c88 to your computer and use it in GitHub Desktop.
Minimal clock app

A minimal clock web app designed to minimise file size and maximise performance.

Features:

  • Automatically set locale based on user preference
  • Device UI sans-serif font
  • Disable selection of display, to prevent immediate automatic deselection
  • Centred display
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Clock</title></head><body><div id="e" style="-webkit-user-select:none;user-select:none;font:3em ui-sans-serif,sans-serif;position:absolute;top:0;left:0;display:flex;width:100vw;height:100dvh;justify-content:center;align-items:center;"></div><script>const e=document.getElementById("e");var f=new Intl.DateTimeFormat(undefined,{timeStyle:"medium"});function t(){e.innerText=f.format(new Date());requestAnimationFrame(t)}t();</script></body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment