protected function mapWhen(\WorklistPatient $wp) { $default_when = $wp->when ? \DateTime::createFromFormat('Y-m-d H:i:s', $wp->when) : null; return $this->resolveWhen($default_when); }