`{n}` path token uses the server time zone and renders `NaN` when no database is configured

Open
#1,026 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
javascript, node.js
Domain
backend, databases

Research direction

Start with endpoint-micropub/lib/utils.js around lines 76–84 and post-type-count.js around line 20; compare how {n} derives its date window with the sibling date tokens, and check the referenced issues #861 and #502 for prior decisions. Reproduce the timezone split and the missing database case. Done means {n} is consistent with the sibling path tokens and does not render NaN; the issue leaves the preferred date-range approach open for discussion.

Written by the indexing model from the issue text.

Description

endpoint-micropub/lib/utils.js:76 passes timeZone to getDateTokenValues; :83 doesn't
pass it to postTypeCount.get(), so post-type-count.js:20 derives the day from
toDateString(). For a post stored 2026-10-10T23:30:00+02:00:

TZ window queried (UTC)
UTC 2026-10-10T00:00 .. 2026-10-11T00:00
Europe/Brussels 2026-10-09T22:00 .. 2026-10-10T22:00

Two posts written on the author's own 10 October (00:30+02:00, 23:30+02:00) count together
under Europe/Brussels but split under UTC — both numbered 1, paths collide. Default
containers run UTC, so {n} disagrees with every date token beside it. Looks like #861
(beda3c02) in the one place it didn't reach.

Separately, utils.js:84 does tokens.n = count + 1 on the undefined that
postTypeCount.get() returns by design (#502, 71705df4), giving
2026/10/10/test-NaN.md.

Fixing the first means deciding what "the same day" is. Defining it as the day the sibling
path tokens already render would make this a string range on properties.published and
remove the aggregation — without normalising stored dates to Z, which would undo #280/#287.
Is that the direction you'd want?

Dominant language
JavaScript
Stars
392
Forks
39
Avg merge
22h 29m
Merged PRs (30d)
25

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from getindiekit/indiekit

All issues in getindiekit/indiekit

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.