Files
dekun fff77dac3f Implement three divination modes, learn pages, and PM2 deploy on port 3130.
Add liuyao/bazi/combined flows with shared calc and AI infrastructure, 64-gua learn routes, and update Ubuntu PM2 deployment docs for port 3130.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-10 20:19:49 +08:00

50 lines
1.2 KiB
TypeScript

"use client";
interface DateTimePickerProps {
date: string;
time: string;
onDateChange: (date: string) => void;
onTimeChange: (time: string) => void;
label?: string;
timeDisabled?: boolean;
}
export function nowDateString() {
return new Date().toISOString().slice(0, 10);
}
export function nowTimeString() {
const d = new Date();
return `${d.getHours().toString().padStart(2, "0")}:${d.getMinutes().toString().padStart(2, "0")}`;
}
export default function DateTimePicker({
date,
time,
onDateChange,
onTimeChange,
label = "时间",
timeDisabled = false,
}: DateTimePickerProps) {
return (
<div className="space-y-2">
<label className="text-sm font-medium">{label}</label>
<div className="grid gap-2 sm:grid-cols-2">
<input
type="date"
className="rounded-md border bg-background px-3 py-2 text-sm disabled:opacity-50"
value={date}
onChange={(e) => onDateChange(e.target.value)}
/>
<input
type="time"
className="rounded-md border bg-background px-3 py-2 text-sm disabled:opacity-50"
value={time}
disabled={timeDisabled}
onChange={(e) => onTimeChange(e.target.value)}
/>
</div>
</div>
);
}