Fix incorrect AM and PM time announcement and :00 formatting.

master
bradjrenshaw 2022-05-12 20:04:33 -04:00
parent d74ca682eb
commit 569311c61e
1 changed files with 4 additions and 9 deletions

View File

@ -96,15 +96,10 @@ namespace stardew_access.Features
int minutes = timeOfDay % 100; int minutes = timeOfDay % 100;
int hours = timeOfDay / 100; int hours = timeOfDay / 100;
string amOrpm = "A M"; string amOrpm = hours / 12 == 1 ? "PM" : "AM";
if (hours >= 12) hours = hours % 12;
{ if (hours == 0) hours = 12;
amOrpm = "P M"; return $"{hours}:{minutes:00} {amOrpm}";
if (hours > 12)
hours -= 12;
}
return $"{hours}:{minutes} {amOrpm}";
} }
} }