2

I'm using the Angular Bootstrap DateTimePicker.

I'm trying to figure out how to disable specific dates, but nothing is working.

Does anybody have any suggestions?

2

2 Answers 2

2

I found the answer. I'm using the beforerender as they suggesting: I'm taking all objects of current representation (month). Looking for that specific date then changing that date selectable attribute as false.

Sign up to request clarification or add additional context in comments.

Comments

1

This works for me with the Dale Lotts DateTimePicker.

    $scope.beforeRender = function ($view, $dates, $leftDate, $upDate, $rightDate) {
        var nowUtc = new Date();
        if ($view === 'day') {
            nowUtc.setHours(0, 0, 0, 0);
        } else {
            if ($view === 'hour') {
                nowUtc.setMinutes(0, 0, 0);
            }
        }

        for (var i = 0; i < $dates.length; i++) {
            if ($dates[i].utcDateValue < nowUtc) {
                $dates[i].selectable = false;
            } else {
                $dates[i].selectable = true;
            }
        }
    }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.