Created
October 31, 2012 13:54
-
-
Save bloodyowl/3987147 to your computer and use it in GitHub Desktop.
Date unificator
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
// var dateFormat -> something returning a date like "YYYY/MM/DD", "DD-MM-YYYY", "MM/DD/YYYY" ... | |
// Function#curry from Craft.js | |
// https://github.com/mlbli/Craft/ | |
var convertDate = (function(string, date){ | |
var year = string.indexOf("Y"), | |
month = string.indexOf("M"), | |
day = string.indexOf("D") | |
return [date.slice(year, year + 4), date.slice(month, month + 2), date.slice(day, day + 2)].join("-") | |
}).curry(dateFormat) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment