Last active
February 24, 2018 19:15
-
-
Save vldvel/5586de6f84922ce96b102e246bdb03fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PM case | |
if (arr[0] == 12) { // as 12 is the string I use ==, but you can rewrite it like === '12' | |
arr[0] = '12'; | |
} else { | |
arr[0] = Number(arr[0]) + 12; // if we add number to string we will get new string like '1312' | |
} | |
// AM case | |
if (arr[0] == 12) { | |
arr[0] = '00'; | |
} | |
// In other cases AM is the same as 24h format |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment