Scripting on propertyChange issue

Hi,
I have a problem with calendar component scripting; I want to run a script on selected date changing. Here it’s what I do:

if event.propertyName==“date”:
#do some stuff

the issue is that for every date change, I have the script run 2 times, and I can’t understand why.
Any guess?

Thanks,
Enrico

I would say this is a bug with the regular calendar control.
@PGriffith
If you use the popup calendar instead the events only fire once.

Not a bug so much as a necessary evil - without looking into it, I believe the “duplicate” events are related to locale formatting or something along those lines. The various latched*Date properties should behave the way you want them to.

I would agree if you could trap for that but the control doesn’t allow it.
On the regular calendar control, propertyChange event.
print event.propertyName returns this on date click:

formattedDate
date
formattedDate
date

While on the popup calendar control it returns

date
text
formattedDate

So with the normal calendar control you can’t trap for formattedDate and run code a single time.

You can create a custom date property on the component and bind it to the date. Then do the property change event on the new property.

1 Like

I understand that, but that still doesn’t explain why it is firing date and formattedDate twice like that.