From 36a09ea6caf9b606fcd918ead56f8691f2ba8ac8 Mon Sep 17 00:00:00 2001 From: slomo Date: Fri, 21 Jan 2011 20:58:22 +0100 Subject: jslint says: ok --- src/nodejs/xmlGenerator.js | 53 ++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'src/nodejs/xmlGenerator.js') diff --git a/src/nodejs/xmlGenerator.js b/src/nodejs/xmlGenerator.js index 17143a8..08ea833 100644 --- a/src/nodejs/xmlGenerator.js +++ b/src/nodejs/xmlGenerator.js @@ -8,6 +8,27 @@ var log4js = require('log4js')(); //note the need to call the function var log = log4js.getLogger('xmlGenerator'); log.setLevel(config.logLevel); +function toISO8601(date) { + //2007-03-31T00:09:22+01:00 + var pad_two = function(n) { + return (n < 10 ? '0' : '') + n; + }; + + return [ + date.getUTCFullYear(), + '-', + pad_two(date.getUTCMonth() + 1), + '-', + pad_two(date.getUTCDate()), + 'T', + pad_two(date.getUTCHours()), + ':', + pad_two(date.getUTCMinutes()), + ':', + pad_two(date.getUTCSeconds()), + '+01:00' //FIX ME + ].join(''); +} exports.createNode = function (row) { log.debug(row); @@ -20,52 +41,34 @@ exports.createNode = function (row) { .att('lon', row.lon); if(row.tags != '{}') { var temp = row.tags.replace("{","").replace("}","").split(","); - for(var x=0;x