changed a varible name and used datepicker function to get date properly