refactoring user controller and fixed bug with date