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

[pickers] Allow showing only the selected week numbers on the DateRangePicker text field #10823

Closed
roelvdwater opened this issue Oct 27, 2023 · 5 comments
Labels
component: pickers This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists

Comments

@roelvdwater
Copy link

roelvdwater commented Oct 27, 2023

Summary 💡

We are using the DateRangePicker component and would like to show the selected week numbers only. For example, when selecting the last three weeks of December, it should show 50 - 52. Our users are interested in selecting entire weeks, which we have achieved by using the shouldDisableDate function, so they are also only interested in seeing the selected week numbers in the text field.

We are using moment and AdapterMoment on our LocalizationProvider and according to moment's format documentation, w should be used as a token to get the week number. However, this does not work in the DateRangePicker. We have considered calculating the weeks ourselves and putting it in an escaped string, such as [50 - 52], but only specifying an escaped string isn't supported as seen in this issue and from personal experience.

This CodeSandbox can be used to reproduce the issue. When changing the format to for example DD, it does indeed show the day number, but w doesn't work to show the week number.

Could the tokens be expanded so we can also show the selected week number(s)?

Examples 🌈

image

Motivation 🔦

The lack of this feature doesn't allow us to give our users only the information they are interested it.

Search keywords: daterangepicker weeknumbers

@roelvdwater roelvdwater added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 27, 2023
@LukasTy
Copy link
Member

LukasTy commented Oct 27, 2023

Hello, this looks like the same problem as #10279
Adding support for such unique tokens is not trivial.
WDYT, would having such solution help you cover your use case? 🤔

@LukasTy LukasTy added status: waiting for author Issue with insufficient information component: pickers This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 27, 2023
@LukasTy LukasTy changed the title Allow showing only the selected week numbers on the DateRangePicker text field [pickers] Allow showing only the selected week numbers on the DateRangePicker text field Oct 27, 2023
@roelvdwater
Copy link
Author

When talking about supporting the week number token, it'd be a feature on its own, but when talking about supporting formats only consisting of escaped characters, it would indeed be the same as #10279.

I have explored the example in the proposed change. Essentially what this does is adding support for a function to generate the shown value, is that correct? If that's the case, this would also be sufficient for our use case.

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Oct 27, 2023
@LukasTy
Copy link
Member

LukasTy commented Oct 27, 2023

I have explored the example in the proposed change. Essentially what this does is adding support for a function to generate the shown value, is that correct? If that's the case, this would also be sufficient for our use case.

The mentioned change basically adds the option to have a field without any interactive sections (empty).
And the linked exploratory example simply uses this fact by passing the formatted week numbers as an escaped format.

@roelvdwater
Copy link
Author

The mentioned change basically adds the option to have a field without any interactive sections (empty).
And the linked exploratory example simply uses this fact by passing the formatted week numbers as an escaped format.

I see. I believe this would indeed cater for our use case.

@LukasTy
Copy link
Member

LukasTy commented Oct 30, 2023

Thanks for letting us know.
I'm closing this issue as a duplicate then.
Feel free to follow the linked issue to get notified when the solution is implemented.

Please feel free to re-open this issue or create a new one if the provided solution is not sufficient. 😉

@LukasTy LukasTy closed this as not planned Won't fix, can't repro, duplicate, stale Oct 30, 2023
@LukasTy LukasTy added duplicate This issue or pull request already exists and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants