Can an input with class hasDatepicker be close through javascript?

Can an input with class hasDatepicker be close through javascript?

Hi everyone,

I am tasked with developing an automation framework for our company which uses jquery (ver. 2.2.1) and I was wondering if there is a way to close a datepicker element through javascript, I have tried dispatching events to the element but I think they are being ignored.

Thank you.
Regards.