Skip to content

Instantly share code, notes, and snippets.

@thiagoalves
Created November 11, 2019 12:55
Show Gist options
  • Save thiagoalves/ad6e862eb410f738b6a318d22a3a6d32 to your computer and use it in GitHub Desktop.
Save thiagoalves/ad6e862eb410f738b6a318d22a3a6d32 to your computer and use it in GitHub Desktop.
smiles
// http://www.jsonquerytool.com/
function formatDate(date) {
var d = new Date(date),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = d.getFullYear();
if (month.length < 2)
month = '0' + month;
if (day.length < 2)
day = '0' + day;
return [year, month, day].join('-');
}
input.map(function(obj) {
if (typeof(obj['children']) != 'undefined') {
return obj.children.map(function(px) {
return px['PNR Name'] + '|' + formatDate(new Date(px['Transaction Date']));
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment