From dca5335f9ab64579412aa5861ad5ffa4f754b33b Mon Sep 17 00:00:00 2001 From: Misaka_Company Date: Thu, 18 Jun 2026 10:28:12 +0800 Subject: [PATCH] Localize antd DatePicker to Chinese via ConfigProvider Adds a Providers client component that wraps the app in ConfigProvider locale=zhCN and sets dayjs zh-cn locale, so the date-filter RangePicker shows Chinese weekdays/months (and other antd components localize too). Framework-native; no custom control. Not deployed. Co-Authored-By: Claude --- src/app/layout.tsx | 5 ++++- src/app/providers.tsx | 13 +++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/app/providers.tsx diff --git a/src/app/layout.tsx b/src/app/layout.tsx index be8190d..bf5e23d 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,5 +1,6 @@ import type { Metadata } from "next"; import "./globals.css"; +import { Providers } from "./providers"; export const metadata: Metadata = { title: "Web Table - 压力表合同生产数据", @@ -13,7 +14,9 @@ export default function RootLayout({ }>) { return ( - {children} + + {children} + ); } diff --git a/src/app/providers.tsx b/src/app/providers.tsx new file mode 100644 index 0000000..8113150 --- /dev/null +++ b/src/app/providers.tsx @@ -0,0 +1,13 @@ +"use client"; + +import { ConfigProvider } from "antd"; +import zhCN from "antd/locale/zh_CN"; +import dayjs from "dayjs"; +import "dayjs/locale/zh-cn"; + +// antd v6 DatePicker 基于 dayjs;设置 dayjs 中文 locale 后,日期面板的月份/星期才会显示中文。 +dayjs.locale("zh-cn"); + +export function Providers({ children }: { children: React.ReactNode }) { + return {children}; +}