-
Notifications
You must be signed in to change notification settings - Fork 618
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 Android Intl to clear needDefault flag correctly #1014
Conversation
Fixed an issue where needDefault flag was not being cleared when the option `weekday` was set.
Hey @Maturia, thanks for reporting and investigating this. I have a question regarding the test case you've shared. While this seems to be a legitimate bug, running Can you confirm the issue you're seeing? |
I believe issues in this PR is same from #926 (comment) |
@dlebedynskyi I understand the issue being reported here. This fixes a legitimate bug in Hermes. I'm just confused because the example code deals with |
I've done some quick test on 0.71 demo app
@neildhar looks like you are correct and fix should be in However looking at code Line 1469 in de48d91
I see that same options Should fix be in |
@dlebedynskyi Thank you for confirming. This fix is correct for the bug in @Maturia could you update the summary and add a test for this? The easiest place to do it would be to add it to |
@neildhar has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: Original Author: Maturia@users.noreply.github.com Original Git: 64daca6 Original Reviewed By: tmikov Original Revision: D49856174 Similar to year, month, and day, specifying "weekday" as an option to `toLocaleString` should result in only the weekday being printed. To force this, use the `kDateRequired` bit as we do for the other fields. Pull Request resolved: #1014 Pulled By: neildhar Reviewed By: tmikov Differential Revision: D50992823 fbshipit-source-id: 8527286ea5684ae0acf52d3ff666edb517a6fe60
Summary: Similar to year, month, and day, specifying "weekday" as an option to `toLocaleString` should result in only the weekday being printed. To force this, use the `kDateRequired` bit as we do for the other fields. Pull Request resolved: #1014 Test Plan: Added a test in the next diff. Reviewed By: tmikov Differential Revision: D49856174 Pulled By: neildhar fbshipit-source-id: ed52f425e4240f672931d236bc53cc58724b6747
Fixed an issue where needDefault flag was not being cleared when the option
weekday
was set.Summary
The current Intl implementation on Android does not correctly follow the RFC for Intl implementation. Specifying a value for the option
weekday
,year
,month
, orday
should clear theneedDefaults
flag, which will prevent the auto-formatted date from automatically being appended to the formatted string (4a here: https://tc39.es/ecma402/#sec-todatetimeoptions).Current implementation:
With fix: