Broadly speaking, you have two choices:
-
Click somewhere outside the datepicker. This will usually remove focus from it and hide it.
-
Send/trigger a blur event on the datepicker element.
First choice is probably easiest.
To advise you any further I need a lot more information. Read this post for ideas: