Use lunar calendar input for birth date with solar conversion display.
Add LunarBirthPicker for bazi and combined forms, converting lunar input to solar for chart calculation. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8,7 +8,9 @@ import { ZenCard } from "@/components/ui/zen-card";
|
||||
import { ModeWorkspace } from "@/components/layout/mode-workspace";
|
||||
import ResultAI from "@/components/result-ai";
|
||||
import BaziChartDisplay from "@/components/modes/bazi-chart";
|
||||
import DateTimePicker, { nowDateString } from "@/components/shared/datetime-picker";
|
||||
import LunarBirthPicker, {
|
||||
todaySolarYmd,
|
||||
} from "@/components/shared/lunar-birth-picker";
|
||||
import RegionSelect, {
|
||||
useRegionLocation,
|
||||
} from "@/components/shared/region-select";
|
||||
@@ -16,7 +18,7 @@ import { calculateBazi, type BaziChart } from "@/lib/calc/bazi";
|
||||
import { streamAiCompletion } from "@/lib/ai/client-stream";
|
||||
|
||||
export default function BaziForm() {
|
||||
const [date, setDate] = useState(nowDateString());
|
||||
const [date, setDate] = useState(todaySolarYmd());
|
||||
const [time, setTime] = useState("12:00");
|
||||
const [unknownHour, setUnknownHour] = useState(false);
|
||||
const [gender, setGender] = useState<"male" | "female">("male");
|
||||
@@ -110,12 +112,12 @@ export default function BaziForm() {
|
||||
}
|
||||
>
|
||||
<ZenCard title="出生 · 命局" subtitle="四柱排盘所需信息" className="flex h-full min-h-0 flex-col">
|
||||
<DateTimePicker
|
||||
<LunarBirthPicker
|
||||
label="出生日期 / 时间"
|
||||
date={date}
|
||||
solarDate={date}
|
||||
time={time}
|
||||
timeDisabled={unknownHour}
|
||||
onDateChange={setDate}
|
||||
onSolarDateChange={setDate}
|
||||
onTimeChange={setTime}
|
||||
/>
|
||||
<label className="flex items-center gap-2 text-xs text-muted-foreground">
|
||||
|
||||
@@ -9,6 +9,9 @@ import { ModeWorkspace } from "@/components/layout/mode-workspace";
|
||||
import Result from "@/components/result";
|
||||
import ResultAI from "@/components/result-ai";
|
||||
import BaziChartDisplay from "@/components/modes/bazi-chart";
|
||||
import LunarBirthPicker, {
|
||||
todaySolarYmd,
|
||||
} from "@/components/shared/lunar-birth-picker";
|
||||
import DateTimePicker, {
|
||||
nowDateString,
|
||||
nowTimeString,
|
||||
@@ -22,7 +25,7 @@ import type { GuaResult } from "@/lib/calc/hexagram";
|
||||
import { streamAiCompletion } from "@/lib/ai/client-stream";
|
||||
|
||||
export default function CombinedForm() {
|
||||
const [birthDate, setBirthDate] = useState("1990-01-01");
|
||||
const [birthDate, setBirthDate] = useState(todaySolarYmd());
|
||||
const [birthTime, setBirthTime] = useState("12:00");
|
||||
const [unknownHour, setUnknownHour] = useState(false);
|
||||
const [gender, setGender] = useState<"male" | "female">("male");
|
||||
@@ -163,12 +166,12 @@ export default function CombinedForm() {
|
||||
}
|
||||
>
|
||||
<ZenCard title="人和 · 生辰" subtitle="出生时空与地域" className="flex h-full min-h-0 flex-col">
|
||||
<DateTimePicker
|
||||
label="出生日期 / 时间"
|
||||
date={birthDate}
|
||||
<LunarBirthPicker
|
||||
label="出生日期 / 时间(农历)"
|
||||
solarDate={birthDate}
|
||||
time={birthTime}
|
||||
timeDisabled={unknownHour}
|
||||
onDateChange={setBirthDate}
|
||||
onSolarDateChange={setBirthDate}
|
||||
onTimeChange={setBirthTime}
|
||||
/>
|
||||
<label className="flex items-center gap-2 text-xs text-muted-foreground">
|
||||
|
||||
Reference in New Issue
Block a user