Created
October 30, 2012 15:39
-
-
Save bfricka/3981015 to your computer and use it in GitHub Desktop.
Small Date
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
smallDate: (raw) -> | |
date = new Date(raw or "").toDateString() | |
dateExp = /(\w{3})\s(\w{3})\s(\d{1,2})\s(\d{4})/i | |
dateArr = date.match(dateExp) | |
month = dateArr[2] | |
date = parseInt(dateArr[3], 10) | |
year = dateArr[4] | |
pretty = "#{month} #{date}, #{year}" | |
pretty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment