Skip to content

Commit

Permalink
Fix #2018: Calendar only fire onChange if dirty (#2810)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Jul 1, 2022
1 parent a84ca64 commit 8737477
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/lib/calendar/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1337,9 +1337,10 @@ export const Calendar = React.memo(React.forwardRef((props, ref) => {
const updateModel = (event, value) => {
if (props.onChange) {
const newValue = (value && value instanceof Date) ? new Date(value.getTime()) : value;
const dirty = previousValue !== props.value;
viewStateChanged.current = true;

props.onChange({
dirty && props.onChange({
originalEvent: event,
value: newValue,
stopPropagation: () => { },
Expand Down

0 comments on commit 8737477

Please sign in to comment.