1 contributor
Like
Install format12h as a package?
Copied
npm i @bit/tomlandau.simple-js.format-date.format12h
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example modifieddraft
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
and packages in Bit or NPM to the example. any of the 1 million componentstoggle layout
No preview available
chevron_left
chevron_right
Formats a date object as a 12 hours time (am/pm).
format12h (
date:
Date
,withSeconds:
) : bool
string
formats a date object as a 12 hours time (am/pm), with or without seconds (without by default).
Example
Arguments
date:
Date
withSeconds:
bool
Returns
string
Test Summary
format-12h should return formatted time with am for 1-11 hours | Pass |
format-12h should return formatted time with 12 am for 0 hours | Pass |
format-12h should return formatted time with pm for 12-23 hours | Pass |
format-12h should return single digits with leading zeros | Pass |
format-12h should return formatted time without seconds when not specified otherwise | Pass |
format-12h should return formatted time with seconds when specified | Pass |