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

Intl.DateTimeFormat.format() output for fi locale no longer matches chrome or latest ICU data (v22) #56737

Closed
michaelfaith opened this issue Jan 24, 2025 · 9 comments
Assignees
Labels
i18n-api Issues and PRs related to the i18n implementation. icu Issues and PRs related to the ICU dependency. v8 engine Issues and PRs related to the V8 dependency.

Comments

@michaelfaith
Copy link

Version

22.13

Platform

MacOS, Windows, and Linux

Subsystem

No response

What steps will reproduce the bug?

v22 sandbox (incorrect month format): https://codesandbox.io/p/devbox/node22-finnish-datetimeformat-bug-vt3jx6

en: Jan 24
fi: 24.1.

v20 sandbox (correct): https://codesandbox.io/p/devbox/node22-finnish-datetimeformat-bug-v20-f8zvvg

en: Jan 24
fi: 24. tammik.

How often does it reproduce? Is there a required condition?

Consistently

What is the expected behavior? Why is that the expected behavior?

FI short month format should match ICU data. Finnish month in short format should be the abbreviated version of the month (e.g. tammik.)

What do you see instead?

It currently is outputting the same as numeric format. e.g. 1.

Additional information

I noticed that the ICU data did change in the November update for the Finnish locale, but not in this way. This only seems to be impacting Finnish from what I can tell, and only the short month format. Furthermore, this is working fine in v20. It only presented this regression after updating to v22.

screenshot of finnish data delta

@juanarbol juanarbol added the v8 engine Issues and PRs related to the V8 dependency. label Jan 24, 2025
@juanarbol
Copy link
Member

Hey, thanks for the report. I've never back ported anything from V8, I can give it a try.

@targos
Copy link
Member

targos commented Jan 29, 2025

@nodejs/i18n-api

@srl295
Copy link
Member

srl295 commented Jan 29, 2025

hi @michaelfaith thanks for filing this. Please include the source to the test for the record, which I'll include here: (I'm not familiar with code sandbox)

const options = {
    month: 'short',
    day: "numeric"
};

const enFormatter = new Intl.DateTimeFormat('en', options);
const fiFormatter = new Intl.DateTimeFormat('fi', options);

console.log(`en: ${enFormatter.format(new Date())}`);
console.log(`fi: ${fiFormatter.format(new Date())}`);

@srl295
Copy link
Member

srl295 commented Jan 29, 2025

Working as designed, matches CLDR 46 data (ICU 76.1).

A date format change is not a regression, more comments here: #51090 (comment)

@srl295 srl295 added icu Issues and PRs related to the ICU dependency. i18n-api Issues and PRs related to the i18n implementation. labels Jan 29, 2025
@srl295 srl295 self-assigned this Jan 29, 2025
@srl295
Copy link
Member

srl295 commented Jan 29, 2025

@targos appreciate the team mention as always…

@srl295 srl295 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 29, 2025
@michaelfaith
Copy link
Author

michaelfaith commented Jan 29, 2025

Working as designed, matches CLDR 46 data (ICU 76.1).

A date format change is not a regression, more comments here: #51090 (comment)

@srl295 But it doesn't match CLDR 46 data. It's returning the equivalent of numeric month format, when requesting short. In my OP I shared the delta for the Finnish locale data, and it did not change to being a number. Would you mind clarifying? cc @targos

https://unicode.org/cldr/charts/46/delta/fi.html

Image

@srl295
Copy link
Member

srl295 commented Jan 29, 2025

Working as designed, matches CLDR 46 data (ICU 76.1).
A date format change is not a regression, more comments here: #51090 (comment)

@srl295 But it doesn't match CLDR 46 data. It's returning the equivalent of numeric month format. In my OP I shared the delta for the Finnish locale data, and it did not change to being a number. Would you mind clarifying?

https://unicode.org/cldr/charts/46/delta/fi.html

Image

The month name wasn't changed to 1. it's more subtle than that.

You are requesting:

const options = {
    month: 'short',
    day: "numeric"
};

In CLDR terms, this is turned into a "date format skeleton". Don't worry, no scary music!

The skeleton generated here is MMMd which means "a short month" (MMM) "plus a numeric day" (d).

Go to the chart you linked to and visit https://unicode.org/cldr/charts/46/delta/fi.html#Formats%20-%20Flexible%20-%20Date%20Formats and you will see:

MMMd maps to d.M. - in other words, a numeric date, a period, a numeric month, and another period.

The chart also shows that this used to be d. MMM - that is, a numeric date, and a short month.

You can actually inspect this in Node.js as follows:

> fiFormatter.resolvedOptions()
{

  month: 'numeric',
  day: 'numeric'
}

note that the 'month' resolved to numeric.

also:

> fiFormatter.formatToParts(new Date())
[
  { type: 'day', value: '29' },
  { type: 'literal', value: '.' },
  { type: 'month', value: '1' },
  { type: 'literal', value: '.' }
]

@srl295
Copy link
Member

srl295 commented Jan 29, 2025

@michaelfaith anyway I also confirmed that this was a purposeful change, discussed and vetted. If you think it's in error (incorrect culturally), you could submit a ticket upstream at cldr.unicode.org or, even better, get involved in the Finnish vetting process.

@michaelfaith
Copy link
Author

@srl295 This was super helpful. Thanks for the thorough explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n-api Issues and PRs related to the i18n implementation. icu Issues and PRs related to the ICU dependency. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

4 participants