NIsham Mahsin
NIsham Mahsin

Reputation: 728

form.$invalid is not working for angular ui date picker

i have two fields due date and a text filed enter a number

due date which is a date picker ,either we can select date from date picker or

we can set date by entering number in second text field.

button create will be enabled if i manually set the date field from date picker but but it is not enabling if i set date picker value by entering text field

can anybody tell me why this is happening. this is jsfiddle link fiddle

Upvotes: 1

Views: 72

Answers (1)

Anshad Vattapoyil
Anshad Vattapoyil

Reputation: 23463

You have errors with your date parsing logic, Change your function to this.

$scope.getDueDate = function() {
    var  d = parseInt($scope.daysFrom);
    var newDate = moment(new Date()).add(d, 'days').format('YYYY-MM-DD');
    $scope.AvailableDate = newDate;
}

Upvotes: 1

Related Questions