From 9395767d11dc4dc2dfc57c36d255941042ef1290 Mon Sep 17 00:00:00 2001 From: "Michael J. Radwin" Date: Sun, 6 Dec 2020 18:56:19 -0800 Subject: [PATCH] Fix iCalendar fast start times --- package.json | 12 ++++++------ src/icalendar.js | 3 --- src/icalendar.spec.js | 7 +++++++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 08462b8..a1fccd4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hebcal/icalendar", - "version": "2.8.0", + "version": "2.8.1", "author": "Michael J. Radwin (https://github.com/mjradwin)", "keywords": [ "ical", @@ -24,7 +24,7 @@ }, "dependencies": { "@hebcal/core": "^2.7.0", - "@hebcal/rest-api": "^2.8.0", + "@hebcal/rest-api": "^2.8.1", "md5": "^2.3.0" }, "scripts": { @@ -55,19 +55,19 @@ }, "devDependencies": { "@ava/babel": "^1.0.1", - "@babel/core": "^7.12.8", + "@babel/core": "^7.12.9", "@babel/polyfill": "^7.12.1", "@babel/preset-env": "^7.12.7", "@babel/register": "^7.12.1", - "@rollup/plugin-babel": "^5.2.1", + "@rollup/plugin-babel": "^5.2.2", "@rollup/plugin-commonjs": "^16.0.0", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^10.0.0", "ava": "^3.13.0", - "eslint": "^7.14.0", + "eslint": "^7.15.0", "eslint-config-google": "^0.14.0", "jsdoc": "^3.6.6", "jsdoc-to-markdown": "^6.0.1", - "rollup": "^2.33.3" + "rollup": "^2.34.2" } } diff --git a/src/icalendar.js b/src/icalendar.js index fe28c1d..fb22f19 100644 --- a/src/icalendar.js +++ b/src/icalendar.js @@ -114,9 +114,6 @@ export function eventToIcal(e, options) { let [hour, minute] = e.eventTimeStr.split(':'); hour = +hour; minute = +minute; - if (hour < 12) { - hour += 12; - } startDate += 'T' + pad2(hour) + pad2(minute) + '00'; endDate = startDate; dtargs = `;TZID=${options.location.tzid}`; diff --git a/src/icalendar.spec.js b/src/icalendar.spec.js index c35c1ab..c7c1006 100644 --- a/src/icalendar.spec.js +++ b/src/icalendar.spec.js @@ -373,4 +373,11 @@ test('fastStartEnd', (t) => { 'SUMMARY:Fast ends', ]; t.deepEqual(summary, expected); + const dtstart = icals.map((i) => i.split('\r\n').find((s) => s.startsWith('DTSTART'))); + const expected2 = [ + 'DTSTART;TZID=America/New_York:20210627T031900', + 'DTSTART;VALUE=DATE:20210627', + 'DTSTART;TZID=America/New_York:20210627T210600', + ]; + t.deepEqual(dtstart, expected2); });