ICAL.Time.fromUnixTime
- Dominant language
- JavaScript
- Stars
- 1.2k
- Forks
- 156
- Avg merge
- 4d 43m
- Merged PRs (30d)
- 3
Description
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.
```js
function fromUnixTime (unixTime) {
const icalTime = new ICAL.Time();
icalTime.fromUnixTime(unixTime);
return new ICAL.Time({...icalTime.toJSON(), timezone: null});
}
```
Contributor guide
Research direction
Compare the existing ICAL.Time.fromData and fromDateString static factories with the instance-level ICAL.Time.fromUnixTime method, then inspect how timezone is represented in the Time object. Done means a static factory supports Unix timestamps and the requested floating-time result without repeated Time initialization.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100