Open
Description
After installing the package I got date/mini.js
with the following content
export class UTCDateMini extends Date {
constructor() {
super();
this.setTime(arguments.length === 0 ?
// Enables Sinon's fake timers that override the constructor
Date.now() : arguments.length === 1 ? typeof arguments[0] === "string" ? +new Date(arguments[0]) : arguments[0] : Date.UTC(...arguments));
}
getTimezoneOffset() {
return 0;
}
getDate(){return this.getUTCDate();}
setDate(){return this.setUTCDate();}
getDay(){return this.getUTCDay();}
getFullYear(){return this.getUTCFullYear();}
setFullYear(){return this.setUTCFullYear();}
getHours(){return this.getUTCHours();}
setHours(){return this.setUTCHours();}
getMilliseconds(){return this.getUTCMilliseconds();}
setMilliseconds(){return this.setUTCMilliseconds();}
getMinutes(){return this.getUTCMinutes();}
setMinutes(){return this.setUTCMinutes();}
getMonth(){return this.getUTCMonth();}
setMonth(){return this.setUTCMonth();}
getSeconds(){return this.getUTCSeconds();}
setSeconds(){return this.setUTCSeconds();}
getTime(){return this.getUTCTime();}
setTime(){return this.setUTCTime();}
getYear(){return this.getUTCYear();}
setYear() {return this.setUTCYear();}
}
The problem is Date
doesn't have methods
this.getUTCTime()
this.setUTCTime()
this.getUTCYear()
this.setUTCYear()
And since setTime
called in the constructor, the following error happens in browser
dev.js:1102 Uncaught TypeError: this.setUTCTime is not a function
at UTCDate.setTime (mini.js:27:25)
at new UTCDateMini (mini.js:4:10)
at new UTCDate (index.js:16:8)
at parse (date.ts:7:63)
which make the lib completely unusable.
I have no idea what produces this code.
I'm using Typescript with "module": "NodeNext"
and "moduleResolution": "NodeNext"
. The version of @date-fns/utc
is 2.1.0
Metadata
Metadata
Assignees
Labels
No labels
Activity