g00fy- / angular-datepicker

calendar and datepicker directives for angular
MIT License
722 stars 421 forks source link

i can't able to select month and year after selecting date #325

Open aleximmanuel opened 7 years ago

aleximmanuel commented 7 years ago

i can't able to select month and year after selecting date .. it allows only to change the date ...when pressing the month or year its disables

input type="date" class="form-control ng-scope ng-dirty ng-touched ng-valid ng-valid-required" name="due_date" date-time="" view="date" format="YYYY-MM-DD" auto-close="true" min-view="date" ng-model="duedate" readonly="" required="" date-change="changeDueDate"

DanTalash commented 7 years ago

The issue appears to be with the attributes provided.

Firstly, the input type is set to date which means the browser will try to use its native datepicker element and this library simultaneously. This doesn't really work, which is why you won't see a value in the datepicker.

Secondly, because auto-close is set to true the picker will close once the user has selected a value. Even if this option is off, the picker will never switch to selecting months or years after the user has selected a day.

Finally, the initial view for the picker is set to date which means that when the picker is opened, it starts by showing the possible days of the month. In order to select months or years from this view the user needs to click on the middle element at the top of the picker to go up a view. In order for the picker to open on the month or year views, the view attribute should be set to the appropriate value.

See this plunkr for examples of the various options and their effects.