Renamed TimeSpanToAMPM

- Renamed TimeSpanToAMPM() function to ConvertTo12Hour()
- Removed extra new lines between GenerateSchedule() and ConvertTo12Hour()
This commit is contained in:
Tony Bark 2025-03-12 18:06:11 -04:00
parent 77e9db562a
commit 2f41109477

View file

@ -34,14 +34,12 @@ List<TimeSpan> GenerateSchedule()
return scheduledTimes; return scheduledTimes;
} }
/// <summary> /// <summary>
/// Converts a TimeSpan into a 12-hour AM/PM formatted time string. /// Converts a TimeSpan into a 12-hour AM/PM formatted time string.
/// </summary> /// </summary>
/// <param name="time">The TimeSpan representing the time of day.</param> /// <param name="time">The TimeSpan representing the time of day.</param>
/// <returns>A formatted string representing the time in AM/PM format.</returns> /// <returns>A formatted string representing the time in AM/PM format.</returns>
string TimeSpanToAMPM(TimeSpan time) string ConvertTo12Hour(TimeSpan time)
{ {
var minutes = time.TotalMinutes; var minutes = time.TotalMinutes;
var hours12 = time.Hours % 12; var hours12 = time.Hours % 12;
@ -140,7 +138,7 @@ void PrintSchedule(bool isRestart = false)
Console.WriteLine("=== Publish Times ==="); Console.WriteLine("=== Publish Times ===");
foreach (var time in scheduledTimes) foreach (var time in scheduledTimes)
{ {
var articleTime = $"Article {scheduledTimes.IndexOf(time) + 1} Scheduled at: {TimeSpanToAMPM(time)}"; var articleTime = $"Article {scheduledTimes.IndexOf(time) + 1} Scheduled at: {ConvertTo12Hour(time)}";
// Correct format string to display time in 12-hour format with AM/PM // Correct format string to display time in 12-hour format with AM/PM
Console.WriteLine(articleTime); Console.WriteLine(articleTime);
// Store the schedule to memory for option export // Store the schedule to memory for option export