Very rough port of calendar library and datepicker polyfill