diff --git a/backend/src/Socialize.Api/Modules/ReleaseCommunications/Handlers/ImportDeveloperReleaseCommits.cs b/backend/src/Socialize.Api/Modules/ReleaseCommunications/Handlers/ImportDeveloperReleaseCommits.cs index cba1ab23..4ab96dfd 100644 --- a/backend/src/Socialize.Api/Modules/ReleaseCommunications/Handlers/ImportDeveloperReleaseCommits.cs +++ b/backend/src/Socialize.Api/Modules/ReleaseCommunications/Handlers/ImportDeveloperReleaseCommits.cs @@ -132,8 +132,8 @@ internal class ImportDeveloperReleaseCommitsHandler( Subject = dto.Subject.Trim(), AuthorName = NormalizeOptional(dto.AuthorName), AuthorEmail = NormalizeOptional(dto.AuthorEmail), - AuthoredAt = dto.AuthoredAt, - CommittedAt = dto.CommittedAt, + AuthoredAt = ToUtc(dto.AuthoredAt), + CommittedAt = ToUtc(dto.CommittedAt), SourceBranch = NormalizeOptional(dto.SourceBranch), DeploymentLabel = NormalizeOptional(dto.DeploymentLabel), ExternalUrl = NormalizeOptional(dto.ExternalUrl), @@ -148,4 +148,9 @@ internal class ImportDeveloperReleaseCommitsHandler( string? normalized = value?.Trim(); return string.IsNullOrWhiteSpace(normalized) ? null : normalized; } + + private static DateTimeOffset? ToUtc(DateTimeOffset? value) + { + return value?.ToUniversalTime(); + } } diff --git a/backend/src/Socialize.Api/Modules/ReleaseCommunications/Services/ReleaseCommitRepositoryImportService.cs b/backend/src/Socialize.Api/Modules/ReleaseCommunications/Services/ReleaseCommitRepositoryImportService.cs index a7662ba0..24f80d59 100644 --- a/backend/src/Socialize.Api/Modules/ReleaseCommunications/Services/ReleaseCommitRepositoryImportService.cs +++ b/backend/src/Socialize.Api/Modules/ReleaseCommunications/Services/ReleaseCommitRepositoryImportService.cs @@ -209,8 +209,8 @@ internal sealed class ReleaseCommitRepositoryImportService( Subject = subject.Trim(), AuthorName = authorElement.HasValue ? NormalizeOptional(GetString(authorElement.Value, "name")) : null, AuthorEmail = authorElement.HasValue ? NormalizeOptional(GetString(authorElement.Value, "email")) : null, - AuthoredAt = authorElement.HasValue ? GetDateTimeOffset(authorElement.Value, "date") : null, - CommittedAt = committerElement.HasValue ? GetDateTimeOffset(committerElement.Value, "date") : null, + AuthoredAt = authorElement.HasValue ? GetUtcDateTimeOffset(authorElement.Value, "date") : null, + CommittedAt = committerElement.HasValue ? GetUtcDateTimeOffset(committerElement.Value, "date") : null, SourceBranch = NormalizeOptional(request.SourceBranch), DeploymentLabel = NormalizeOptional(request.DeploymentLabel), ExternalUrl = NormalizeOptional(GetString(commitElement, "html_url") ?? GetString(commitElement, "url")), @@ -238,11 +238,11 @@ internal sealed class ReleaseCommitRepositoryImportService( : null; } - private static DateTimeOffset? GetDateTimeOffset(JsonElement element, string propertyName) + private static DateTimeOffset? GetUtcDateTimeOffset(JsonElement element, string propertyName) { string? value = GetString(element, propertyName); return DateTimeOffset.TryParse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out DateTimeOffset result) - ? result + ? result.ToUniversalTime() : null; }