DataForm: Sort day, month, and year of DateTime control according to locale #71580
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
This PR adds the
dateOrderprop to theTimePickercomponent in theDateTimecontrol so that the day, month, and year are sorted appropriately for the locale.Why?
The order of days, months, and years varies by country. The
TimePickercomponent supports thedateProp, whose value changes the order of the control. By making the value of thedateOrderprop translatable, the correct order will be automatically guaranteed depending on the locale.See #62481 for more details.
How?
I realized that if the translatable text is simply passed to the
dateOrderprop, the following type error occurs. ThedateOrderprop is already used here, but I didn't notice this type error because the PrivatePublishDateTimePicker component is written in JavaScript, not TypeScript.To avoid this, type assertions were needed.
Another approach would be to allow
TranslatableTextin the type itself, but I'm not sure which is the ideal approach:Testing Instructions
外観) > Editor (エディター) > Pages (固定ページ)テーブル)Screenshots or screencast
Before
After