Year Progress Bar
WIDGETDASHBOARD
maws7140

Year Progress Bar

How much of the year has passed, with days gone and days left.

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 YearProgressBar() {
    const now = new Date();
    const year = now.getFullYear();
    const start = new Date(year, 0, 1);
    const end = new Date(year + 1, 0, 1);
    const totalDays = (end - start) / (1000 * 60 * 60 * 24);
    const passedDays = Math.floor((now - start) / (1000 * 60 * 60 * 24));
    const leftDays = Math.ceil(totalDays - passedDays);
    const pct = ((passedDays / totalDays) * 100).toFixed(1);

    return (
        <div className="vh-widget vh-progress-widget">
            <div className="vh-prog-header">
                <span className="vh-prog-title">{year} PROGRESS</span>
                <span className="vh-prog-percent">{pct}%</span>
            </div>
            <div className="vh-prog-bar-track">
                <div className="vh-prog-bar-fill" style={{ width: `${pct}%` }}></div>
            </div>
            <div className="vh-prog-footer">
                <span>{passedDays} days passed</span>
                <span>{leftDays} days remaining</span>
            </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

Tags

vaulthubprogresstimeyear