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

Couldn't find moment datetime adapter #46

Closed
carbonrider opened this issue Sep 12, 2018 · 3 comments
Closed

Couldn't find moment datetime adapter #46

carbonrider opened this issue Sep 12, 2018 · 3 comments
Assignees
Labels

Comments

@carbonrider
Copy link

As stated on the home page of the repository, I couldn't find moment datetime adatper. Can it be made available?

@carbonrider
Copy link
Author

Sorry, I noticed the adapter is available in @mat-datetimepicker/moment. I still have issue though. I am using follwing statement for provider

{ provide: DatetimeAdapter, useClass: MomentDatetimeAdapter, deps: [MAT_DATE_LOCALE] },

And getting following error

JobInviteComponent.html:46 ERROR TypeError: Cannot read property 'createDate' of undefined
at MomentDatetimeAdapter.push../node_modules/@mat-datetimepicker/core/fesm5/mat-datetimepicker-core.js.DatetimeAdapter.createDate (mat-datetimepicker-core.js:333)
at mat-datetimepicker-moment.js:52
at range (mat-datetimepicker-moment.js:24)
at MomentDatetimeAdapter.push../node_modules/@mat-datetimepicker/moment/fesm5/mat-datetimepicker-moment.js.MomentDatetimeAdapter.setLocale (mat-datetimepicker-moment.js:52)
at new MomentDatetimeAdapter (mat-datetimepicker-moment.js:32)
at createClass (core.js:8996)
at _createProviderInstance (core.js:8981)
at resolveDep (core.js:9100)
at createClass (core.js:9004)
at createDirectiveInstance (core.js:8881)

@kuhnroyal
Copy link
Owner

Your material version is probably to old/new.

@carbonrider
Copy link
Author

Thanks @kuhnroyal for your response. I am using Angular 6.0.3

I changed the statement to

{ provide: DatetimeAdapter, useClass: MomentDatetimeAdapter }

And it worked.

@kuhnroyal kuhnroyal self-assigned this Dec 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants