You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Time.constructor accepts two parameters: data and zone, and calls then this.fromData(data, zone);
fromData() accepts two pamameters: aData and aZone. Here aZone is optional, so the zone parameters of the constructor should also be optional, but is not.
In static time.fromData timezone is also optional. So, again, the type annotations for zone in time.constructor should be changed to optional.
Besides, time.resetTo() passes zone as the first parameter to this.fromData, not as second. Likewise for time.getEpochTime(). That said, the typescript rules exported by ical.js were not applied towards the code of ical.js itself.
time.fromData is implemented as:
if (aData) {
for (let [key, value] of Object.entries(aData)) {
// ical type cannot be set
if (key === 'icaltype') continue;
this[key] = value;
}
}
if (aZone) {
this.zone = aZone;
}
So time.getEpoch() creates this.#epochTime with member timezone, but it should set zone instead.
Finally fromData handles in aData as parameters zone and timezone the same way, but neither of these parameters are allowed by the type definitions of the function.
Make clearer whether the time member should be called zone or timezone and use this consistently.
Make timezone parameter of time.constructor() optional and allow zone as member of the first parameter. zone as first parameter has worked, before introducing the types.
In static get epochTime change timezone with zone
Possibly in fromDateTimeString() change timeData.zone = zoneId; to timeData.zone = zoneId;
If fromData checks if (aData && "timezone" in aData) and if (aData && "zone" in aData) consider adding the zone and timezone parameters to the type of aData.
The text was updated successfully, but these errors were encountered:
Time.constructor accepts two parameters: data and zone, and calls then
this.fromData(data, zone);
fromData() accepts two pamameters: aData and aZone. Here aZone is optional, so the zone parameters of the constructor should also be optional, but is not.
In static time.fromData timezone is also optional. So, again, the type annotations for zone in time.constructor should be changed to optional.
Besides, time.resetTo() passes zone as the first parameter to this.fromData, not as second. Likewise for time.getEpochTime(). That said, the typescript rules exported by ical.js were not applied towards the code of ical.js itself.
time.fromData is implemented as:
So time.getEpoch() creates this.#epochTime with member timezone, but it should set
zone
instead.Finally fromData handles in aData as parameters
zone
andtimezone
the same way, but neither of these parameters are allowed by the type definitions of the function.zone
as member of the first parameter.zone
as first parameter has worked, before introducing the types.timeData.zone = zoneId;
totimeData.zone = zoneId;
if (aData && "timezone" in aData)
andif (aData && "zone" in aData)
consider adding the zone and timezone parameters to the type of aData.The text was updated successfully, but these errors were encountered: