comparison backends/file.js @ 28:7cfcd7d5796c

Replace Paul Sowden’s ISO8601 functions by my own, since their licence is possibly incompatible with AGPL.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Mon, 01 Nov 2010 03:01:40 +0100
parents a36a514e8be8
children e007a6364bf0
comparison
equal deleted inserted replaced
27:a36a514e8be8 28:7cfcd7d5796c
22 22
23 backend.save = function(file) { 23 backend.save = function(file) {
24 function sanitize(o) { 24 function sanitize(o) {
25 var n = {}; 25 var n = {};
26 for (var i in o) { 26 for (var i in o) {
27 if (i == 'content' || o[i].setISO8601) 27 if (i == 'content' || o[i].setFromISO8601)
28 n[i] = o[i].toString(); 28 n[i] = o[i].toString();
29 else if (o[i] instanceof Array) 29 else if (o[i] instanceof Array)
30 n[i] = o[i]; 30 n[i] = o[i];
31 else if (typeof o[i] == 'object') 31 else if (typeof o[i] == 'object')
32 n[i] = sanitize(o[i]); 32 n[i] = sanitize(o[i]);
64 for (var i in o) { 64 for (var i in o) {
65 if (typeof o[i] == 'string' && i == 'content') 65 if (typeof o[i] == 'string' && i == 'content')
66 parseStanza(o, i); 66 parseStanza(o, i);
67 else if (typeof o[i] == 'string' && regexp(o[i])) { 67 else if (typeof o[i] == 'string' && regexp(o[i])) {
68 var today = new Date(); 68 var today = new Date();
69 today.setISO8601(o[i]); 69 today.setFromISO8601(o[i]);
70 o[i] = today; 70 o[i] = today;
71 } else if (typeof o[i] == 'object') 71 } else if (typeof o[i] == 'object')
72 endParsing(o[i]); 72 endParsing(o[i]);
73 } 73 }
74 return o; 74 return o;