node-ical | NodeJS class for parsing iCalendar/ICS files | Runtime Evironment library
kandi X-RAY | node-ical Summary
kandi X-RAY | node-ical Summary
NodeJS class for parsing iCalendar/ICS files
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Parses a timezone .
- Helper function to get an object from a key
- Promise callback function
- Get the IZ zone from a given timestamp
- Checks if value is dateOnly .
node-ical Key Features
node-ical Examples and Code Snippets
Community Discussions
Trending Discussions on node-ical
QUESTION
What is this about
I'm developing a web application in NodeJS to display information about the agenda of the users which are synchronized with the central server of my University. For that, I wrote a script that downloads an ICS file every hour to update my local agenda (stored in an SQLite database).
What seems to be the problem
Someone reported to me that some events in their agenda aren't synchronized properly with the University's version, the start time differs. Here's the problem. I have an Event A and an Event B which are both displayed as starting at 6am UTC on the university web page. But, when I retrieve them from the server in iCal format, they are represented as such (I've removed the properties unrelated to my issue) :
...ANSWER
Answered 2021-Oct-12 at 21:59Welcome to the joys of daylight saving changes and timezones. Somewhere there someone is viewing dates with a timezone set as most people do, this is expected. There are 2 dates there, and it appears one is one side of a daylight saving change and the other is on the other side.
Unlike UTC some timezones have daylight saving and of course timezones don't change from/to daylight saving at the same time, so lots potential for multiple time differences to appear to be inconsistent across events.
If we take London as an example, on the 8 of November 2021, london time is same as UTC time:
https://www.timeanddate.com/worldclock/meetingtime.html?day=8&month=11&year=2021&p1=195&p2=136&iv=0
However on 25 October 2021, at 6am UTC time, London is 7am.
https://www.timeanddate.com/worldclock/meetingtime.html?iso=20211025&p2=195&p3=136
Always check what timezones are set on every device and calendar app and be alert around daylight saving changes.
QUESTION
I am trying to experiment with sails.js (with node.js).
I have a controller as follows. Thsi controller parse an ical url passed in the url param as ical_url
and I am trying to parse it and build a normalized json objetc pe rmy need. I have a parse
function
that is only exposed outside this controller. That uses node-ical npm package (https://www.npmjs.com/package/node-ical)
to parse the ical content. In the ical.fromURL
method, I have a callback function withing which I
initialized a variable normalized_data
and storing data in it. My intention to use that data
and call to decorate
method for some processing and get the json back. Please
look at the line starting with //>>>>>>
and as per my desire there, I do not have access of normalized_data
As per https://github.com/jens-maus/node-ical/blob/HEAD/index.js#L87 ical.fromURL
is returning a promise
but I am having difficulty understanding how to use the data which is part of that promise.
Can someone help me out to make the change needed in this file (especially in the parse
method) to
meet my expectation? Thanks in advance.
ANSWER
Answered 2020-Apr-06 at 13:32The problem is from not accounting for the asynchronous nature of the fromURL
method.
The code is calling fromURL
, which will result in the callback being called when the method has completed sometime in the future, and then immediately trying to send the data that hasn't been received yet as response to the client.
You need to send the response after the asynchronous action has completed and you've actually received some data, more like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install node-ical
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page