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

fix #6984: calendar does not displays up-to-date value if date is manually entered #6986

Merged
merged 2 commits into from
Aug 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions components/lib/calendar/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ export const Calendar = React.memo(
const value = parseValueFromString(props.timeOnly ? rawValue.replace('_', '') : rawValue);

if (isValidSelection(value)) {
isTypingRef.current = true;
avasuro marked this conversation as resolved.
Show resolved Hide resolved
updateModel(event, value);
updateViewDate(event, value.length ? value[0] : value);
}
Expand Down Expand Up @@ -3074,12 +3073,13 @@ export const Calendar = React.memo(
const newDate = props.value;

if (previousValue !== newDate) {
if (!isTypingRef.current) {
const isInputFocused = document.activeElement === inputRef.current;

// Do not update value in input if user types something in it:
if (!isInputFocused) {
updateInputfield(newDate);
}

isTypingRef.current = false;

// #3516 view date not updated when value set programatically
if (!newDate) return;

Expand Down
Loading