Closed tgrrtt closed 9 years ago
yeah it's somewhat an edge case. moment.parseFormat
has been made with humans entering a date in a free text inputs in mind, so UTC and other timestamp standard formats or not a priority. There is no right or wrong here, but I think having a leading zero is something I want to be added only when wanted explicitly.
I'll close this issue for the sake of oversight. But happy to keep discussing / reopening it, if there are any new arguments pro / contra
So I was looking through the regex's and realized that it will only parse timestamps as having a leading 0 if there's an explicit leading 0.
Now this means that it will correctly parse something like
01:33:47
asHH:mm:ss
However once it goes above that to12:33:47
, it will parse that out asH:mm:ss
which is technically correct, as at this point there's no way to know if the timestamp would or would not have a leading 0.However, I would say that assuming a leading 0 in these caes should be the default, as that is more commonly used with timestamps, and a not leading zero should be the one that is explicitly set, ie any timestamp like
12:34:56
parses out asHH:mm:ss
and the only way to get something asH:mm:ss
would be to have a match with something like1:23:45
.