mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-26 06:00:52 +08:00
docs: fix customize calendar example (#36356)
* docs: fix customize calendar example * test: changed calendar snapshot Co-authored-by: lico <lico@licoui-MacBookPro.local>
This commit is contained in:
parent
2e04982882
commit
e262ae8133
@ -3481,8 +3481,8 @@ exports[`renders ./components/calendar/demo/customize-header.md extend context c
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
aria-selected="false"
|
||||
class="ant-select-item ant-select-item-option year-item"
|
||||
aria-selected="true"
|
||||
class="ant-select-item ant-select-item-option year-item ant-select-item-option-selected"
|
||||
title="2016"
|
||||
>
|
||||
<div
|
||||
|
@ -41,16 +41,16 @@ const App: React.FC = () => {
|
||||
months.push(localeData.monthsShort(current));
|
||||
}
|
||||
|
||||
for (let index = start; index < end; index++) {
|
||||
for (let i = start; i < end; i++) {
|
||||
monthOptions.push(
|
||||
<Select.Option className="month-item" key={`${index}`}>
|
||||
{months[index]}
|
||||
<Select.Option key={i} value={i} className="month-item">
|
||||
{months[i]}
|
||||
</Select.Option>,
|
||||
);
|
||||
}
|
||||
const month = value.month();
|
||||
|
||||
|
||||
const year = value.year();
|
||||
const month = value.month();
|
||||
const options = [];
|
||||
for (let i = year - 10; i < year + 10; i += 1) {
|
||||
options.push(
|
||||
@ -78,11 +78,11 @@ const App: React.FC = () => {
|
||||
size="small"
|
||||
dropdownMatchSelectWidth={false}
|
||||
className="my-year-select"
|
||||
value={year}
|
||||
onChange={newYear => {
|
||||
const now = value.clone().year(Number(newYear));
|
||||
const now = value.clone().year(newYear);
|
||||
onChange(now);
|
||||
}}
|
||||
value={String(year)}
|
||||
>
|
||||
{options}
|
||||
</Select>
|
||||
@ -91,11 +91,10 @@ const App: React.FC = () => {
|
||||
<Select
|
||||
size="small"
|
||||
dropdownMatchSelectWidth={false}
|
||||
value={String(month)}
|
||||
onChange={selectedMonth => {
|
||||
const newValue = value.clone();
|
||||
newValue.month(parseInt(selectedMonth, 10));
|
||||
onChange(newValue);
|
||||
value={month}
|
||||
onChange={newMonth => {
|
||||
const now = value.clone().month(newMonth);
|
||||
onChange(now);
|
||||
}}
|
||||
>
|
||||
{monthOptions}
|
||||
|
Loading…
Reference in New Issue
Block a user