Changed date controller to directive