Skip to content

Add ISO week number tokens to the clock format#143

Merged
danielchalmers merged 3 commits into
masterfrom
claude/xenodochial-gates-d92ba5
Jul 6, 2026
Merged

Add ISO week number tokens to the clock format#143
danielchalmers merged 3 commits into
masterfrom
claude/xenodochial-gates-d92ba5

Conversation

@danielchalmers

@danielchalmers danielchalmers commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Adds {week} (ISO 8601 week number) and {weekYear} (ISO week-numbering year) as custom clock format tokens, so formats like Week {week} or {weekYear}-W{week} work in the clock display.

Supersedes #130 (thanks @spacevortex2435 for the groundwork! token names and several test cases carry over):

  • The ISO week math lives in DateTimeUtil as documented extension methods instead of private helpers inside the tokenizer (ISOWeek isn't available on .NET Framework, so it's hand-rolled with the same semantics).
  • The tokens are discoverable: a Week number insert button in the inline format editor (Add inline format editor for clock and countdown #140) and examples in the format list.
  • A countdown format using {week} shows the standard "Bad format" error instead of throwing, with a test covering it.

Details

  • Week numbers respect the selected time zone since conversion happens before formatting (test included).
  • Number output uses the active format provider like every other token.
  • Around New Year, {weekYear} differs from {yyyy} per ISO 8601 — e.g. Dec 30, 2024 is 2025-W1.

Closes #130
Closes #107
Closes #78

image

{week} inserts the ISO 8601 week number and {weekYear} the matching
week-numbering year. The week math lives in DateTimeUtil because
System.Globalization.ISOWeek isn't available on .NET Framework.

Closes #107
Closes #78
Signed-off-by: Daniel Chalmers <daniel.chalmers@outlook.com>
@danielchalmers danielchalmers added the enhancement New feature or request label Jul 6, 2026
@danielchalmers danielchalmers merged commit 6c72569 into master Jul 6, 2026
4 checks passed
@danielchalmers danielchalmers deleted the claude/xenodochial-gates-d92ba5 branch July 6, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support week number in clock format Request: ISO week number

1 participant