ui-kit
ui-kit copied to clipboard
TimeInput - format on blur with Chinese and Japenese Locale loses value
Summary
When you have your locale set to Chinese, and you try to enter a time, it formats on blur, and then when you try to change it, it loses the value.
I assume the problem is it's prefixing the value with the Chinese characters for AM / PM.
Here's some gifs

I did some research, it looks like the problem is in this crazy regex expression in parse-time.
const match = time.match(
/^(\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:\.(\d{1,3}))?)?)?\s*(am|pm)?$/
);
if (!match) return null;
Two approaches are possible.
- We have to allow "times" to start with chinese AM or PM
- Or we change our formatting so it stops auto formatting Chinese times with the AM/PM.
It might make sense to do some research and find out how Chinese users want to enter times.
we face the same issue with the Japanese locale.