Skip to content

Instantly share code, notes, and snippets.

@johanhalse
johanhalse / moment_shim.js
Created May 4, 2015 14:18
Small shim for formatting Pikaday dates as YYYY-MM-DD without moment.js
// Would be ridiculous to pull in the entire moment.js library for this
window.moment = function(dateString) {
var date = new Date(dateString);
var format = function() {
return date.getFullYear() + '-' +
('0' + (date.getMonth() + 1)).slice(-2) + '-' +
('0' + date.getDate()).slice(-2);
};