improve positioning and outside click handling of datepicker