0
0
mirror of https://github.com/alex289/CleanArchitecture.git synced 2025-07-03 20:12:56 +00:00

fix: Use utc now instead of now

This commit is contained in:
alex289 2024-09-04 13:03:20 +02:00
parent f5dbecda7b
commit 9c9627dd08
No known key found for this signature in database
GPG Key ID: 573F77CD2D87F863
3 changed files with 5 additions and 5 deletions

View File

@ -14,7 +14,7 @@ public abstract class CommandBase : IRequest
protected CommandBase(Guid aggregateId) protected CommandBase(Guid aggregateId)
{ {
MessageType = GetType().Name; MessageType = GetType().Name;
Timestamp = DateTime.Now; Timestamp = DateTime.UtcNow;
AggregateId = aggregateId; AggregateId = aggregateId;
} }

View File

@ -70,7 +70,7 @@ public sealed class LoginUserCommandHandler : CommandHandlerBase,
} }
user.SetActive(); user.SetActive();
user.SetLastLoggedinDate(DateTimeOffset.Now); user.SetLastLoggedinDate(DateTimeOffset.UtcNow);
if (!await CommitAsync()) if (!await CommitAsync())
{ {
@ -103,7 +103,7 @@ public sealed class LoginUserCommandHandler : CommandHandlerBase,
tokenSettings.Issuer, tokenSettings.Issuer,
tokenSettings.Audience, tokenSettings.Audience,
claims, claims,
expires: DateTime.Now.AddMinutes(_expiryDurationMinutes), expires: DateTime.UtcNow.AddMinutes(_expiryDurationMinutes),
signingCredentials: credentials); signingCredentials: credentials);
return new JwtSecurityTokenHandler().WriteToken(tokenDescriptor); return new JwtSecurityTokenHandler().WriteToken(tokenDescriptor);

View File

@ -9,11 +9,11 @@ public abstract class DomainEvent : Message, INotification
protected DomainEvent(Guid aggregateId) : base(aggregateId) protected DomainEvent(Guid aggregateId) : base(aggregateId)
{ {
Timestamp = DateTime.Now; Timestamp = DateTime.UtcNow;
} }
protected DomainEvent(Guid aggregateId, string? messageType) : base(aggregateId, messageType) protected DomainEvent(Guid aggregateId, string? messageType) : base(aggregateId, messageType)
{ {
Timestamp = DateTime.Now; Timestamp = DateTime.UtcNow;
} }
} }