Retro Flip Clock
WIDGETDASHBOARD
maws7140

Retro Flip Clock

Live 12-hour flip clock with split tiles and seconds, rendered by Datacore.

What you need

  • The Datacore community plugin (Settings → Community plugins → Browse, search "Datacore").
  • The VaultHub widgets CSS snippet: download vaulthub-widgets.css, save it in your vault's .obsidian/snippets/ folder, then switch it on under Settings → Appearance → CSS snippets. One snippet styles every VaultHub widget.

Add it to a note

Paste the block below into any note. It renders in Live Preview and Reading view.

return function FlipClock() {
    const [time, setTime] = dc.useState(new Date());

    dc.useEffect(() => {
        const timer = setInterval(() => setTime(new Date()), 1000);
        return () => clearInterval(timer);
    }, []);

    let hrs = time.getHours();
    const ampm = hrs >= 12 ? 'PM' : 'AM';
    hrs = hrs % 12 || 12;
    const min = String(time.getMinutes()).padStart(2, '0');
    const sec = String(time.getSeconds()).padStart(2, '0');

    return (
        <div className="vh-widget vh-flip-clock">
            <div className="vh-clock-tile">{String(hrs).padStart(2, '0')}</div>
            <div className="vh-clock-sep">:</div>
            <div className="vh-clock-tile">{min}</div>
            <div className="vh-clock-sep">:</div>
            <div className="vh-clock-tile vh-tile-sec">{sec}</div>
            <div className="vh-ampm">{ampm}</div>
        </div>
    );
}

Related

How to Install

  1. Install the Datacore community plugin
  2. Add the VaultHub widgets CSS snippet to .obsidian/snippets/ and enable it
  3. Copy the code block on this page into any note

Required Plugins

Datacore

Categories

Tags

vaulthubclocktimehomepage