Skip to content

Commit ff12d60

Browse files
committed
Update date/time formatting to 12-hour AM/PM format across components
1 parent b45236e commit ff12d60

5 files changed

Lines changed: 23 additions & 12 deletions

File tree

src/BlazorDataOrchestrator.JobCreatorTemplate/Components/Pages/Home.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
</RadzenDataGridColumn>
171171
<RadzenDataGridColumn TItem="LogDisplayEntry" Property="CreatedDate" Title="Created Date" Width="180px">
172172
<Template Context="log">
173-
@TimeDisplayService.FormatDateTime(log.CreatedDate, "yyyy-MM-dd HH:mm:ss")
173+
@TimeDisplayService.FormatDateTime(log.CreatedDate, "M/d/yyyy h:mm:ss tt")
174174
</Template>
175175
</RadzenDataGridColumn>
176176
<RadzenDataGridColumn TItem="LogDisplayEntry" Property="Message" Title="Message" />

src/BlazorOrchestrator.Web/Components/Pages/Dialogs/AIChatDialog.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<div class="message-content">
5555
<div class="message-header">
5656
<span class="message-sender">@(message.IsUser ? "You" : "AI Assistant")</span>
57-
<span class="message-time">@message.Timestamp.ToString("HH:mm")</span>
57+
<span class="message-time">@message.Timestamp.ToString("h:mm tt")</span>
5858
</div>
5959
<div class="message-text">@((MarkupString)FormatMessage(message.Content))</div>
6060
@if (message.IsStreaming)

src/BlazorOrchestrator.Web/Components/Pages/Dialogs/EditJobScheduleDialog.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<RadzenStack Gap="0.25rem">
5757
<RadzenLabel Text="Last Run" Style="font-weight: 500;" />
5858
<RadzenText TextStyle="TextStyle.Body2" Style="margin: 0;">
59-
@(TimeDisplayService.FormatDateTime(Schedule.LastRun, "g", "Never"))
59+
@(TimeDisplayService.FormatDateTime(Schedule.LastRun, "M/d/yyyy h:mm tt", "Never"))
6060
</RadzenText>
6161
</RadzenStack>
6262
</RadzenColumn>

src/BlazorOrchestrator.Web/Services/AppSettingsService.cs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public AppSettingsService(IConfiguration configuration, IWebHostEnvironment envi
3434

3535
/// <summary>
3636
/// Gets the configured TimeZoneInfo synchronously from cache.
37-
/// Falls back to IConfiguration ("TimezoneId"), then default "America/Los_Angeles".
38-
/// Use <see cref="GetTimeZoneInfoAsync"/> for the full Azure Table → config → default fallback.
37+
/// Delegates to <see cref="GetTimeZoneInfoAsync"/> (Azure Table → config → default)
38+
/// on cache miss, running on a threadpool thread to avoid Blazor deadlocks.
3939
/// </summary>
4040
public TimeZoneInfo GetTimeZoneInfo()
4141
{
@@ -44,9 +44,20 @@ public TimeZoneInfo GetTimeZoneInfo()
4444
return _cachedTimeZone;
4545
}
4646

47-
// Synchronous fallback: IConfiguration → default
48-
var timezoneId = _configuration["TimezoneId"] ?? DefaultTimezoneId;
49-
return ResolveTimeZone(timezoneId);
47+
// Delegate to the async version (Azure Table → config → default) on a threadpool thread
48+
try
49+
{
50+
return Task.Run(() => GetTimeZoneInfoAsync()).GetAwaiter().GetResult();
51+
}
52+
catch
53+
{
54+
// If the async path fails entirely, fall back to IConfiguration → default
55+
var timezoneId = _configuration["TimezoneId"] ?? DefaultTimezoneId;
56+
var tz = ResolveTimeZone(timezoneId);
57+
_cachedTimeZone = tz;
58+
_cacheExpiry = DateTime.UtcNow.Add(CacheDuration);
59+
return tz;
60+
}
5061
}
5162

5263
/// <summary>

src/BlazorOrchestrator.Web/Services/TimeDisplayService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ public DateTime ConvertToDisplayTime(DateTime utcTime)
2828
/// Formats a DateTime value using the configured timezone (DST-aware).
2929
/// </summary>
3030
/// <param name="dateTime">The DateTime to format (assumed to be in UTC)</param>
31-
/// <param name="format">The format string (default: "g" for short date/time)</param>
31+
/// <param name="format">The format string (default: 12-hour AM/PM format)</param>
3232
/// <returns>Formatted date/time string in the configured timezone</returns>
33-
public string FormatDateTime(DateTime dateTime, string format = "g")
33+
public string FormatDateTime(DateTime dateTime, string format = "M/d/yyyy h:mm tt")
3434
{
3535
var displayTime = ConvertToDisplayTime(dateTime);
3636
return displayTime.ToString(format);
@@ -40,10 +40,10 @@ public string FormatDateTime(DateTime dateTime, string format = "g")
4040
/// Formats a nullable DateTime value using the configured timezone (DST-aware).
4141
/// </summary>
4242
/// <param name="dateTime">The DateTime to format (assumed to be in UTC)</param>
43-
/// <param name="format">The format string (default: "g" for short date/time)</param>
43+
/// <param name="format">The format string (default: 12-hour AM/PM format)</param>
4444
/// <param name="nullDisplay">Text to display when value is null (default: "-")</param>
4545
/// <returns>Formatted date/time string in the configured timezone, or nullDisplay if null</returns>
46-
public string FormatDateTime(DateTime? dateTime, string format = "g", string nullDisplay = "-")
46+
public string FormatDateTime(DateTime? dateTime, string format = "M/d/yyyy h:mm tt", string nullDisplay = "-")
4747
{
4848
if (!dateTime.HasValue)
4949
return nullDisplay;

0 commit comments

Comments
 (0)