Skip to content

[fix](doc) week/weekofyear: backport zh-only examples to en; fix zh typo using 2023 twice#3817

Open
boluor wants to merge 1 commit into
apache:masterfrom
boluor:fix/week-weekofyear-en-backport
Open

[fix](doc) week/weekofyear: backport zh-only examples to en; fix zh typo using 2023 twice#3817
boluor wants to merge 1 commit into
apache:masterfrom
boluor:fix/week-weekofyear-en-backport

Conversation

@boluor
Copy link
Copy Markdown
Contributor

@boluor boluor commented May 26, 2026

Summary

Three changes across two date-time function pages.

EN `week.md` (+1 example)

`mode 7` — weeks start on Monday and week 1 is the week containing the first Monday. Because the first Monday of 2023 is January 2, `WEEK('2023-01-01', 7)` returns 52 (last week of 2022). ZH already had this example.

EN `weekofyear.md` (+3 examples)

SQL Returns Why interesting
`WEEKOFYEAR('2022-01-02')` 52 The week 2021-12-27 to 2022-01-02 has only 2 days in 2022, so it falls in week 52 of 2021
`WEEKOFYEAR('2023-12-25')` 52 The final week of 2023
`weekofyear('1023-01-04')` 1 Pre-modern year — the function does not enforce a minimum year

ZH already had analogues of these.

ZH `weekofyear.md` typo fix

The cross-year example's prose described the 2021-12-27..2022-01-02 week, but the SQL was `WEEKOFYEAR('2023-01-02')` and returned 1 — wrong week for the prose, and a duplicate of the example just above. Change the SQL and alias to `'2022-01-02'` / `week_20220102` so the example actually demonstrates what the comment says (returns 52).

Verification

```
mysql> SELECT WEEK('2023-01-01', 7); -- 52
mysql> SELECT WEEKOFYEAR('2022-01-02'); -- 52
mysql> SELECT WEEKOFYEAR('2023-12-25'); -- 52
mysql> SELECT weekofyear('1023-01-04'); -- 1
```

Test plan

  • All added examples verified on Apache Doris 4.1.1.
  • ZH weekofyear typo no longer duplicates the previous example.

🤖 Generated with Claude Code

…x zh typo using 2023 twice

Three changes across two date-time function pages:

EN week.md (+1 example): mode 7 — weeks start on Monday and week 1 is
the week containing the first Monday. Because the first Monday of
2023 is Jan 2, `WEEK('2023-01-01', 7)` returns 52 (last week of 2022).
ZH already had this example.

EN weekofyear.md (+3 examples): a 2022-01-02 cross-year case (the
week 2021-12-27 to 2022-01-02 has only 2 days in 2022, so it falls
in the last week of 2021); a 2023-12-25 case (the final week of
2023); and a pre-modern-date case showing the function does not
validate any minimum year. ZH already documented these.

ZH weekofyear.md typo fix: the cross-year example's prose described
the 2021-12-27..2022-01-02 week, but the SQL was
`WEEKOFYEAR('2023-01-02')` and returned 1 — that is the wrong week
for the prose, and it duplicates the previous example. Change the
SQL and alias to `'2022-01-02'` / `week_20220102` so the example
actually demonstrates what the comment says (returns 52).

Every added example was run against Apache Doris 4.1.1; the result
blocks are the verbatim mysql client output.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant