Skip to content

Commit

Permalink
fix(datetime-picker): 默认最小日期最大日期使用常量;
Browse files Browse the repository at this point in the history
  • Loading branch information
NickeyLin committed Dec 21, 2023
1 parent c79c4f1 commit 28c966d
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const DatePicker = forwardRef<DateTimePickerInstance, DatePickerProps>(
const props = mergeProps(p, {
type: 'datetime',
placeholder: false,
minDate: new Date(currentYear - 10, 0, 1),
maxDate: new Date(currentYear + 10, 11, 31),
minDate: DefaultMinDate,
maxDate: DefaultMaxDate,
formatter: (type: string, value: string) => value,
})
const {
Expand Down Expand Up @@ -280,5 +280,7 @@ const DatePicker = forwardRef<DateTimePickerInstance, DatePickerProps>(
)

const currentYear = new Date().getFullYear()
const DefaultMinDate = new Date(currentYear - 10, 0, 1)
const DefaultMaxDate = new Date(currentYear + 10, 11, 31)

export default DatePicker

0 comments on commit 28c966d

Please sign in to comment.