问题
My application stores the UTC offset on users profile (-03:00, for instance) and as this page from iCal.net Wiki mentions it seems that I can only use the timezone to assign to the event: https://github.com/rianjs/ical.net/wiki/Working-with-time-zones.
Do I have any other option?
回答1:
ical.net uses NodaTime under the hood to do time zone conversions, which means you can use the Etc/GMT
family of zones. Wikipedia has a nice list. In your case, you would specify a time zone of Etc/GMT-3
:
const string ianaZone = "Etc/GMT-3";
var start = DateTime.Now;
var end = start.AddHours(1);
var vEvent = new Event
{
DtStart = new CalDateTime(start, ianaZone),
DtEnd = new CalDateTime(end, ianaZone),
};
来源:https://stackoverflow.com/questions/41331708/is-it-possible-to-use-utc-offset-instead-of-timezone-name-on-ical-net