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

[adapters] Fix localisation of the placeholder #6547

Merged
merged 6 commits into from
Oct 19, 2022

Conversation

alexfauquette
Copy link
Member

@alexfauquette alexfauquette commented Oct 18, 2022

Fix #6540

Luxon has specific behavior about localization. You should always specify the locale when calling a method from DateTime

Now the adapterLocale is applied to both the placeholder and the formatted for the 4 libraries

image

@alexfauquette alexfauquette added the bug 🐛 Something doesn't work label Oct 18, 2022
@mui-bot
Copy link

mui-bot commented Oct 18, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 474.2 832.6 674.1 653.1 153.224
Sort 100k rows ms 547.2 984 881.1 785.7 169.536
Select 100k rows ms 219.1 327.7 239.8 258 38.982
Deselect 100k rows ms 113.4 199.1 174.8 161.08 31.437

Generated by 🚫 dangerJS against 19261af

@alexfauquette alexfauquette changed the title [luxon] Adapt expended format to the locale [adapters] Fix localisation of the placeholder Oct 18, 2022
Comment on lines +65 to +67
return this.moment
.localeData(this.getCurrentLocaleCode())
.longDateFormat(token as LongDateFormatKey);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed because otherwise the default locale of moment will be applied (the last imported one)

It's a part of code copypasted from date-io. after this PR I will add the modification to date-io

@@ -70,18 +72,25 @@ export function wrapPickerMount(mount: (node: React.ReactNode) => import('enzyme

export function createPickerRenderer({
locale,
adapterName,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can run the entire test codebase with any of the adapters. But only some of them are relevant to be run on various adapters. That's why I add this parameter. By priority, tests run with the adapter provided by:

  • adapterName
  • test:unit paramter
  • date-fns (default one)

@alexfauquette alexfauquette merged commit a4fedc1 into mui:next Oct 19, 2022
@alexfauquette alexfauquette deleted the fix-luxon-adapter branch October 19, 2022 09:57
m4theushw added a commit to m4theushw/mui-x that referenced this pull request Oct 20, 2022
commit 634aabe
Author: Matheus Wichman <[email protected]>
Date:   Wed Oct 19 20:26:54 2022 -0300

    Update migration guide

commit 40bbeef
Merge: d49de67 4fbb67d
Author: Matheus Wichman <[email protected]>
Date:   Wed Oct 19 11:07:48 2022 -0300

    Merge branch 'next' into rename-selection-props

commit 4fbb67d
Author: Danail Hadjiatanasov <[email protected]>
Date:   Wed Oct 19 15:26:21 2022 +0300

    [test] Remove BrowserStack (mui#6263)

commit fff240b
Author: Olivier Tassinari <[email protected]>
Date:   Wed Oct 19 14:18:46 2022 +0200

    [core] Fix trailing spaces and git diff format (mui#6523)

    Signed-off-by: Olivier Tassinari <[email protected]>

commit 4488896
Author: Olivier Tassinari <[email protected]>
Date:   Wed Oct 19 13:37:09 2022 +0200

    [core] Improve the playground DX (mui#6514)

commit e195e5a
Author: Olivier Tassinari <[email protected]>
Date:   Wed Oct 19 13:30:12 2022 +0200

    [core] Link Netlify in the danger comment (mui#6513)

commit a4fedc1
Author: Alexandre Fauquette <[email protected]>
Date:   Wed Oct 19 11:57:42 2022 +0200

    [adapters] Fix localisation of the placeholder (mui#6547)

commit d49de67
Author: Matheus Wichman <[email protected]>
Date:   Tue Oct 18 19:17:48 2022 -0300

    [DataGrid] Rename selection props
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work
Projects
None yet
3 participants