"use client" import { Calendar, ConfigProvider } from 'antd' import type { Dayjs } from 'dayjs' import dayjs from 'dayjs' import 'dayjs/locale/zh-cn' import locale from 'antd/locale/zh_CN' import { solar2lunar } from '@/lib/lunar-calendar' import './antd-lunar-calendar.css' dayjs.locale('zh-cn') interface AntdLunarCalendarProps { onSelect?: (date: Date) => void } export function AntdLunarCalendar({ onSelect }: AntdLunarCalendarProps) { const cellRender = (current: Dayjs) => { const date = current.toDate() const lunarInfo = solar2lunar(date) return (
{current.date()}
{lunarInfo && (
{lunarInfo.dayName}
{lunarInfo.isLeap && (
)}
)}
) } const handleSelect = (date: Dayjs) => { if (onSelect) { onSelect(date.toDate()) } } return (
) }