Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polyfill: Using both dateStyle and timeStyle throws a TypeError #3061

Open
anba opened this issue Dec 11, 2024 · 2 comments
Open

Polyfill: Using both dateStyle and timeStyle throws a TypeError #3061

anba opened this issue Dec 11, 2024 · 2 comments
Labels

Comments

@anba
Copy link
Contributor

anba commented Dec 11, 2024

new Temporal.PlainDateTime(2024, 12, 11).toLocaleString("en", {dateStyle: "full", timeStyle: "full"})

Throws:

Uncaught TypeError: can't set option hour when dateStyle is used
    getSlotLazy intl.mjs:57
    extractOverrides intl.mjs:595
    format intl.mjs:232
    Call Call.js:19
    boundFormat intl.mjs:169
    toLocaleString plaindatetime.mjs:262
    <anonymous> debugger eval code:1
@ptomato
Copy link
Collaborator

ptomato commented Dec 12, 2024

Haha, the bot code seems somewhat plausible but will unfortunately regress #2795. So a different solution is needed. I assume this was missed because there's a test262 coverage gap, so we should have test262 coverage for this case as well.

(Edit: My comment no longer makes sense because the bot comment has been removed. For posterity, I was referring to a comment added by an AI bot that included code attempting to fix the bug.)

@ptomato ptomato added non-prod-polyfill THIS POLYFILL IS NOT FOR PRODUCTION USE! test262 labels Dec 12, 2024
@ptomato
Copy link
Collaborator

ptomato commented Feb 15, 2025

I'll submit a PR to fix the reference code. The spec is already correct and no change is needed there.

Same as other issues, this is a test262 coverage gap, so I'll leave the issue open.

@ptomato ptomato removed the non-prod-polyfill THIS POLYFILL IS NOT FOR PRODUCTION USE! label Feb 15, 2025
ptomato added a commit that referenced this issue Feb 15, 2025
Adjusting the options to not print the time zone name in timeStyle long or
full (#2795) inadvertently regressed formatting a PlainDateTime with both
dateStyle and timeStyle specified.

See: #3061
ptomato added a commit that referenced this issue Feb 24, 2025
Adjusting the options to not print the time zone name in timeStyle long or
full (#2795) inadvertently regressed formatting a PlainDateTime with both
dateStyle and timeStyle specified.

See: #3061
ptomato added a commit that referenced this issue Feb 25, 2025
Adjusting the options to not print the time zone name in timeStyle long or
full (#2795) inadvertently regressed formatting a PlainDateTime with both
dateStyle and timeStyle specified.

See: #3061
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
@ptomato @anba and others