Article From:https://segmentfault.com/q/1010000009681118
Question:

iviewDate component API document

Setting the disabledDate in the property options object can set an optional date.
disabledDate Is a function, the parameter is the current date, needs to return Boolean to disable this day.

options3: {
    disabledDate (date) {
        return date && date.valueOf() < Date.now() - 86400000;
    }
}

This method is not optional until the current date. I don’t see it clearly. What I’m trying to do now is to have the date component in2017-02-01and2017-07-30Optional, the rest is not optional, do not know whether it can be achieved?

Answer 0:
options3: {
    disabledDate (date) {
        return date && date.valueOf() < Date.now() - 86400000;
    }
}

Then the component is added: options= “Options3”, as follows:

<Date-picker format="yyyy-MM-dd" :options="options3"  placeholder="Select the query date interval "style=" width: 300px "> < /Date-picker>";

Answer 1:

disabledDate(date) {

                let initdate = new Date("2017-07-01") - 86400000;
                return (date && date.valueOf() < initdate) || (date && date.valueOf() >= new Date())
            }
            The above can be achieved from July 1, 2017 to the current time period, and no time period can be used for the same reason.

Answer 2:

Did the landlord solve it

Answer 3:

disabledDate The date parameter of the method is the corresponding date, so as long as it lets it return to false (that is not disable) date between the date and the 2017-07-30, the other returns to true (that is, disable).

Answer 4:

Do I want to ask this real time change? For example, the interval between the start time and the end time is 7 days.

Answer 5:

You can check this article: iView datepicker disabledate control date component is not optional.

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *