kekeh / angular-mydatepicker

Angular datepicker and date range picker :date:
https://kekeh.github.io/angular-mydatepicker/
MIT License
1 stars 11 forks source link

yyyy only form #5

Closed randym127 closed 4 years ago

randym127 commented 5 years ago

When I set the format to 'yyyy' I get the following error:

ERROR TypeError: Cannot read property '0' of null at UtilService.push.../../node_modules/angular-mydatepicker/fesm5/angular-mydatepicker.js.UtilService.getDateValue (angular-mydatepicker.js:218) at UtilService.push.../../node_modules/angular-mydatepicker/fesm5/angular-mydatepicker.js.UtilService.isDateValid (angular-mydatepicker.js:146) at AngularMyDatePickerDirective.push.../../node_modules/angular-mydatepicker/fesm5/angular-mydatepicker.js.AngularMyDatePickerDirective.writeValue (angular-mydatepicker.js:2617) at setUpControl (forms.js:2057) at FormGroupDirective.push.../../node_modules/@angular/forms/fesm5/forms.js.FormGroupDirective.addControl (forms.js:5281) at FormControlName.push.../../node_modules/@angular/forms/fesm5/forms.js.FormControlName._setUpControl (forms.js:5882) at FormControlName.push.../../node_modules/@angular/forms/fesm5/forms.js.FormControlName.ngOnChanges (forms.js:5803) at checkAndUpdateDirectiveInline (core.js:22085) at checkAndUpdateNodeInline (core.js:23353) at checkAndUpdateNode (core.js:23315)

kekeh commented 5 years ago

There must be also d and m letters in the date format string.

randym127 commented 5 years ago

Right, but if we want to use this as a Date of Birth collection, in some countries you can only collect year.

'yyyy' is a valid date format as is 'mm yyyy' is also common for DOB.

kekeh commented 5 years ago

That is good point :-) I will investigate this next weekend and check how easy is change current functionality.

SolveWithShri commented 5 years ago

@kekeh Also in one of our project the requirement is like 17 January. Format - d mmm. It will be better, if we have that support in library. :)

STheFox commented 4 years ago

@ShrikantAdhav I would also need that functionality. @kekeh Can you investigate if this is something you could easily add? I think it was already available in the previous datepicker for Angular < 7

kekeh commented 4 years ago

Now you can give more date formats to the dateFormat option. For example yyyy, mm/yyyy and mmm yyyy.

This is implemented in 0.5.6 version.