Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICAL.Time.fromUnixTime #435

Open
radarfox opened this issue Apr 15, 2020 · 0 comments
Open

ICAL.Time.fromUnixTime #435

radarfox opened this issue Apr 15, 2020 · 0 comments

Comments

@radarfox
Copy link

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});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants