Skip to content

Intl.DateTimeFormat constructor breaks the inheritance when passing wrong options #5335

@Vellumic

Description

@Vellumic

Describe the bug
The prototype lookup never happens when creating an Intl.DateTimeFormat with wrong options.

To Reproduce
This JavaScript code reproduces the issue:

const proxyConstructor = new Proxy(Intl.DateTimeFormat, {
  get(target, prop) {
    if (prop === "prototype") {
      console.log("1. Prototype accessed");
    }
    return target[prop];
  }
});

try {
  new proxyConstructor("en", { timeZone: "Invalid/Zone" });
} catch (e) {
  console.log("2. Error thrown");
}

Expected behavior
Running this code, we should see this in console

1. Prototype accessed
2. Error thrown

But get this instead

2. Error thrown

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions