I am trying to parse the .ics file in my application. My application has server side java layer and client side javascript part to it. I am using ical4j library to parse it.
Problem is DTSTART of the event is not in UTC format sometimes. And whenever it is not in UTC .ics file has VTIMEZONE component which I am parsing and getting TZID property from it.
Java layer finally send JSON to client. In the above mentioned case DTSTART, DTEND and TZID are being sent in JSON.
Client has to convert DTSTART and DTEND to UTC using TZID. I tried with moment.js since i could not find any other api which can do this.
moment.tz("2014-02-06 05:30", "NorthAmerica/Eastern").format()
With moment.js below is the error I get,
TypeError: Cannot call method 'rule' of undefined
But below code works fine,
moment.tz("2014-02-06 17:30", "America/Toronto").format()
Is it not possible to use TZID as is (i.e NorthAmerica/Eastern) from .ics file? Also Is there any other way or JS library which can give me UTC with all timezones and also considering Observance?