Commit f4518585 authored by Sebastian's avatar Sebastian
Browse files

Merge branch 'takkaria-optional-end-date' into develop

parents 8dbe43f8 955a95b3
......@@ -281,7 +281,7 @@ Appointment date of beginning as Date object. This is required for all events!
#### end([_Date_ end])
Appointment date of end as Date object. This is also required for all events!
Appointment date of end as Date object.
#### timestamp([_Date_ stamp]) or stamp([_Date_ stamp])
......
......@@ -562,9 +562,6 @@ var ICalEvent = function(_data) {
if(!data.start) {
throw 'No value for `start` in ICalEvent #' + data.id + ' given!';
}
if(!data.end) {
throw 'No value for `end` in ICalEvent #' + data.id + ' given!';
}
// DATE & TIME
g += 'BEGIN:VEVENT\r\n';
......@@ -572,10 +569,14 @@ var ICalEvent = function(_data) {
g += 'DTSTAMP:' + tools.formatDate(data.stamp) + '\r\n';
if(data.allDay) {
g += 'DTSTART;VALUE=DATE:' + tools.formatDate(data.start, true) + '\r\n';
g += 'DTEND;VALUE=DATE:' + tools.formatDate(data.end, true) + '\r\n';
if (data.end) {
g += 'DTEND;VALUE=DATE:' + tools.formatDate(data.end, true) + '\r\n';
}
} else {
g += 'DTSTART:' + tools.formatDate(data.start, false, data.floating) + '\r\n';
g += 'DTEND:' + tools.formatDate(data.end, false, data.floating) + '\r\n';
if (data.end) {
g += 'DTEND:' + tools.formatDate(data.end, false, data.floating) + '\r\n';
}
}
// REPEATING
......
......@@ -257,17 +257,13 @@ describe('ical-generator 0.2.x / ICalCalendar', function() {
});
it('should throw error when event invalid', function() {
var cal = ical(),
var file = path.join(__dirname, 'save.ical'),
cal = ical(),
e = cal.createEvent();
assert.throws(function() {
cal.save();
cal.save(file);
}, /`start`/);
e.start(new Date());
assert.throws(function() {
cal.save();
}, /`end`/);
});
});
......@@ -287,19 +283,14 @@ describe('ical-generator 0.2.x / ICalCalendar', function() {
});
it('should throw error when event invalid', function() {
var cal = ical(),
var file = path.join(__dirname, 'save_sync.ical'),
cal = ical(),
e = cal.createEvent();
assert.throws(function() {
/*jslint stupid: true */
cal.saveSync();
cal.saveSync(file);
}, /`start`/);
e.start(new Date());
assert.throws(function() {
/*jslint stupid: true */
cal.saveSync();
}, /`end`/);
});
});
......
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