I\'m trying to convert ISO 8601 string to seconds in JS/Node. The best I could come up with was:
function convert_time(duration) { var a = duration.match
I realize eval is unpopular, but here's the easiest and fastest approach I can imagine. Enjoy.
function formatDuration(x) { return eval(x.replace('PT','').replace('H','*3600+').replace('M','*60+').replace('S', '+').slice(0, -1)); }