Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yyyy only form #5

Closed
randym127 opened this issue Jun 10, 2019 · 6 comments
Closed

yyyy only form #5

randym127 opened this issue Jun 10, 2019 · 6 comments

Comments

@randym127
Copy link

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
Copy link
Owner

kekeh commented Jun 10, 2019

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

@randym127
Copy link
Author

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
Copy link
Owner

kekeh commented Jun 10, 2019

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

@SolveWithShri
Copy link

@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
Copy link

STheFox commented Apr 1, 2020

@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
Copy link
Owner

kekeh commented Apr 3, 2020

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.

@kekeh kekeh closed this as completed Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants