Created
October 27, 2015 13:01
-
-
Save andreasvirkus/3fc9eae0ea69cbebbc8f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* Get the numeric equivalent of an English (shortened) month name | |
* | |
* It's best to keep the English version in the element's data | |
* attribute when dealing with translatable strings. | |
* | |
* @param monthStr long or short month name | |
* @returns {number} month's integer equivalent (1-12) | |
*/ | |
function getMonth(monthStr){ | |
return new Date('1 ' + monthStr + ' 2001').getMonth() + 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment