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] Quarter Picker - CSS guru/genious #16352

Closed
david-ic3 opened this issue Jan 27, 2025 · 8 comments
Closed

[pickers] Quarter Picker - CSS guru/genious #16352

david-ic3 opened this issue Jan 27, 2025 · 8 comments
Labels
component: pickers This is the name of the generic UI component, not the React module! support: commercial Support request from paid users support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/

Comments

@david-ic3
Copy link

david-ic3 commented Jan 27, 2025

The problem in depth

I know that a quarter picker is not planned but we need one for some scenarios.

So in the meantime, the idea is to select all months of a quarter in the date picker using slotProps :

_<DatePicker
    label={'"month"'}
    openTo="month"
    views={['year', 'month']}
    value={value}
    onChange={(newValue) => setValue(newValue)}
    slotProps={{
        layout: {
            sx: (theme: Theme) => ({
                [".MuiMonthCalendar-root > :nth-child(" + (quarterValue + 1) + ") , " +
                ".MuiMonthCalendar-root > :nth-child(" + (quarterValue + 2) + ") , " +
                ".MuiMonthCalendar-root > :nth-child(" + (quarterValue + 3) + ")"]: {
                    backgroundColor: "lightblue",
                },
                ".MuiMonthCalendar-root .MuiPickersMonth-monthButton.Mui-selected": {
                    color: 'unset',
                    backgroundColor: 'transparent'
                }
            })
        }
    }}_

The code is available here.

The selection is fine, but is there a way to have also the hover effect on the quarters ?

Your environment

No response

Search keywords: quarter date picker

Order ID: 19458

@david-ic3 david-ic3 added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: commercial Support request from paid users labels Jan 27, 2025
@github-actions github-actions bot changed the title [DateRangePicker] Quarter Picker - CSS guru/genious [pickers] Quarter Picker - CSS guru/genious Jan 27, 2025
@github-actions github-actions bot added component: pickers This is the name of the generic UI component, not the React module! support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/ labels Jan 27, 2025
@michelengelen
Copy link
Member

Hey @david-ic3 ... you can take the same approach as it is shown here

Here is a quick demo for you: Quarter picker

Sry that it took so long ... wasn't super straightforward to build.

@LukasTy should we add this as a recipe to the docs?

@michelengelen michelengelen added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 29, 2025
@david-ic3
Copy link
Author

@michelengelen , thanks but it looks as the DatePicker has no monthButton slots

MUI-doc

@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 Jan 29, 2025
@noraleonte
Copy link
Contributor

Hi @david-ic3 👋
You can use the monthButton slot on the DatePicker too if needed 👍 I took the liberty of updating Michel's demo here

@michelengelen I would be in favor of adding something like this to the docs 👌

@LukasTy
Copy link
Member

LukasTy commented Jan 29, 2025

@michelengelen @noraleonte This looks like a nice demo, but I'm not sure using DatePicker is the right move. 🙈
It just shows that we do not support quarters at all. 🤷

@LukasTy LukasTy added docs Improvements or additions to the documentation and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 29, 2025
@michelengelen
Copy link
Member

@LukasTy that's what I was thinking as well ... just looked it up and we would need to build our custom quarter support for it...

@LukasTy
Copy link
Member

LukasTy commented Feb 4, 2025

Hey, @david-ic3.
We have discussed this topic among the team and feel that providing this example in the documentation might create unnecessary problems/questions, because of the solution's incompleteness. 🙈

We have an issue tracking the quarter picker implementation: #15117 that you can reference.

Did the provided solution solve your problem or do you feel something is still missing? 🤔

@LukasTy LukasTy added status: waiting for author Issue with insufficient information and removed docs Improvements or additions to the documentation labels Feb 4, 2025
@david-ic3
Copy link
Author

@LukasTy , thanks.

You do not need to hide the reality, quarters are not supported. But as you are such a nice team you provided a workaround that is good enough for us.

Merci

@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 Feb 4, 2025
Copy link

github-actions bot commented Feb 4, 2025

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

@david-ic3 How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

@github-actions github-actions bot removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Feb 4, 2025
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! support: commercial Support request from paid users support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/
Projects
None yet
Development

No branches or pull requests

4 participants