removing the buggy code from datetimepicter, optimized js