Skip to content

setFullYear with years 0-99 returns 1900+year instead of the actual year #80

Description

@pavlos256

Using setFullYear with a year in the 0-99 range incorrectly adds 1900 to the year. For example, setFullYear(20) sets the year to 1920 instead of 20. The real setFullYear(20) correctly sets the year to 20 AD.

Reproduction

const timezoneMock = require("timezone-mock");

timezoneMock.register("UTC");

const d = new Date(2026, 0, 1);
d.setFullYear(20);

console.log(d.getFullYear()); // Expected: 20

timezoneMock.unregister();
Version Result
Native 20
1.3.6 20
1.4.0 & 1.4.1 1920

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions