I have an input field and the user may type time in different format(800,08:00,08:00 am etc).I need to display what ever the user input into a time format(xx:xx am/pm).
Example:
1.'800'=>'08:00';
2.'1245'=>'12:45';
3.'1000 am'=>'10:00 am';
4.'10.00 am'=>'10:00 am';
5.'9 am'=>'09:00 am';
So I could type in "800" and it would convert it to "8:00" or I could type in "2145" and it would convert it to "21:45".
I have tried with str.split(/[:;,. \/]/); ,but this is applicable only in the case of example 4.