Commit 528d0379 authored by Andi Sidwell's avatar Andi Sidwell
Browse files

Factor out shared code

parent e581d3f1
......@@ -27,6 +27,10 @@ module.exports.formatDate = function formatDate(d, dateonly, floating) {
return s;
};
module.exports.formatDateTZ = function formatDateTZ(property, date, evt) {
return property + ':' + module.exports.formatDate(date, false, evt.floating);
};
module.exports.escape = function escape(str) {
return str.replace(/[\\;,"]/g, function(match) {
return '\\' + match;
......
......@@ -593,9 +593,9 @@ var ICalEvent = function(_data) {
g += 'DTEND;VALUE=DATE:' + tools.formatDate(data.end, true) + '\r\n';
}
} else {
g += 'DTSTART:' + tools.formatDate(data.start, false, data.floating) + '\r\n';
g += tools.formatDateTZ('DTSTART', data.start, data) + '\r\n';
if (data.end) {
g += 'DTEND:' + tools.formatDate(data.end, false, data.floating) + '\r\n';
g += tools.formatDateTZ('DTEND', data.end, data) + '\r\n';
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment