Day, Week, Month, Year Progress
WIDGETDASHBOARD
maws7140

Day, Week, Month, Year Progress

Four progress bars showing how far through the day, week, month and year you are.

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 MultiProgress() {
    const now = new Date();
    const dPct = ((now.getHours() * 3600 + now.getMinutes() * 60) / 86400 * 100).toFixed(0);
    const dayOfWeek = now.getDay() || 7;
    const wPct = ((dayOfWeek - 1) / 7 * 100).toFixed(0);
    const daysInMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0).getDate();
    const mPct = ((now.getDate() / daysInMonth) * 100).toFixed(0);
    const start = new Date(now.getFullYear(), 0, 1);
    const yPct = (((now - start) / (365.25 * 86400000)) * 100).toFixed(0);

    const rows = [
        { label: 'DAY', val: dPct },
        { label: 'WEEK', val: wPct },
        { label: 'MONTH', val: mPct },
        { label: 'YEAR', val: yPct }
    ];

    return (
        <div className="vh-widget vh-multi-progress">
            {rows.map(r => (
                <div key={r.label} className="vh-mp-row">
                    <div className="vh-mp-label">{r.label}</div>
                    <div className="vh-mp-track"><div className="vh-mp-fill" style={{ width: `${r.val}%` }}></div></div>
                    <div className="vh-mp-val">{r.val}%</div>
                </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

vaulthubprogresstime