diff --git a/frontend/src/components/birth-date-picker.tsx b/frontend/src/components/birth-date-picker.tsx
index 209f3e7a..42f1f9c3 100644
--- a/frontend/src/components/birth-date-picker.tsx
+++ b/frontend/src/components/birth-date-picker.tsx
@@ -1,10 +1,9 @@
"use client";
import { format } from "date-fns";
-import { zhCN as dateFnsZhCN } from "date-fns/locale";
+import { zhCN } from "date-fns/locale";
import { CalendarIcon } from "lucide-react";
import { useId, useState } from "react";
-import { zhCN } from "react-day-picker/locale";
import { Button } from "@/components/ui/button";
import { Calendar } from "@/components/ui/calendar";
@@ -17,8 +16,6 @@ type BirthDatePickerProps = {
readonly onChange: (value: string) => void;
};
-const emptyDefaultMonth = new Date(1997, 0, 1);
-
export function BirthDatePicker({ value, disabled, onChange }: BirthDatePickerProps) {
const labelId = useId();
const valueId = useId();
@@ -26,6 +23,7 @@ export function BirthDatePicker({ value, disabled, onChange }: BirthDatePickerPr
const selected = parseBirthDate(value);
const today = new Date();
today.setHours(0, 0, 0, 0);
+ const defaultMonth = new Date(1997, today.getMonth(), 1);
return (
@@ -45,18 +43,19 @@ export function BirthDatePicker({ value, disabled, onChange }: BirthDatePickerPr
{selected === undefined
? "选择出生日期"
- : format(selected, "PPP", { locale: dateFnsZhCN })}
+ : format(selected, "PPP", { locale: zhCN })}
-
+
{
assert.equal(existsSync(new URL("../src/components/ui/calendar.tsx", import.meta.url)), true)
@@ -21,25 +22,15 @@ test("replaces the native birth date input with the shadcn date picker", () => {
assert.match(picker, /render=\{