Closed k3nsei closed 5 months ago
I'd say this is more about visual than functional part. But maybe it make sense to handle am/pm as well.
As I"m from Europe I don't even understand why people are using this 12h in 2024. But USA is having even more stupid things like imperial system instead of metric one. Anyway I just reporting what I found migrating our project time picker to use yours library. As I'm using own Luxon based TimeAdapter it isn't affecting mine project. But reporting to make experience better for others.
By the way, thank you for the issue. I really appreciate it and it helps to make the lib better.
Should work in:
15.3.0
16.3.0
17.5.0
@dhutaryan Great, I like simplistic approach that you did there. Just one question, I didn't seen checking for out of bound values when it switches to else case. So potentially I could give bigger number than 12 and PM. Then it would jump to else cause without fallback and any error. Which could give potentially unexpected results. I didn't tested it though as its middle of night when I'm reading commit changes. I just assuming that from what I seen in commit.
Edited:
Yeap tested it and I could pass 31:42 PM or AM and it would be converted instead of giving parsing error. It's kinda ok behavior but could be source of unexpected result and surprise. I personally prefer to see validation error, but it isn't big deal as it is super minor/rare edge case.
When initial time is for example 11:20 PM, and using keyboard to change input element value to 11:20 AM. Inputs AM/PM is set back to previous state.
It's all because of this replace https://github.com/dhutaryan/ngx-mat-timepicker/blob/78c58b5c26717c23a8a2108d02ae424b04bac9a9/projects/mat-timepicker/src/lib/adapter/native-date-time-adapter.ts#L43
Simple converter from 12h to 24h format should fix this problem.