I have a textbox labelled 'Time' which accepts 12-hour or 24-hour time and converts it to 12-hour format i.e (hh:mma) format.
My requirement is to now convert time to 15 min increments format.
For eg:
If user enters 01:10a , it should be converted to 01:15a automatically.
Special cases:
If user enters 11:53a , it should be converted to 12:00p (notice am/pm value changes here)
If user enters 11:53p, it should be converted to 12:00a (notice am/pm value changes here)
This needs to be done within a javascript function.
Please suggest what logic I should use for this conversion.