
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>
);
}
How to Install
- Install the Datacore community plugin
- Add the VaultHub widgets CSS snippet to
.obsidian/snippets/and enable it - Copy the code block on this page into any note