Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/TickerQ.Dashboard/Endpoints/DashboardEndpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ private static IResult GetOptions<TTimeTicker, TCronTicker>(
IdleWorkerTimeOut = schedulerOptions.IdleWorkerTimeOut,
CurrentMachine = schedulerOptions.NodeIdentifier,
LastHostExceptionMessage = executionContext.LastHostExceptionMessage,
SchedulerTimeZone = schedulerOptions.SchedulerTimeZone?.Id
SchedulerTimeZone = ToIanaTimeZoneId(schedulerOptions.SchedulerTimeZone)
}, dashboardOptions.DashboardJsonOptions);
}

Expand Down Expand Up @@ -737,5 +737,24 @@ private static async Task<IResult> GetMachineJobs<TTimeTicker, TCronTicker>(
return Results.Json(machineJobs.Select(x => new TupleResponse<string, int> { Item1 = x.Item1, Item2 = x.Item2 }).ToArray(), dashboardOptions.DashboardJsonOptions);
}

internal static string? ToIanaTimeZoneId(TimeZoneInfo? timeZone)
{
if (timeZone == null)
return null;

var id = timeZone.Id;

// Already an IANA id (contains '/')
if (id.Contains('/') || id == "UTC")
return id;

// Convert Windows timezone id to IANA
if (TimeZoneInfo.TryConvertWindowsIdToIanaId(id, out var ianaId))
return ianaId;

// Fallback: return the original id
return id;
}

#endregion
}
Loading
Loading