I receive date/time objects from user input, and would like to parse them to a javascript Date object. The date is in the format: 02/06/2018 00:59:03
which means second of june, 2018; UK locale.
Although this seems extremely trivial and a super wide use case scenario, I can't seem to find anything in the documentation how to specify the locale I wish to use for parsing.
What the parser does is simply assume I am using US locale format, which defaults to having first the month, then the day, and then the year, so it mixes up month and day.
Currently the only available option I see is writing my own parser, which is fine ish (it is not, of course, as I might tomorrow need another locale), but seems a little 1980ies to me.
Maybe I overlooked something in the documentation. But does anyone have any other solution? Would be greatly appreciated.
P.s. I can hardly imagine this has not been asked yet, but my search did not turn up much either.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…