Skip to content

Commit

Permalink
fix(datetime-picker): 默认最小日期最大日期使用常量; (#694)
Browse files Browse the repository at this point in the history
  • Loading branch information
NickeyLin authored Dec 22, 2023
1 parent ff36069 commit 27b9d74
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 27b9d74

Please sign in to comment.