Comparing version 0.1.0 to 0.1.1
@@ -42,2 +42,3 @@ // Copyright (C) 2011 Tri Tech Computers Ltd. | ||
exports.parse_calendar = parser.parse_calendar; | ||
@@ -238,2 +239,3 @@ | ||
return dst.getPropertyValue('TZOFFSETTO'); | ||
return std.getPropertyValue('TZOFFSETTO'); | ||
} | ||
@@ -240,0 +242,0 @@ |
@@ -77,2 +77,5 @@ // Copyright (C) 2011 Tri Tech Computers Ltd. | ||
parse: function(value, parameters, calendar) { | ||
if(parameters['VALUE'] === 'DATE') | ||
return _types['DATE'].parse(value); | ||
var tz = parameters['TZID']; | ||
@@ -85,2 +88,3 @@ var d = [parseInt(value.substr(0,4), 10), | ||
parseInt(value.substr(13,2), 10)]; | ||
var utc = value.length > 15 ? value[15] === 'Z' : false; | ||
@@ -92,3 +96,6 @@ if(tz !== undefined) { | ||
return new Date(d[0], d[1]-1, d[2], d[3], d[4], d[5]); | ||
if(utc) | ||
return new Date(Date.UTC.apply(null, d)); | ||
else | ||
return new Date(d[0], d[1]-1, d[2], d[3], d[4], d[5]); | ||
} | ||
@@ -117,2 +124,13 @@ }, | ||
return dur.join(''); | ||
}, | ||
parse: function(value) { | ||
var match = /P(\d+W)?(\d+D)?(?:T(\d+H)?(\d+M)?(\d+S)?)/.exec(value).slice(1); | ||
var mul = [ 60*60*24*7, 60*60*24, 60*60, 60, 1 ]; | ||
var dur = 0; | ||
for(var i=0; i < match.length; ++i) { | ||
if(match[i] !== undefined) dur += parseInt(match[i], 10) * mul[i]; | ||
} | ||
return dur; | ||
} | ||
@@ -119,0 +137,0 @@ }, |
{ | ||
"name": "icalendar", | ||
"version": "0.1.0", | ||
"author": "James Emerton <james@tri-tech.com>", | ||
"description": "RFC5545 iCalendar parser/generator", | ||
"keywords": ["icalendar", "rfc5545"], | ||
"directories": { "lib": "lib" }, | ||
"main": "lib/icalendar", | ||
"devDependencies": { | ||
"jasmine-node": ">=1.0.13" | ||
} | ||
} | ||
"name": "icalendar", | ||
"version": "0.1.1", | ||
"author": "James Emerton <james@tri-tech.com>", | ||
"description": "RFC5545 iCalendar parser/generator", | ||
"keywords": [ | ||
"icalendar", | ||
"rfc5545" | ||
], | ||
"directories": { | ||
"lib": "lib" | ||
}, | ||
"main": "lib/icalendar", | ||
"devDependencies": { | ||
"jasmine-node": ">=1.0.13" | ||
}, | ||
"dependencies": {}, | ||
"engines": { | ||
"node": "*" | ||
} | ||
} |
@@ -60,2 +60,4 @@ // Test search | ||
icalendar.parse_value('DATE-TIME', '20111109T173216').valueOf()); | ||
assert.equal(60*60*24*7 + 60*60*24*2 + 60*60*3 + 60*4 + 5, | ||
icalendar.parse_value('DURATION', 'P1W2DT3H4M5S')); | ||
@@ -62,0 +64,0 @@ assert.deepEqual({FREQ: 'YEARLY', BYMONTH: 11, BYDAY: [1,0]}, |
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
139807
1166