Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1169 from bacongobbler/fix-1167
Browse files Browse the repository at this point in the history
use DateTime.UtcNow
  • Loading branch information
bacongobbler authored Sep 7, 2022
2 parents cc424df + 83731f1 commit 76e5b2d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Application/Channels/Commands/CreateChannelCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public async Task<Guid> Handle(CreateChannelCommand request, CancellationToken c
entity.ActiveRevision = await GetActiveRevision(request, entity, cancellationToken);
if (entity.ActiveRevision is not null)
{
entity.LastPublishAt = DateTime.Now;
entity.LastPublishAt = DateTime.UtcNow;
}

entity.AddDomainEvent(new CreatedEvent<Channel>(entity));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ await _mediator.Send(new UpdateChannelCommand
{
Id = channel.Id,
ActiveRevisionId = activeRevision.Id,
LastPublishDate = DateTime.Now,
LastPublishDate = DateTime.UtcNow,
CertificateId = channel.CertificateId,
Domain = channel.Domain,
Name = channel.Name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ public void UpdateEntities(DbContext? context)
if (entry.State == EntityState.Added)
{
entry.Entity.CreatedBy = _currentUserService.UserId;
entry.Entity.Created = _dateTime.Now;
entry.Entity.Created = _dateTime.UtcNow;
}

if (entry.State == EntityState.Added || entry.State == EntityState.Modified || entry.HasChangedOwnedEntities())
{
entry.Entity.LastModifiedBy = _currentUserService.UserId;
entry.Entity.LastModified = _dateTime.Now;
entry.Entity.LastModified = _dateTime.UtcNow;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Infrastructure/Services/DateTimeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Hippo.Infrastructure.Services;

public class DateTimeService : IDateTime
{
public DateTime Now => DateTime.Now;
public DateTime Now => DateTime.UtcNow;

public DateTime UtcNow => DateTime.UtcNow;
}
2 changes: 1 addition & 1 deletion src/Infrastructure/Services/TokenService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public TokenInfo CreateSecurityToken(string id)
var token = new JwtSecurityToken(
issuer: _configuration["Jwt:Issuer"],
audience: _configuration["Jwt:Audience"],
expires: DateTime.Now.AddMinutes(30),
expires: DateTime.UtcNow.AddMinutes(30),
claims: claims,
signingCredentials: new SigningCredentials(authSigningKey, SecurityAlgorithms.HmacSha256)
);
Expand Down

0 comments on commit 76e5b2d

Please sign in to comment.