Skip to content

Commit

Permalink
Fix primefaces#2018: Calendar only fire onChange if dirty
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Apr 27, 2022
1 parent 26cf672 commit a5c81e1
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 @@ -1334,9 +1334,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 a5c81e1

Please sign in to comment.