|
const utcMethod = Date.prototype[method.replace(re, "$1UTC")]; |
The above line fails for getYear and setYear because there are no get/setUTCYear methods, since they should map to get/setUTCFullYear instead.
I am aware get/setYear are deprecated, but they may still be called if trying to use UTCDate as a drop-in replacement for Date and passing it on to old libraries' code outside of your control, which opens up a potential opening to disrupt the UTC state of the UTCDate instance.