#866·fonoster

Log timestamps show weekday number instead of day-of-month (YYYY-MM-dd should be YYYY-MM-DD)

Author: psandersCreated Jul 22, 2026Updated Jul 22, 2026

Summary

The Winston timestamp format string in @fonoster/logger uses lowercase dd instead of uppercase DD. In fecha/winston date tokens, lowercase dd renders the day-of-week (0–6), while uppercase DD renders the day-of-month. As a result, every log line's date is wrong — the "day" portion is actually the weekday index, not the calendar day.

Location

getLogger.js (compiled output; source is presumably a .ts file that compiles to this dist):

javascript
const humanFormat = winston_1.default.format.combine(winston_1.default.format.timestamp({
    format: "YYYY-MM-dd HH:mm:ss.SSS"
}), ...

The format string is "YYYY-MM-dd HH:mm:ss.SSS" — note the lowercase dd.

Impact

Purely cosmetic in log output. It does not affect Date.now(), event timestamps, database writes, or scheduling — only the human-readable log line's rendered date is wrong. However, it makes log dates misleading and makes log-by-date filtering/grepping unreliable.

Evidence (observed)

A running process whose new Date() and the OS date command both correctly returned 2026-07-22 emitted log lines dated 2026-07-03. This rules out a clock issue: the same process, at the same instant, wrote a DB row timestamped 2026-07-22T00:32:59 while the log line for that same event read 2026-07-03 00:32:59 — identical time-of-day, different date. 03 is a Wednesday (weekday index 3), which is exactly what lowercase dd renders for July 22, 2026. Restarting the process on a different day of the week changed the bogus "day" value accordingly, confirming it tracks weekday, not day-of-month.

Fix

Change the format string from:

YYYY-MM-dd HH:mm:ss.SSS

to:

YYYY-MM-DD HH:mm:ss.SSS

A one-character-per-token change (lowercase dd → uppercase DD).