24hto12hformat
Converts from 24-hour hh:mm
to 12-hour hh:mm +merdian
or hh:mm:ss +merdian
format.
Usage
Install:
yarn add 24hto12hformat
# or
npm install 24hto12hformat --save
In your code:
import timeFormatter from '24hto12hformat';
timeFormatter('13:30');
timeFormatter('13:30', true);
timeFormatter('15:33:29 GMT+020');
timeFormatter('13:30', true, true);
timeFormatter('13:30:13', true, true);
Contract
If the the supplied time
argument is not a string
, or it does not start in the hh:mm
format, then the module will throw an exception in the form of a string.
Other Notes
Fun fact: the original name of this package (24h-to-12h-format
) could not be published to NPM due to their system considering it a spam name. :)