[object Object]

← back to build-pages

home: today-PT counter (Steve's calendar day, not rolling-24h) + 1 smoke

b709184bcdd968175c86d1e07c76082f50e05f03 · 2026-05-13 20:12:06 -0700 · SteveStudio2

Files touched

Diff

commit b709184bcdd968175c86d1e07c76082f50e05f03
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Wed May 13 20:12:06 2026 -0700

    home: today-PT counter (Steve's calendar day, not rolling-24h) + 1 smoke
---
 server.js     | 17 ++++++++++++++++-
 test/smoke.js |  1 +
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/server.js b/server.js
index 51fd076..e5be0b0 100644
--- a/server.js
+++ b/server.js
@@ -354,6 +354,21 @@ app.get('/', async (req, res, next) => {
     // Velocity counters + 7-day sparkline across the whole fleet. Concats
     // per-project commit lists so the helper sees every commit in one shot.
     const fleetCommits = entries.flatMap(e => _projectCache.get(e.slug)?.commits || []);
+    // Today-in-PT count — server.tz-aware calendar boundary (Steve's day).
+    const todayPT = (() => {
+      const todayStr = new Date().toLocaleString('sv-SE', { timeZone: 'America/Los_Angeles' }).slice(0, 10);
+      const probe = new Date(`${todayStr}T00:00:00Z`);
+      const fmt = probe.toLocaleString('sv-SE', { timeZone: 'America/Los_Angeles', hour12: false }).slice(0, 19).replace(' ', 'T');
+      const fromTz = new Date(fmt).getTime();
+      const startMs = probe.getTime() + (probe.getTime() - fromTz);
+      const endMs = startMs + 86400000;
+      let n = 0;
+      for (const c of fleetCommits) {
+        const t = new Date(c.dateISO).getTime();
+        if (t >= startMs && t < endMs) n++;
+      }
+      return { date: todayStr, count: n };
+    })();
     const fleetSpark = sparkline(fleetCommits);
     const sparkChars = fleetSpark.spark;
     const dayBuckets = fleetSpark.buckets;
@@ -403,7 +418,7 @@ app.get('/', async (req, res, next) => {
       <h1>build journals</h1>
       <p class="bp-lede">Every build, every commit, every line. Click into a project to see how it actually got made.</p>
       <p class="bp-meta">${entries.length} projects · ${totalCommits} commits · ${totalIdeas} design-rationale ideas surfaced</p>
-      <p class="bp-meta">velocity: <strong>${last24}</strong> commits in the last 24h · <strong>${last7d}</strong> in the last 7 days · 7-day shape <code class="bp-spark" title="${dayBuckets.join(' / ')}">${sparkChars}</code> · ${(() => {
+      <p class="bp-meta">today (PT ${todayPT.date}): <strong>${todayPT.count}</strong> commits · velocity: <strong>${last24}</strong> in last 24h · <strong>${last7d}</strong> in last 7d · 7-day shape <code class="bp-spark" title="${dayBuckets.join(' / ')}">${sparkChars}</code> · ${(() => {
         const [l1] = require('os').loadavg();
         const cls = l1 < 8 ? 'bp-load-ok' : l1 < 20 ? 'bp-load-warn' : 'bp-load-hot';
         return `host load <span class="bp-load ${cls}">${l1.toFixed(1)}</span> (1m)`;
diff --git a/test/smoke.js b/test/smoke.js
index cbf11f4..f88d1c2 100644
--- a/test/smoke.js
+++ b/test/smoke.js
@@ -100,6 +100,7 @@ function check(name, cond, hint = '') {
   check('home: load badge',        /class="bp-load (bp-load-ok|bp-load-warn|bp-load-hot)"/.test(r.body));
   check('home: 7-day sparkline',   /class="bp-spark"/.test(r.body));
   check('home: deepest rationale rail', /Deepest rationale/.test(r.body));
+  check('home: today PT counter', /today \(PT \d{4}-\d{2}-\d{2}\): <strong>\d+<\/strong>/.test(r.body));
   check('home: canonical',         /rel="canonical"/.test(r.body));
   check('home: og:title',          /property="og:title"/.test(r.body));
   check('home: WebSite JSON-LD',   /"@type":"WebSite"/.test(r.body));

← 1db956d api/fleet/today: default to America/Los_Angeles (Steve's tz)  ·  back to build-pages  ·  refactor: extract startOfDayInTz + todayInTz helpers — DRY t b57cacd →