-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Add documentation for MomentDateAdapter usage #7464
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
Comments
@emreavsar You just need extend "DateAdapter" class and provide it For example; we don't use |
I don't understand why then there is this extra information of adding the moment.js adapter to datepicker in release notes? I could have done this (custom adapter by extending) before beta 11, am I wrong with this assumption? |
To use the adapter, you need to import The problem that |
@rkrzewski You can use the builds repo: https://github.com/angular/material2-moment-adapter-builds. Just use |
That worked like a charm @Yeradon, thanks! |
Any example for using this? |
+1 an example please |
The last 2 examples here are for moment adapter: https://material.angular.io/components/datepicker/examples |
@mmalerba is there a way to change the output from iso fromat to some custom format. I dont want datepicker to work with time zones as the service crops the time part and hence when that time is given back to server we get wrong dates based on timezones |
UPDATE: It is available on npm use following command to install it:
|
@ankitraonka |
@Moutaz-homsi The best solution would be to use ControlValueAccessor and make a custom input component, this will have you in control of input and output of the component. |
@ankitraonka, that's solve my problem for this issue , Have a great day and thanks a lot |
Full process for using
|
Thanks a lot @ankitraonka , this solved my issue , i repreduced the code here if anyone have the same problem : https://stackblitz.com/edit/angular-dlxnmx?file=app%2Fcva-date.component.ts |
The DatePicker seems to be using Moment as dates just fine. But I have a model that has a Date as a property. I changed the type from Date to Moment but when my service retrieves data from the server the property of the model is just a string: Why is this not a Moment object? Am I missing something? |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
Feature Request
What is the expected behavior?
There should be at least a small guide (preferably official docs) about how to use the newly (in beta 11) introduced MomentDateAdapter for the datepicker.
What is the current behavior?
No docs at all.
What are the steps to reproduce?
What is the use-case or motivation for changing an existing behavior?
Every feature should be documented.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Beta 11
Is there anything else we should know?
NO
The text was updated successfully, but these errors were encountered: