Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. const ampmTime = () => {
  2. return Array.from({length: 24}).map((_,i) => {
  3. if (i === 0){
  4. return { html: `12am`, value: `0000` };
  5. }
  6. if (i < 10){
  7. return { html: `${i}am`, value: `0${i}00` };
  8. }
  9. if (i < 12){
  10. return { html: `${i}am`, value: `${i}00` };
  11. }
  12. if (i === 12){
  13. return { html: `12pm`, value: `1200` };
  14. }
  15. return { html: `${(i - 12)}pm`, value: `${i}00` };
  16. });
  17. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement