From c48c2ce56f0b2872b16df8af94989ad9ab85ee6c Mon Sep 17 00:00:00 2001 From: Cristi Mitrana <31816814+cmitu@users.noreply.github.com> Date: Tue, 3 Dec 2019 15:11:35 +0200 Subject: [PATCH] fix 'DateTimeEditComponent' output formatting. If the display mode is `DISP_DATE`, ignore the `mTime` field when calculating the output. This fixes the size calculation of the component. Fixes https://github.com/RetroPie/EmulationStation/issues/385. --- es-core/src/components/DateTimeEditComponent.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/es-core/src/components/DateTimeEditComponent.cpp b/es-core/src/components/DateTimeEditComponent.cpp index fef38aa47..54b1b1011 100644 --- a/es-core/src/components/DateTimeEditComponent.cpp +++ b/es-core/src/components/DateTimeEditComponent.cpp @@ -200,6 +200,8 @@ std::string DateTimeEditComponent::getDisplayString(DisplayMode mode) const fmt = "%m/%d/%Y"; break; case DISP_DATE_TIME: + if(mTime.getTime() == 0) + return "unknown"; fmt = "%m/%d/%Y %H:%M:%S"; break; case DISP_RELATIVE_TO_NOW: @@ -227,9 +229,6 @@ std::string DateTimeEditComponent::getDisplayString(DisplayMode mode) const break; } - if(mTime.getTime() == 0) - return "unknown"; - return Utils::Time::timeToString(mTime, fmt); }