Update frontend.js

On pages where there is no #datepicker element, it throws a JS error.  I'm not deep enough into the project in order to find a better solution.  I'm thinking there should be a LOT more code for frontend.js - and should also take into account internationalisation (custom date formats)