Skip to content

Instantly share code, notes, and snippets.

@OnkelTem
Created July 24, 2014 14:13
Show Gist options
  • Save OnkelTem/7e6684f3e862e1485d9f to your computer and use it in GitHub Desktop.
Save OnkelTem/7e6684f3e862e1485d9f to your computer and use it in GitHub Desktop.
function preRender(data) {
_.each(data, function (el, key) {
if (_.isObject(el) && el.date_type == 'datetime') {
var date = [];
date[0] = moment(el.value + ' ' + el.timezone_db, 'YYYY-MM-DD H:m:s z', lang);
date[1] = moment(el.value2 + ' ' + el.timezone_db, 'YYYY-MM-DD H:m:s z', lang);
el = date;
}
else if (_.isObject(el)) {
el = preRender(el);
}
data[key] = el;
});
return data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment