fix: hermes journey crashes on Windows due to %-d strftime directive

`_period_label()` in `learning_graph_render.py` used `%-d %b`
strftime, which is a Linux-only format — the `%-` prefix for
zero-padding suppression doesn't exist on Windows `strftime`, causing
`ValueError: Invalid format string` on `hermes journey`.

Fix by using `dt.day` directly (an integer, no zero-padding by
default) combined with `strftime('%b')` for the month. This is
cross-platform and produces identical output.

Reproduced and tested on Windows 10 with Hermes v0.18.0.
This commit is contained in:
wyuebei-cloud 2026-07-01 14:24:38 -07:00 committed by Teknium
parent e4da3a7a52
commit ce82b0c3cf

View file

@ -255,7 +255,7 @@ def _period_key(ts: float, granularity: str) -> tuple[int, ...]:
def _period_label(ts: float, granularity: str) -> str:
dt = datetime.fromtimestamp(ts, tz=timezone.utc)
if granularity == "day":
return dt.strftime("%-d %b")
return f"{dt.day} {dt.strftime('%b')}"
if granularity == "month":
return dt.strftime("%b %Y")
return dt.strftime("%Y")