Repository navigation
最後更新日期改用台灣正體中文格式 - #206
Merged
Merged
最後更新日期改用台灣正體中文格式#206
Conversation
PageActions 的日期原本用 Intl.DateTimeFormat(undefined),語系與時區取決於 build 機器,正式站顯示成英文「Oct 7, 2026」。改用 config.locale(zh-TW)並 固定 Asia/Taipei 時區,顯示為「2026年10月7日」;標籤改為「最後更新」。 <time datetime>、JSON-LD dateModified 與 sitemap <lastmod> 原本就同一來源 (frontmatter lastUpdated → git),已確認三者一致。 Refs #36 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YTJrz2w5XhUwczB7J6RDij
shyuan
commented
Oct 30, 2026
shyuan
left a comment
Contributor
Author
There was a problem hiding this comment.
Code review 摘要
整體方向沒問題,沒有找到 bug。重點驗證結果:
- 輸出格式:實際以 Node 跑
Intl.DateTimeFormat("zh-TW", { year: "numeric", month: "long", day: "numeric", timeZone: "Asia/Taipei" }),輸出為2026年10月28日,與 PR 描述一致。 - date-only frontmatter 不受時區釘選影響:
lastUpdated: 2026-10-07這類值解析成 UTC 零點,在Asia/Taipei下格式化仍是同一天。只有 git 時間戳的顯示曆日會被釘到台北時間——這正是要修的 CI(UTC)不一致,行為符合預期。 - 型別與匯入模式:
config.locale型別為locale?: string(node_modules/@cloudflare/nimbus-docs/dist/types.d.ts:84),?? "zh-TW"型別合法;virtual module 的匯入方式與BaseLayout.astro、Header.astro等既有用法一致。<time datetime>仍是 ISO instant,JSON-LD / sitemap 語意不變。 - CI:Build、Code standards 目前全綠。
兩點非 bug 的提醒(inline 補充第一點):
?? "zh-TW"fallback 目前是防禦性的 dead code,且未來真的失效時行為是靜默退回英文,詳見 inline。- 本檔屬 Nimbus registry component:未來
bunx @cloudflare/nimbus-docs add page-actions --overwrite升級時會把語系釘選與「最後更新」標籤覆蓋回 upstream 版本。比照 repo 現有手改元件的做法,升級後記得重套。
「Copy page」「View as Markdown」英文按鈕 PR 已標註不在範圍,同意之後另開 issue 處理即可。
config.locale 由 schema 預設為 "en",原本的 ?? "zh-TW" 走不到;若 astro.config.ts 移除 locale,日期會靜默退回英文。本站只有 zh-TW,直接寫死。 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YTJrz2w5XhUwczB7J6RDij
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #36(Parent: #25)
變更
src/components/ui/page-actions/PageActions.astro:Intl.DateTimeFormat的語系固定為zh-TW,不再依 build 機器而定;正式站從「Oct 7, 2026」改為「2026年10月7日」。(不取config.locale:schema 預設為"en",若設定被移除會靜默退回英文。)timeZone: "Asia/Taipei"。CI 在 UTC 執行,台灣時間早上 8 點前的 commit 原本會顯示成前一天。時間來源一致性
<time datetime>、JSON-LDdateModified、sitemap<lastmod>原本就同一來源(frontmatterlastUpdated→ git),未改動。以/features/magicdns/實際 build 驗證,三者皆為2026-10-28T06:07:25.000Z。檢查
本機
lint、format:check、typecheck、build、lint:docs皆通過。不在範圍
「Copy page」「View as Markdown」按鈕文字仍為英文。
🤖 Generated with Claude Code
https://claude.ai/code/session_01YTJrz2w5XhUwczB7J6RDij