Reputation: 1249
I'm confused about the DatePicker of Angular Material. I have to achieve three things:
I think there should be a generic way to fix all of them. But trying to find a solution there are only problems and almost no answers: @1. Even the stack blitz implementation of https://v5.material.angular.io/components/datepicker/examples is not working. The text is always English. The corresponding link is: https://stackblitz.com/angular/vjgvmmmxpqj?file=app%2Fdatepicker-locale-example.ts I tried to find information how I can use the MatDatepickerIntl service but setting any of the properties is also ignored and I can't find a working example.
@2. I found examples where I can add a fixed date format. But I want to have the date format depending on the locale. One time I managed to use e.g. a German locale but there the format was d.m.yyyy instead of dd.mm.yyyy. Do I really have to implement the different formats for every possible locale by my self?
@3. I wondered why my date, read from a date picker and stored in a database always was a day back. Than I have read that this is an old problem and one have to always add some hours to the date so it can be truncated to a date information without any time parts. Isn't there any better solution to this? And if there is not, how can I apply this to every date field automatically like an interceptor?
Upvotes: 0
Views: 32
Reputation: 1249
Ok, I have done some progress:
@1: Still not clarified. I will open another request with my code.
@2: I accepted that there is no way to select a locale that has a leading zero so I have to work on every locale as soon I try to add a new language.
@3: For this problem I advise the solution of Bruno Cerecetto in the request day incorrect in angular material datepicker. That worked for me.
Best regards
Parascus
Upvotes: 0