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

Bug with DateTimeFormat #9

Closed
mrbrianevans opened this issue May 11, 2022 · 3 comments
Closed

Bug with DateTimeFormat #9

mrbrianevans opened this issue May 11, 2022 · 3 comments

Comments

@mrbrianevans
Copy link

Hi there,
I've been using your polyfill and I think I've noticed an unexpected error that occurs when formatting a date time.
This error does not occur in the spec playground.

To reproduce

Run

Temporal.Instant.from(new Date().toISOString()).toLocaleString('en-GB', {dateStyle:'long'})

Expected behaviour

In the official spec playground, the output is:

"11 May 2022" 

Actual behaviour

When run with this polyfill, it produces this error:

Uncaught TypeError: can't set option year when dateStyle is used
    buildFormat fromAndWith.ts:329
    toLocaleString intlFactory.ts:208
    <anonymous> pen.js:2
fromAndWith.ts:329
@hossameldeen
Copy link

I'm facing a similar issue:

This code:

console.log(
  Temporal.PlainTime.from("15:30:37").toLocaleString([], {
    timeStyle: "short"
  })
);

results in this error:

TypeError: Can't set option hour when timeStyle is used

Codesandbox link: https://codesandbox.io/s/temporal-and-lodash-update-forked-dohu6n?file=/src/index.js

Perhaps this issue is relevant?

Also, it seems to work fine with Javascript Intl. API. And tried PlainDateTime, but it's the same issue.

image

@arshaw
Copy link
Member

arshaw commented Apr 22, 2023

Confirmed, I'll fix this

@arshaw
Copy link
Member

arshaw commented Jan 7, 2024

This has been fixed in v0.2.0

Please lmk once you confirm. Thanks!

@arshaw arshaw closed this as completed Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants