-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] referenceDate not working as expected #10747
Comments
Thank you for creating this issue! 🙏
Based on the issue description it seems that what you are looking for is the Could you clarify what you are trying to achieve more specifically so that we can help you in coming up with an implementation suggestion? 🤔 |
I'm controlling the valute (with value and onChange). My value is initially empty so I need the functionality of
In the provided sandbox |
This sounds like a really interesting and unique use case you are trying to achieve. Have you considered using a custom implementation to handle your particular use case? 🤔 |
The intended functionality of I see now that But the simplescreenrecorder-2023-10-23_12.52.49.mp4 |
And I think it would be better UX that before clicking on the date, the hours and minutes are "presuggested/preselected", so that when clicking on OK immediately, the |
Just to clarify, there is no "pre-suggestion" per say, we are just focusing some day when opening the view and this day is currently I do agree that focusing the 30th when the 18th is actually the reference date is not the best behavior. The time part can't have a "pre-suggestion" when opening the picker because they don't have the focus. Here is the change that would focus the 18th: diff --git a/packages/x-date-pickers/src/DateCalendar/useCalendarState.tsx b/packages/x-date-pickers/src/DateCalendar/useCalendarState.tsx
index 1754dc47f..25c854a99 100644
--- a/packages/x-date-pickers/src/DateCalendar/useCalendarState.tsx
+++ b/packages/x-date-pickers/src/DateCalendar/useCalendarState.tsx
@@ -162,7 +162,7 @@ export const useCalendarState = <TDate extends unknown>(params: UseCalendarState
const [calendarState, dispatch] = React.useReducer(reducerFn, {
isMonthSwitchingAnimating: false,
- focusedDay: value || now,
+ focusedDay: referenceDate,
currentMonth: utils.startOfMonth(referenceDate),
slideDirection: 'left',
});
For this statement, it's not the role of |
No, the But, I'd like the picker popup to have all the views (figures) preselected to the time instant provided. The user can then confirm (immediately after opening the popup) the date that is preselected, that would be then set as the field value. |
From what you are describing, it seems that you are asking not for a fix in I'm putting this issue up for grooming so that the team can discuss the best solution. 👍 |
@LukasTy No. The
What I suggest seems natural behavior for something called |
@croraf I've created a PR that is linked to this issue. |
This makes me think of #7500 |
I'll close this in favor of 7500 |
Steps to reproduce
https://codesandbox.io/s/infallible-poincare-knhmh5?file=/src/Demo.js
referenceDate
is not working as expected. Open the provided picker and observe day, hours and minutes.Current behavior
referenceDate
date is modified such that the day is set to the last day of the provided month.Expected behavior
When the popup is opened:
The text was updated successfully, but these errors were encountered: