Skip to content

Add periodic-note formats: week/month/quarter/year granularity - #50

Merged
Amato21 merged 1 commit into
masterfrom
feature-periodic-note-formats
Jul 25, 2026
Merged

Add periodic-note formats: week/month/quarter/year granularity#50
Amato21 merged 1 commit into
masterfrom
feature-periodic-note-formats

Conversation

@Amato21

@Amato21 Amato21 commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #49. Implements the full ("option 2") scope: not just week formats (as proposed in the referenced upstream PR/issue), but week and month and quarter and year, with granularity detection built into the parser rather than a single hardcoded case.

New optional settings (Settings → Periodic notes), each empty/disabled by default:

  • weekFormat (e.g. GGGG-[W]WW)
  • monthFormat (e.g. YYYY-MM)
  • quarterFormat (e.g. YYYY-[Q]Q)
  • yearFormat (e.g. YYYY)

When an expression resolves to a whole period instead of a single day — @next week, @this quarter, @Q3, @Q3 2026, @2026-W02 — the corresponding format is used instead of the daily Date format, for linking to Periodic Notes-style weekly/monthly/quarterly/yearly notes. Leaving a field empty keeps existing behavior unchanged, including @next week's current behavior of inserting a link for every day of the week (backward compatible, opt-in).

Implementation

  • NLDParser.getParsedPeriod() (new): detects granularity via this/next/last week|month|quarter|year in all 12 languages (both word orders — French postposes the prefix, e.g. "la semaine prochaine") plus language-neutral explicit forms (Q3, Q3 2026, 2026-Q3, 2026-W02). Falls back to the existing getParsedDate() (day granularity) for everything else — the existing day-granularity path is untouched.
  • getParsedDateRange() now tags its existing "next week" result with granularity: "week", so getParseCommand() can prefer the single weekFormat value over the existing 7-day link list when configured, without changing that list's default behavior when weekFormat is empty.
  • Added a quarter vocabulary entry to all 12 language dictionaries (en/fr/es/it/de/pt/ru/uk/nl/ja/zh/ko).

Bugs found along the way (via empirical per-language verification)

Per this repo's CLAUDE.md rule ("verify empirically per language, not just read the code"), I wrote per-language regression tests for all 12 languages before considering this done — that caught two pre-existing gaps unrelated to the new feature itself:

  • French word order: "semaine prochaine" (noun-before-adjective, the natural French order) wasn't matched by a prefix-first-only regex. Fixed by trying both orders (mirrors the existing dual-order handling already used for the "next week" range and ordinal-of-month patterns).
  • Dutch grammar: next/last only had the common-gender forms ("volgende"/"vorige"), missing the neuter forms ("volgend"/"vorig", no final "-e") needed before neuter nouns like "jaar" and the newly-added "kwartaal". Added the missing forms.

Verification

  • 723/723 tests passing (139 new: per-language period-granularity tests × 12 languages, explicit Q3/2026-Q3/2026-W02 forms, parseDate() granularity-format integration, getParseCommand() week-format-vs-list-behavior, settings UI).
  • Confirmed each new regression test actually catches its bug via revert-test-restore (temporarily undid each fix, confirmed the corresponding tests failed, then restored).
  • npx tsc --noEmit, npx eslint, and npm run build all clean.
  • CHANGELOG.md, API.md, and README.md updated.

Generated by Claude Code

New optional settings (weekFormat/monthFormat/quarterFormat/yearFormat,
all empty/disabled by default): when an expression resolves to a whole
period instead of a single day -- "next week", "this quarter", "Q3",
"Q3 2026", "2026-W02" -- use that format (e.g. "GGGG-[W]WW", "YYYY-[Q]Q")
instead of the daily Date format, for linking to Periodic Notes-style
weekly/monthly/quarterly/yearly notes.

Parser: NLDParser.getParsedPeriod() detects granularity via
"this/next/last week|month|quarter|year" (both word orders -- French
postposes the prefix) plus language-neutral explicit Q3/2026-Q3/2026-W02
forms, falling back to getParsedDate() (day granularity) otherwise.
getParsedDateRange() tags its existing "next week" result with
granularity: "week" so getParseCommand() can prefer the single
weekFormat value over the existing 7-day link list when configured,
without touching that list's default behavior.

Added a "quarter" vocabulary entry to all 12 language dictionaries.
Verified empirically per language (not just combined), which caught two
pre-existing gaps along the way: French's noun-before-adjective order
("semaine prochaine") wasn't matched by the prefix-first regex, and
Dutch was missing the neuter grammatical forms ("volgend"/"vorig")
needed before "jaar"/the new "kwartaal".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011AnUmNKkH1y4ZAEPKF1WwQ
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@Amato21
Amato21 merged commit fc940b5 into master Jul 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Additional date formats when expanding dates

2 participants