Skip to content

Instantly share code, notes, and snippets.

@bfricka
Created October 30, 2012 15:39
Show Gist options
  • Save bfricka/3981015 to your computer and use it in GitHub Desktop.
Save bfricka/3981015 to your computer and use it in GitHub Desktop.
Small Date
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