user11561629
user11561629

Reputation: 71

How to disable current and future dates using pickaday directive in AngularJS

I am using "pickaday" directive in AngularJS.

My requirement is to disable current and future dates so that the user is not able to select them. I have applied error on selecting future dates but not able to disable them.

Upvotes: 0

Views: 194

Answers (1)

astonTY
astonTY

Reputation: 59

Use maxDate to limit the selected date.

var options = $.extend(true, $scope.global.rangePickeOptions, {
                        startDate: moment(serverTime).startOf('day'),
                        endDate: moment(serverTime),
                        minDate:moment(serverTime).subtract(Number(data)-1, 'days'),
                        maxDate: moment(serverTime).format('YYYY-MM-DD'),
                        opens: "right"
                    })

Upvotes: 1

Related Questions