convert string date to Date object before save to db