Skip to content

UTCDate.prototype.[get,set]Year are not UTC-patched #14

@jhmaster2000

Description

@jhmaster2000

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions