I end up using datepicker through jquery anywhere from 10-200 times.
I assume that you call datepicker() separately for each login, possibly with id . There is no need.
Use class as a hook on your input:
<input class="my-datepicker">
Then call datepicker for elements with this class with your default configuration:
$('.my-datepicker').datepicker({ dateFormat: 'yy-mm-dd' });
If you need a different configuration, use / assign a different class name.
You can also use setDefaults (maybe what you are looking for):
$.datepicker.setDefaults({ dateFormat: 'yy-mm-dd' });
source share