How to set the maximum date span for Element UI's date-time-picker to select only one month

Use the date range control of Element in

vue, the one of < date-time-picker type= "datetimerange" >.
there are currently two restrictions: the start and end dates cannot be more than one month. The date choice is no more than today.

it seems that only one time can be passed in date-options, how to control it here.

dateValue:[new Date().setTime(new Date().getTime()-3600 * 1000 * 24),new Date()],
dateOpt: {
    disabledDate:(time)=>{
        return time.getTime() > Date.now() - 8.64e6;
    }
},

clipboard.png

May.12,2022

you can use the change event to listen for changes in values, so that you can judge whether it is more than one month in the method. If it is more than one month, trigger a warning to the form validator


pickerOptions: {
    disabledDate(time) {
        const lastMonthTime = new Date().setMonth(new Date().getMonth() - 1)
        return time.getTime() > Date.now() || time < lastMonthTime
    }
}
.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea7ba6-1e7e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea7ba6-1e7e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?