summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorniko <niko>2012-10-28 10:44:57 (GMT)
committerniko <niko>2012-10-28 10:44:57 (GMT)
commit3ad2f683d978f282deaf1e547f7b3279d4d828b1 (patch)
tree2350041198bdd647b1824fe01ed407d8671026a7
parentd8a74908906f415c91f8631a10db32c403813058 (diff)
downloadsynckolab-3ad2f683d978f282deaf1e547f7b3279d4d828b1.tar.gz
internally: always save dateTime
-rw-r--r--src/chrome/content/synckolab/addressbookTools.js10
-rw-r--r--src/chrome/content/synckolab/calendarTools.js12
-rw-r--r--src/chrome/content/synckolab/tools/text.js8
-rw-r--r--test/synckolab/tools/textTest.js6
4 files changed, 17 insertions, 19 deletions
diff --git a/src/chrome/content/synckolab/addressbookTools.js b/src/chrome/content/synckolab/addressbookTools.js
index 5fb8436..0feb0dc 100644
--- a/src/chrome/content/synckolab/addressbookTools.js
+++ b/src/chrome/content/synckolab/addressbookTools.js
@@ -1449,7 +1449,7 @@ synckolab.addressbookTools.list2Kolab3 = function (card, fields) {
}
xml += " <x-kolab-version><text>3.0dev1</text></x-kolab-version>\n";
xml += " <prodid><text>SyncKolab " + synckolab.config.version + ", Kolab resource</text></prodid>\n";
- xml += " <rev><timestamp>" + synckolab.tools.text.calDateTime2String(new Date(), false, true) + "Z</timestamp></rev>\n";
+ xml += " <rev><timestamp>" + synckolab.tools.text.calDateTime2String(new Date(), true) + "Z</timestamp></rev>\n";
xml += " <kind><text>group</text></kind>\n";
// default: public - tbird doesnt know of other types of list like private
@@ -1501,8 +1501,8 @@ synckolab.addressbookTools.list2Xml = function (card, fields) {
xml += "<distribution-list version=\"1.0\" >\n";
xml += " <product-id>SyncKolab, Kolab resource</product-id>\n";
xml += " <uid>" + this.getUID(card) + "</uid>\n";
- xml += " <creation-date>" + synckolab.tools.text.calDateTime2String(new Date(), false, true) + "</creation-date>\n";
- xml += " <last-modification-date>" + synckolab.tools.text.calDateTime2String(new Date(), false, true) + "</last-modification-date>\n";
+ xml += " <creation-date>" + synckolab.tools.text.calDateTime2String(new Date(), true) + "</creation-date>\n";
+ xml += " <last-modification-date>" + synckolab.tools.text.calDateTime2String(new Date(), true) + "</last-modification-date>\n";
// default: public - tbird doesnt know of other types of list like private
xml += " <sensitivity>public</sensitivity>\n";
@@ -1675,7 +1675,7 @@ synckolab.addressbookTools.card2Kolab3 = function (card, skipHeader, fields) {
}
xml += " <x-kolab-version><text>3.0dev1</text></x-kolab-version>\n";
xml += " <prodid><text>SyncKolab " + synckolab.config.version + ", Kolab resource</text></prodid>\n";
- xml += " <rev><timestamp>" + synckolab.tools.text.calDateTime2String(new Date(this.getCardProperty(card, "LastModifiedDate")*1000), false, true) + "Z</timestamp></rev>\n";
+ xml += " <rev><timestamp>" + synckolab.tools.text.calDateTime2String(new Date(this.getCardProperty(card, "LastModifiedDate")*1000), true) + "Z</timestamp></rev>\n";
xml += " <kind><text>individual</text></kind>\n";
// ??
@@ -2045,7 +2045,7 @@ synckolab.addressbookTools.card2Xml = function (card, fields) {
xml += " <uid>" + synckolab.tools.text.encode4XML(this.getUID(card)) + "</uid>\n";
xml += synckolab.tools.text.nodeWithContent("categories", this.getCardProperty(card, "Category"), false);
//xml += " <creation-date>"+synckolab.tools.text.date2String(new Date(this.getCardProperty(card, "LastModifiedDate")*1000))+"T"+synckolab.tools.text.time2String(new Date(this.getCardProperty(card, "LastModifiedDate")*1000))+"Z</creation-date>\n";
- xml += " <last-modification-date>" + synckolab.tools.text.calDateTime2String(new Date(this.getCardProperty(card, "LastModifiedDate")), false, false) + "</last-modification-date>\n";
+ xml += " <last-modification-date>" + synckolab.tools.text.calDateTime2String(new Date(this.getCardProperty(card, "LastModifiedDate")), false) + "</last-modification-date>\n";
// ??
xml += " <sensitivity>public</sensitivity>\n";
diff --git a/src/chrome/content/synckolab/calendarTools.js b/src/chrome/content/synckolab/calendarTools.js
index 0a3f95d..e87d221 100644
--- a/src/chrome/content/synckolab/calendarTools.js
+++ b/src/chrome/content/synckolab/calendarTools.js
@@ -472,14 +472,14 @@ synckolab.calendarTools.event2json = function (event, syncTasks) {
if(event.entryDate) {
// TODO add timezone
jobj.startDate = {
- dateTime: synckolab.tools.text.calDateTime2String(event.entryDate, isAllDay),
+ dateTime: synckolab.tools.text.calDateTime2String(event.entryDate),
tz: null
};
}
if(endDate) {
// TODO add timezone
jobj.endDate = {
- dateTime: synckolab.tools.text.calDateTime2String(endDate, isAllDay),
+ dateTime: synckolab.tools.text.calDateTime2String(endDate),
tz: null
};
}
@@ -500,11 +500,11 @@ synckolab.calendarTools.event2json = function (event, syncTasks) {
} else {
// TODO add timezone
jobj.startDate = {
- dateTime: synckolab.tools.text.calDateTime2String(event.startDate, isAllDay),
+ dateTime: synckolab.tools.text.calDateTime2String(event.startDate),
tz: null
};
jobj.endDate = {
- dateTime:synckolab.tools.text.calDateTime2String(endDate, isAllDay),
+ dateTime:synckolab.tools.text.calDateTime2String(endDate),
tz: null
};
}
@@ -1963,7 +1963,7 @@ synckolab.calendarTools.json2xml = function (jobj, syncTasks, email) {
};
/**
- * convert an ICAL event into a Kolab3 XML string representation,
+ * convert an json event into a Kolab3 XML string representation,
* allow to caller to skip fields which change frequently such as
* "last-modification-date" because this can confuse the hash IDs.
*
@@ -1978,7 +1978,7 @@ synckolab.calendarTools.json2kolab3 = function (jobj, syncTasks, email) {
'<icalendar xmlns="urn:ietf:params:xml:ns:icalendar-2.0">\n'+
'<vcalendar>\n' +
'<properties>\n' +
- " <prodid><text>Synckolab " + synckolab.config.version + ", Calendar Sync</text></prodid>\n" +
+ ' <prodid><text>Synckolab " + synckolab.config.version + ", Calendar Sync</text></prodid>\n' +
' <version><text>2.0</text></version>\n' +
'</properties>\n' +
'<components>';
diff --git a/src/chrome/content/synckolab/tools/text.js b/src/chrome/content/synckolab/tools/text.js
index ecf35a8..522cfb2 100644
--- a/src/chrome/content/synckolab/tools/text.js
+++ b/src/chrome/content/synckolab/tools/text.js
@@ -384,7 +384,7 @@ synckolab.tools.text = {
// produces: 2005-03-30T15:28:52Z for allday = false,
// produces: 2005-03-30 for allday = true
- calDateTime2String : function (val, allday, compact) {
+ calDateTime2String : function (val, compact) {
if (val === null) {
return "";
}
@@ -393,12 +393,12 @@ synckolab.tools.text = {
//alert("EVENT TIME: " + datetime);
// make sure not to use UTC for all-day events
- var resultstring = this.date2String(datetime, allday, compact);
- if (!allday) {
+ var resultstring = this.date2String(datetime, false, compact);
+ //if (!allday) {
resultstring += 'T';
resultstring += this.time2String(datetime, compact);
resultstring += 'Z';
- }
+ //}
return resultstring;
},
diff --git a/test/synckolab/tools/textTest.js b/test/synckolab/tools/textTest.js
index c98acb7..23c6034 100644
--- a/test/synckolab/tools/textTest.js
+++ b/test/synckolab/tools/textTest.js
@@ -56,9 +56,7 @@ test("synckolab.tools.text.string2DateTime", function() {
test("synckolab.tools.text.calDateTime2String", function() {
// 2005-03-30T15:28:52Z or 2005-03-30 15:28:52 or: 20050303T152852Z
var cdate = new Date(1112196532000);
- equal(synckolab.tools.text.calDateTime2String(cdate, false, false), "2005-03-30T15:28:52Z", "datetime with - and T/Z (kolab2)");
- equal(synckolab.tools.text.calDateTime2String(cdate, false, true), "20050330T152852Z", "datetime with T/Z (kolab3)");
- equal(synckolab.tools.text.calDateTime2String(cdate, true, false), "2005-03-30", "date with - (kolab2)");
- equal(synckolab.tools.text.calDateTime2String(cdate, true, true), "20050330", "date (kolab3)");
+ equal(synckolab.tools.text.calDateTime2String(cdate, false), "2005-03-30T15:28:52Z", "datetime with - and T/Z (kolab2)");
+ equal(synckolab.tools.text.calDateTime2String(cdate, true), "20050330T152852Z", "datetime with T/Z (kolab3)");
});