Skip to content

Commit

Permalink
Merge pull request #282 from niccord/master
Browse files Browse the repository at this point in the history
Fix today button
  • Loading branch information
rajeshwarpatlolla authored Sep 6, 2017
2 parents 81504f2 + 109117d commit 6dcbf0d
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/ionic-datepicker.provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,7 @@ angular.module('ionic-datepicker.provider', [])

//Set today as date for the modal
$scope.setIonicDatePickerTodayDate = function () {
var today = new Date();
refreshDateList(new Date());
$scope.selctedDateEpoch = resetHMSM(today).getTime();
if ($scope.mainObj.closeOnSelect) {
$scope.mainObj.callback($scope.selctedDateEpoch);
closeModal();
}
$scope.dateSelected($scope.today);
};

//Set date for the modal
Expand Down Expand Up @@ -265,7 +259,17 @@ angular.module('ionic-datepicker.provider', [])
text: $scope.mainObj.todayLabel,
type: 'button_today',
onTap: function (e) {
var today = new Date();
var today = new Date($scope.today);
var today_obj = {
date: today.getDate(),
month: today.getMonth(),
year: today.getFullYear(),
day: today.getDay(),
epoch: today.getTime(),
disabled: false
};
$scope.dateSelected(today_obj);

refreshDateList(new Date());
$scope.selctedDateEpoch = resetHMSM(today).getTime();
$scope.mainObj.callback($scope.selctedDateEpoch);
Expand Down

0 comments on commit 6dcbf0d

Please sign in to comment.