calendar-tools
Advanced tools
Comparing version 0.2.8 to 0.2.9
@@ -27,3 +27,2 @@ (function () { function require(p){ var path = require.resolve(p) , mod = require.modules[path]; if (!mod) throw new Error('failed to require "' + p + '"'); if (!mod.exports) { mod.exports = {}; mod.call(mod.exports, mod, mod.exports, require.relative(path)); } return mod.exports;}require.modules = {};require.resolve = function(path){ var orig = path , reg = path + '.js' , index = path + '/index.js'; return require.modules[reg] && reg || require.modules[index] && index || orig;};require.register = function(path, fn){ require.modules[path] = fn;};require.relative = function(parent) { return function(p){ if ('.' != p.charAt(0)) return require(p); var path = parent.split('/') , segs = p.split('/'); path.pop(); for (var i = 0; i < segs.length; i++) { var seg = segs[i]; if ('..' == seg) path.pop(); else if ('.' != seg) path.push(seg); } return require(path.join('/')); };};require.register("atom.js", function(module, exports, require){ | ||
* @param {Object} ev: Object Event | ||
* @param {string} tz: timezone location | ||
* | ||
@@ -34,11 +33,9 @@ * return {String} event atom string | ||
module.exports.genEvent = function (ev, opts) { | ||
// alias | ||
var tz = ev.location || 'GMT' | ||
, tzCity = ev.locationCity || ''; | ||
// default options | ||
opts = opts || {}; | ||
var options = { | ||
_start: ev.start | ||
, _end: ev.end | ||
start: ev.start | ||
, end: ev.end | ||
, timezone: 'GMT' | ||
}; | ||
@@ -49,2 +46,5 @@ | ||
// timezone location | ||
tz = options.timezone; | ||
return [ | ||
@@ -59,10 +59,10 @@ '<entry xmlns="http://www.w3.org/2005/Atom" ' | ||
? "<gd:recurrence>" | ||
+ _str.content(RFC2445.genRecurrenceString(ev, tz, opts)) | ||
+ _str.content(RFC2445.genRecurrenceString(ev, opts)) | ||
+ "</gd:recurrence>" | ||
: "<gd:when startTime=\"" | ||
+ _str.attr(_str.date(options._start, ev.allDay)) + "\" " | ||
+ _str.attr(_str.date(options.start, ev.allDay)) + "\" " | ||
+ "endTime=\"" | ||
+ _str.attr(_str.date(options._end, ev.allDay, true)) + "\" />" | ||
+ _str.attr(_str.date(options.end, ev.allDay, true)) + "\" />" | ||
, "<gd:where valueString=\"" + _str.attr(tzCity) + "\"></gd:where>" | ||
, "<gd:where valueString=\"" + _str.attr(tz) + "\"></gd:where>" | ||
, ev.isNew | ||
@@ -89,3 +89,3 @@ ? "<published>" + _str.date(new Date) + "</published>" | ||
exports.version = '0.2.6'; | ||
exports.version = '0.2.9'; | ||
@@ -202,3 +202,2 @@ /** | ||
* @param {Object} ev: Event Object | ||
* @param {String} tz: timezone location | ||
* | ||
@@ -208,3 +207,3 @@ * return {String} RFC2445 recurrence string | ||
RFC2445.genRecurrenceString = function (ev, tz, opts) { | ||
RFC2445.genRecurrenceString = function (ev, opts) { | ||
if (!ev.frequency) return ''; | ||
@@ -214,7 +213,6 @@ | ||
tz = tz || ev.location; | ||
var options = { | ||
_start: ev.start | ||
, _end: ev.end | ||
start: ev.start | ||
, end: ev.end | ||
, timezone: 'GMT' | ||
}; | ||
@@ -225,10 +223,12 @@ | ||
tz = tz || options.timezone; | ||
// period: DTSTART, DTEND | ||
var rules = [ | ||
'DTSTART;' + (ev.allDay | ||
? _str.value(options._start) | ||
: _str.dateTZID(options._start, tz)) | ||
, 'DTEND;' + (ev.allDay | ||
? _str.value(options._end) | ||
: _str.dateTZID(options._end, tz)) | ||
'DTSTART' + (ev.allDay | ||
? ':' + _str.value(options.start) | ||
: ';' + _str.dateTZID(options.start, tz)) | ||
, 'DTEND' + (ev.allDay | ||
? ':' + _str.value(options.end) | ||
: ';' + _str.dateTZID(options.end, tz)) | ||
]; | ||
@@ -801,20 +801,11 @@ | ||
var date = new Date(); | ||
// @TODO | ||
// consedire apply timezone location in the future | ||
/* | ||
if (tz) { | ||
time.extend(date); | ||
date.setTimezone(tz); | ||
}; | ||
*/ | ||
date.setFullYear(parts[1]); | ||
date.setMonth(parts[2] - 1); | ||
date.setDate(parts[3]); | ||
date.setMilliseconds(0); | ||
date.setSeconds(parts[6]); | ||
date.setMinutes(parts[5]); | ||
date.setHours(parts[4]); | ||
date.setMinutes(parts[5]); | ||
date.setSeconds(parts[6]); | ||
date.setMilliseconds(0); | ||
date.setDate(parts[3]); | ||
date.setMonth(parts[2] - 1); | ||
date.setFullYear(parts[1]); | ||
@@ -828,7 +819,7 @@ return date; | ||
_date.parsefromTZID = function (v) { | ||
_date.parseFromTZID = function (v) { | ||
var parts = v.match(/TZID=([^:]+):(\d+)T(\d+)/); | ||
if (!parts) return; | ||
var date = parseDate.fromWeirdISOFormat(parts[2] + 'T' + parts[3], parts[1]); | ||
var date = _date.parseFromWeirdISOFormat(parts[2] + 'T' + parts[3], parts[1]); | ||
@@ -896,2 +887,10 @@ // debug: TZID parsed with date %s, date | ||
_string.UTCTime = function (v, utc) { | ||
var str = (JSON.stringify(v).replace(/[-, :,\.]/g, '')).substring(1, 16); | ||
str += utc ? 'Z' : ''; | ||
return str; | ||
}; | ||
/** | ||
@@ -898,0 +897,0 @@ * value() method |
0.2.9 / 2011-12-20 | ||
================== | ||
* remove time dependecy | ||
* add utc parameter to UTCTime string method. Cleaning | ||
* refact passing options for genRecurrenceString() and genEvent() methods | ||
0.2.8 / 2011-12-20 | ||
@@ -3,0 +10,0 @@ ================== |
@@ -26,3 +26,2 @@ /*! | ||
* @param {Object} ev: Object Event | ||
* @param {string} tz: timezone location | ||
* | ||
@@ -32,14 +31,18 @@ * return {String} event atom string | ||
module.exports.genEvent = function (ev, tz, opts) { | ||
tz = tz || ev.location; | ||
module.exports.genEvent = function (ev, opts) { | ||
// default options | ||
opts = opts || {}; | ||
var options = { | ||
_start: ev.start | ||
, _end: ev.end | ||
start: ev.start | ||
, end: ev.end | ||
, timezone: 'GMT' | ||
}; | ||
for (var k in options) | ||
options[k] = typeof opts[k] != 'undefined' ? opts[k] : options[k]; | ||
options[k] = opts[k] || options[k]; | ||
// timezone location | ||
tz = options.timezone; | ||
return [ | ||
@@ -54,8 +57,8 @@ '<entry xmlns="http://www.w3.org/2005/Atom" ' | ||
? "<gd:recurrence>" | ||
+ _str.content(RFC2445.genRecurrenceString(ev, tz, opts)) | ||
+ _str.content(RFC2445.genRecurrenceString(ev, opts)) | ||
+ "</gd:recurrence>" | ||
: "<gd:when startTime=\"" | ||
+ _str.attr(_str.date(options._start, ev.allDay)) + "\" " | ||
+ _str.attr(_str.date(options.start, ev.allDay)) + "\" " | ||
+ "endTime=\"" | ||
+ _str.attr(_str.date(options._end, ev.allDay, true)) + "\" />" | ||
+ _str.attr(_str.date(options.end, ev.allDay, true)) + "\" />" | ||
@@ -62,0 +65,0 @@ , "<gd:where valueString=\"" + _str.attr(tz) + "\"></gd:where>" |
@@ -14,3 +14,3 @@ | ||
exports.version = '0.2.8'; | ||
exports.version = '0.2.9'; | ||
@@ -17,0 +17,0 @@ /** |
@@ -80,3 +80,2 @@ /*! | ||
* @param {Object} ev: Event Object | ||
* @param {String} tz: timezone location | ||
* | ||
@@ -86,3 +85,3 @@ * return {String} RFC2445 recurrence string | ||
RFC2445.genRecurrenceString = function (ev, tz, opts) { | ||
RFC2445.genRecurrenceString = function (ev, opts) { | ||
if (!ev.frequency) return ''; | ||
@@ -92,7 +91,6 @@ | ||
tz = tz || ev.location; | ||
var options = { | ||
_start: ev.start | ||
, _end: ev.end | ||
start: ev.start | ||
, end: ev.end | ||
, timezone: 'GMT' | ||
}; | ||
@@ -103,10 +101,12 @@ | ||
tz = tz || options.timezone; | ||
// period: DTSTART, DTEND | ||
var rules = [ | ||
'DTSTART' + (ev.allDay | ||
? ':' + _str.value(options._start) | ||
: ':' + _str.UTCTime(options._start)) | ||
? ':' + _str.value(options.start) | ||
: ';' + _str.dateTZID(options.start, tz)) | ||
, 'DTEND' + (ev.allDay | ||
? ':' + _str.value(options._end) | ||
: ':' + _str.UTCTime(options._end)) | ||
? ':' + _str.value(options.end) | ||
: ';' + _str.dateTZID(options.end, tz)) | ||
]; | ||
@@ -113,0 +113,0 @@ |
@@ -361,20 +361,11 @@ /*! | ||
var date = new Date(); | ||
// @TODO | ||
// consedire apply timezone location in the future | ||
/* | ||
if (tz) { | ||
time.extend(date); | ||
date.setTimezone(tz); | ||
}; | ||
*/ | ||
date.setFullYear(parts[1]); | ||
date.setMonth(parts[2] - 1); | ||
date.setDate(parts[3]); | ||
date.setMilliseconds(0); | ||
date.setSeconds(parts[6]); | ||
date.setMinutes(parts[5]); | ||
date.setHours(parts[4]); | ||
date.setMinutes(parts[5]); | ||
date.setSeconds(parts[6]); | ||
date.setMilliseconds(0); | ||
date.setDate(parts[3]); | ||
date.setMonth(parts[2] - 1); | ||
date.setFullYear(parts[1]); | ||
@@ -455,5 +446,5 @@ return date; | ||
_string.UTCTime = function (v) { | ||
var str = (JSON.stringify(v).replace(/[-, :,\.]/g, '')).substring(1, 16) | ||
, tz = false | ||
_string.UTCTime = function (v, utc) { | ||
var str = (JSON.stringify(v).replace(/[-, :,\.]/g, '')).substring(1, 16); | ||
str += utc ? 'Z' : ''; | ||
@@ -460,0 +451,0 @@ return str; |
{ | ||
"name": "calendar-tools" | ||
, "version": "0.2.8" | ||
, "version": "0.2.9" | ||
, "description": "Calendar object model" | ||
@@ -12,5 +12,2 @@ , "keywords": ["calendar", "google calendar", "fullCalendar", "recurring events", "icalendar", "rfc2445"] | ||
} | ||
, "dependencies": { | ||
"time": "0.6.x" | ||
} | ||
, "devDependencies": { | ||
@@ -17,0 +14,0 @@ "expresso": "x.x.x" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
0
499573
10377
- Removedtime@0.6.x
- Removedtime@0.6.5(transitive)