admin管理员组文章数量:1124379
I'm still confused about the DatePicker of Angular Material. I have to achieve three things:
- Have another language used
- Have another date format used
- Have the bug fixed, where the time part of the date changes the date information by one day.
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 is not working. The text is always English. The corresponding link is: .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?
I hope someone can help me because I'm really stuck on this.
Best regards
Parascus
I'm still confused about the DatePicker of Angular Material. I have to achieve three things:
- Have another language used
- Have another date format used
- Have the bug fixed, where the time part of the date changes the date information by one day.
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?
I hope someone can help me because I'm really stuck on this.
Best regards
Parascus
Share Improve this question asked 2 days ago parascusparascus 1,2291 gold badge11 silver badges15 bronze badges1 Answer
Reset to default 0Ok, 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
本文标签: Angular Material DatePicker Example not workingStack Overflow
版权声明:本文标题:Angular Material DatePicker Example not working? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736624994a1945655.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论