diff --git a/CleanArchitecture.Domain/Commands/CommandBase.cs b/CleanArchitecture.Domain/Commands/CommandBase.cs index d659231..02a7f68 100644 --- a/CleanArchitecture.Domain/Commands/CommandBase.cs +++ b/CleanArchitecture.Domain/Commands/CommandBase.cs @@ -14,7 +14,7 @@ public abstract class CommandBase : IRequest protected CommandBase(Guid aggregateId) { MessageType = GetType().Name; - Timestamp = DateTime.Now; + Timestamp = DateTime.UtcNow; AggregateId = aggregateId; } diff --git a/CleanArchitecture.Domain/Commands/Users/LoginUser/LoginUserCommandHandler.cs b/CleanArchitecture.Domain/Commands/Users/LoginUser/LoginUserCommandHandler.cs index c95b1e8..3e9daf8 100644 --- a/CleanArchitecture.Domain/Commands/Users/LoginUser/LoginUserCommandHandler.cs +++ b/CleanArchitecture.Domain/Commands/Users/LoginUser/LoginUserCommandHandler.cs @@ -70,7 +70,7 @@ public sealed class LoginUserCommandHandler : CommandHandlerBase, } user.SetActive(); - user.SetLastLoggedinDate(DateTimeOffset.Now); + user.SetLastLoggedinDate(DateTimeOffset.UtcNow); if (!await CommitAsync()) { @@ -103,7 +103,7 @@ public sealed class LoginUserCommandHandler : CommandHandlerBase, tokenSettings.Issuer, tokenSettings.Audience, claims, - expires: DateTime.Now.AddMinutes(_expiryDurationMinutes), + expires: DateTime.UtcNow.AddMinutes(_expiryDurationMinutes), signingCredentials: credentials); return new JwtSecurityTokenHandler().WriteToken(tokenDescriptor); diff --git a/CleanArchitecture.Shared/Events/DomainEvent.cs b/CleanArchitecture.Shared/Events/DomainEvent.cs index f541549..9d87903 100644 --- a/CleanArchitecture.Shared/Events/DomainEvent.cs +++ b/CleanArchitecture.Shared/Events/DomainEvent.cs @@ -9,11 +9,11 @@ public abstract class DomainEvent : Message, INotification protected DomainEvent(Guid aggregateId) : base(aggregateId) { - Timestamp = DateTime.Now; + Timestamp = DateTime.UtcNow; } protected DomainEvent(Guid aggregateId, string? messageType) : base(aggregateId, messageType) { - Timestamp = DateTime.Now; + Timestamp = DateTime.UtcNow; } } \ No newline at end of file