Closed claubanu closed 7 years ago
What happens when you try to set tomorrow as the default value?
Hi Dale,
In view (html) I have two date inputs with bs-datepicker directive putting first date on ng-model="firstDate" and second date on ng-model="secondDate".
In the controller I set the datepicker and date variables as following:
angular.module('myApp') .config(function($datepickerProvider) { angular.extend($datepickerProvider.defaults, { dateFormat: 'dd/MM/yyyy', startWeek: 1 }); });
$scope.firstDate = new Date();
And for the secondDate I've tryed different combinations like: var today = new Date(); $scope.secondDate = new Date(today+1); or $scope.secondDate = new Date($scope.firstDate+1);
The idea is that I want firstDate to be today and secondDate to be tomorrow by default.
Any advice is welcome! Thank you very much.
If you create a plunkr that recreates the problem, we can start from there :)
Well, first time with plunkr...Maybe you can understand why isn't working the bs-datepicker directive plus the desired behaviour from those two date inputs,. https://plnkr.co/edit/TasV5U3jPZXBwjkDBZ9p?p=preview
I modified the body of the controller to this:
$scope.data1 = new Date();
$scope.data2 = new Date();
$scope.data2.setDate($scope.data1.getDate() + 1);
This worked.
Also worked for me. Thank you very much!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Hi there! My issue: the user must select two dates, the beginning and the end of the interval. By default, first option is today and the second option (the end of the interval) should be tomorrow (by default, for a better user experience). Can somebody, please, help me set tomorrow as default value for the second date option? Thanks in advance!