# How to avoid triggering \`dateChanged\` method when \`date\` value is set to a new \`Date\` instance with the same date (SOLVED)

**URL:** <https://discourse.aurelia.io/t/how-to-avoid-triggering-datechanged-method-when-date-value-is-set-to-a-new-date-instance-with-the-same-date-solved/3888>\
**Category:** Help Requests\
**Created:** [November 18, 2020, 1:43pm UTC](https://discourse.aurelia.io/t/how-to-avoid-triggering-datechanged-method-when-date-value-is-set-to-a-new-date-instance-with-the-same-date-solved/3888 "2020-11-18T13:43:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bart](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/bart/32/1878_2.png) [@Bart](https://discourse.aurelia.io/u/Bart)\
**Post date:** [November 18, 2020, 1:43pm UTC](https://discourse.aurelia.io/t/how-to-avoid-triggering-datechanged-method-when-date-value-is-set-to-a-new-date-instance-with-the-same-date-solved/3888/1 "2020-11-18T13:43:09Z")

</div>

I am struggling with a bindable `date` property of type `Date | null` in one of my components.

When I set that property from one `Date` value to an other `Date` value, the `dateChanged` method in the view-model is triggered, even if the underlying dates in those (different) `Date` instances are exactly the same. I would like to avoid that.

Is there an elegant way to fix this? Can it be done with a binding behavior, for example? If so, are there any coding examples available somewhere which demonstrate how such a custom binding behavior could be implemented?

---

<div class="post-metadata">

**Author:** ![Bart](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/bart/32/1878_2.png) [@Bart](https://discourse.aurelia.io/u/Bart)\
**Post date:** [November 18, 2020, 2:17pm UTC](https://discourse.aurelia.io/t/how-to-avoid-triggering-datechanged-method-when-date-value-is-set-to-a-new-date-instance-with-the-same-date-solved/3888/2 "2020-11-18T14:17:46Z")

</div>

Maybe I’m thinking too difficult.

I’ll just add the check for equal `getTime()` values of the old and the new date values at the beginning of the `dateChanged` method and immediately exit the method if they are equal.
