Skip to content
This repository has been archived by the owner on Feb 18, 2022. It is now read-only.

Commit

Permalink
Merge pull request #257 from petr-vysotskiy/master
Browse files Browse the repository at this point in the history
Show calendar with respect to date format
  • Loading branch information
45kb authored May 5, 2017
2 parents 1fd010d + 4515f85 commit d02e171
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/js/angular-datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@
//, dateMaxLimit
, dateDisabledDates = $scope.$eval($scope.dateDisabledDates)
, date = new Date()
, dateString
, isMouseOn = false
, isMouseOnInput = false
, preventMobile = typeof attr.datepickerMobile !== 'undefined' && attr.datepickerMobile !== 'false'
Expand Down Expand Up @@ -405,8 +404,11 @@
if (theCalendar.classList) {

theCalendar.classList.add('_720kb-datepicker-open');
dateString = angular.element(angular.element(theCalendar).parent()[0].querySelector('input')).val().replace(/\//g, '-');
date = new Date(dateString);
if (dateFormat) {
date = localDateTimestamp(thisInput[0].value.toString(), dateFormat);
} else {
date = new Date(thisInput[0].value.toString());
}
$scope.selectedMonth = Number($filter('date')(date, 'MM'));
$scope.selectedDay = Number($filter('date')(date, 'dd'));
$scope.selectedYear = Number($filter('date')(date, 'yyyy'));
Expand Down

0 comments on commit d02e171

Please sign in to comment.