0.1.0.1
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
"use client"
|
||||
|
||||
import { Calendar } from 'antd'
|
||||
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'
|
||||
|
||||
@@ -41,44 +42,16 @@ export function AntdLunarCalendar({ onSelect }: AntdLunarCalendarProps) {
|
||||
|
||||
return (
|
||||
<div className="antd-lunar-calendar-wrapper">
|
||||
<Calendar
|
||||
fullCellRender={cellRender}
|
||||
onSelect={handleSelect}
|
||||
validRange={[dayjs('1900-01-01'), dayjs('2100-12-31')]}
|
||||
locale={{
|
||||
lang: {
|
||||
locale: 'zh-cn',
|
||||
monthFormat: 'M月',
|
||||
yearFormat: 'YYYY年',
|
||||
today: '今天',
|
||||
now: '此刻',
|
||||
backToToday: '返回今天',
|
||||
ok: '确定',
|
||||
timeSelect: '选择时间',
|
||||
dateSelect: '选择日期',
|
||||
weekSelect: '选择周',
|
||||
clear: '清除',
|
||||
month: '月',
|
||||
year: '年',
|
||||
previousMonth: '上个月',
|
||||
nextMonth: '下个月',
|
||||
monthSelect: '选择月份',
|
||||
yearSelect: '选择年份',
|
||||
decadeSelect: '选择年代',
|
||||
dayFormat: 'D日',
|
||||
dateFormat: 'YYYY-MM-DD',
|
||||
dateTimeFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
previousYear: '上一年',
|
||||
nextYear: '下一年',
|
||||
previousDecade: '上一年代',
|
||||
nextDecade: '下一年代',
|
||||
previousCentury: '上一世纪',
|
||||
nextCentury: '下一世纪',
|
||||
shortWeekDays: ['日', '一', '二', '三', '四', '五', '六'],
|
||||
shortMonths: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<ConfigProvider locale={locale}>
|
||||
<Calendar
|
||||
fullCellRender={cellRender}
|
||||
onSelect={handleSelect}
|
||||
validRange={[
|
||||
dayjs('1900-01-01'),
|
||||
dayjs().add(10, 'year').endOf('year')
|
||||
]}
|
||||
/>
|
||||
</ConfigProvider>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user