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

Fix incorrect time patterns for some cultures on browser in HybridGlobalization #103804

Merged
merged 6 commits into from
Jun 24, 2024

Conversation

ilonatommy
Copy link
Member

Fixes #103745.

This PR makes improvements to values returned in date/time format APIs. It does not make all the locales' values match ICU's values due to Web API responses differences, but corrects majority of them.
Originally the ICU's expected behavior was saved in a form of a comment next to the specific test case. If this PR's fix made HybridGlobalization response match the comment , the comment got removed. If there are still discrepancies (e.g. node behaves different than chrome) the ICU value is left in the comment.

Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-globalization
See info in area-owners.md if you want to be subscribed.

@ilonatommy
Copy link
Member Author

ilonatommy commented Jun 21, 2024

cc @PopSlime, HybridGlobalization relies on JS methods and there's no method in Intl that would return a "format" of date. We are working it around by taking a specific date, formatting it using among others toLocaleString and then we parse the result to determine the generic format of date / time for the given locale. I added a function that tries to find the parts of the already formatted date pattern that are "fixed" and these that are "variant" and put the fixed ones in quotes. If you have any suggestions how to improve this process, I would be glad to talk about it.

@ilonatommy
Copy link
Member Author

/azp run runtime-wasm

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavelsavara
Copy link
Member

are we going to backport it to Net8 ?

@ilonatommy
Copy link
Member Author

are we going to backport it to Net8 ?

I would like to.

@ilonatommy
Copy link
Member Author

/azp run runtime-wasm

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ilonatommy
Copy link
Member Author

/azp run runtime-wasm

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ilonatommy
Copy link
Member Author

/azp run runtime-wasm

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mkhamoyan
Copy link
Contributor

Can we also enable test cases from #103681 ?

@ilonatommy
Copy link
Member Author

/azp run runtime-wasm

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ilonatommy ilonatommy merged commit 8169bde into dotnet:main Jun 24, 2024
159 of 169 checks passed
@ilonatommy
Copy link
Member Author

/backport to release/8.0-staging

Copy link
Contributor

Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/9662243985

Copy link
Contributor

@ilonatommy backporting to release/8.0-staging failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: Fix.
Using index info to reconstruct a base tree...
M	src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Browser.cs
A	src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoFullDateTimePattern.cs
A	src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoLongDatePattern.cs
A	src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoLongTimePattern.cs
A	src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoShortTimePattern.cs
A	src/mono/browser/runtime/hybrid-globalization/calendar.ts
A	src/mono/browser/runtime/hybrid-globalization/culture-info.ts
Falling back to patching base and 3-way merge...
Auto-merging src/mono/wasm/runtime/hybrid-globalization/culture-info.ts
CONFLICT (content): Merge conflict in src/mono/wasm/runtime/hybrid-globalization/culture-info.ts
Auto-merging src/mono/wasm/runtime/hybrid-globalization/calendar.ts
CONFLICT (content): Merge conflict in src/mono/wasm/runtime/hybrid-globalization/calendar.ts
CONFLICT (modify/delete): src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoLongDatePattern.cs deleted in HEAD and modified in Fix.. Version Fix. of src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoLongDatePattern.cs left in tree.
Auto-merging src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Browser.cs
CONFLICT (content): Merge conflict in src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Browser.cs
Auto-merging src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoShortTimePattern.cs
Auto-merging src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoLongTimePattern.cs
Auto-merging src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoFullDateTimePattern.cs
CONFLICT (content): Merge conflict in src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoFullDateTimePattern.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 Fix.
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

Copy link
Contributor

@ilonatommy an error occurred while backporting to release/8.0-staging, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

ilonatommy added a commit that referenced this pull request Jun 26, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jul 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect time patterns for some cultures on browser in HybridGlobalization
3 participants