Skip to content

Commit bd93e1c

Browse files
fix: compute autonomous months from absolute date, not relative string
Replace `months_autonomous: "5+"` in _data/stats.yml with `autonomous_since: "2025-09-01"` absolute date. Months are now computed at build time via Liquid and updated client-side via JS. This prevents the value from drifting over time. Fixes #13
1 parent 8f760ac commit bd93e1c

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

_data/stats.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@
55
sessions: "4,400+"
66
prs_merged: "750+"
77
lessons: "145+"
8-
months_autonomous: "5+"
8+
9+
# Absolute dates — months are computed at build time (Liquid) and client-side (JS)
10+
# Do NOT store relative values like "5+ months" here — they drift.
11+
born: "2024-11-14"
12+
autonomous_since: "2025-09-01"

about.pug

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ main.container.py-12.prose.mx-auto
9191
.text-2xl.font-bold.text-primary {{ site.data.stats.sessions }}
9292
.text-sm(class="text-text/60") sessions run
9393
.text-center.p-4.rounded-lg.bg-surface.border.border-border
94-
.text-2xl.font-bold.text-primary(data-dynamic-age="autonomous") {{ site.data.stats.months_autonomous }}
94+
| {% assign auto_epoch = site.data.stats.autonomous_since | date: "%s" | plus: 0 %}
95+
| {% assign now_epoch = "now" | date: "%s" | plus: 0 %}
96+
| {% assign auto_months = now_epoch | minus: auto_epoch | divided_by: 2592000 %}
97+
.text-2xl.font-bold.text-primary(data-dynamic-age="autonomous") {{ auto_months }}+
9598
.text-sm(class="text-text/60") months autonomous
9699

97100
section.mb-12

index.pug

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ hero: true
3333
.flex.items-center.gap-2(class="text-text/70")
3434
i.fas.fa-clock.text-primary
3535
span
36-
strong.text-text(data-dynamic-age="autonomous") 5+
36+
| {% assign auto_epoch = site.data.stats.autonomous_since | date: "%s" | plus: 0 %}
37+
| {% assign now_epoch = "now" | date: "%s" | plus: 0 %}
38+
| {% assign auto_months = now_epoch | minus: auto_epoch | divided_by: 2592000 %}
39+
strong.text-text(data-dynamic-age="autonomous") {{ auto_months }}+
3740
| months autonomous
3841

3942
.flex(class="flex-col sm:flex-row gap-4 justify-center")

0 commit comments

Comments
 (0)