ical.js
ical.js copied to clipboard
ICAL.Time.fromUnixTime
Why is this function missing? The other from* methods have their static factory method in place, like ICAL.Time.fromData, fromDateString, ... But fromUnixTime is defined only at ICAL.Time instance.
I have found nothing about this in the documentation nor the issues.
My current implementation is the following, but I don't think it has a good performance with that repeated Time object initializations. What is the correct way to do this? I also need to make the time zone floating.
function fromUnixTime (unixTime) {
const icalTime = new ICAL.Time();
icalTime.fromUnixTime(unixTime);
return new ICAL.Time({...icalTime.toJSON(), timezone: null});
}