From 06c2a07fbcfd9657dd19b218d76b141da7bc1ba8 Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 11 Mar 2026 14:11:23 +0100 Subject: [PATCH] Replace DateTime.UtcNow with DateTime.Now for timestamps Switched all audit and creation timestamps from UTC to local time by replacing DateTime.UtcNow with DateTime.Now across the codebase. This affects audit fields, object creation, and default values for date/time properties. --- .../Common/Extensions/AutoMapperAuditingExtensions.cs | 4 ++-- .../Common/Notifications/SendMailHandler.cs | 2 +- EnvelopeGenerator.Application/DocStatus/MappingProfile.cs | 2 +- .../Histories/Commands/CreateHistoryCommand.cs | 2 +- EnvelopeGenerator.Tests/Application/Fake.cs | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/EnvelopeGenerator.Application/Common/Extensions/AutoMapperAuditingExtensions.cs b/EnvelopeGenerator.Application/Common/Extensions/AutoMapperAuditingExtensions.cs index 4ce31eb1..72f2abef 100644 --- a/EnvelopeGenerator.Application/Common/Extensions/AutoMapperAuditingExtensions.cs +++ b/EnvelopeGenerator.Application/Common/Extensions/AutoMapperAuditingExtensions.cs @@ -13,12 +13,12 @@ public static class AutoMapperAuditingExtensions /// public static IMappingExpression MapAddedWhen(this IMappingExpression expression) where TDestination : IHasAddedWhen - => expression.ForMember(dest => dest.AddedWhen, opt => opt.MapFrom(_ => DateTime.UtcNow)); + => expression.ForMember(dest => dest.AddedWhen, opt => opt.MapFrom(_ => DateTime.Now)); /// /// Maps to the current UTC time. /// public static IMappingExpression MapChangedWhen(this IMappingExpression expression) where TDestination : IHasChangedWhen - => expression.ForMember(dest => dest.ChangedWhen, opt => opt.MapFrom(_ => DateTime.UtcNow)); + => expression.ForMember(dest => dest.ChangedWhen, opt => opt.MapFrom(_ => DateTime.Now)); } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Common/Notifications/SendMailHandler.cs b/EnvelopeGenerator.Application/Common/Notifications/SendMailHandler.cs index 5a97ef03..50cf3662 100644 --- a/EnvelopeGenerator.Application/Common/Notifications/SendMailHandler.cs +++ b/EnvelopeGenerator.Application/Common/Notifications/SendMailHandler.cs @@ -113,7 +113,7 @@ public abstract class SendMailHandler : INotificationHandler() .ForMember(dest => dest.Envelope, opt => opt.Ignore()) .ForMember(dest => dest.Receiver, opt => opt.Ignore()) - .ForMember(dest => dest.StatusChangedWhen, opt => opt.MapFrom(src => DateTime.UtcNow)) + .ForMember(dest => dest.StatusChangedWhen, opt => opt.MapFrom(src => DateTime.Now)) .MapChangedWhen(); } } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Histories/Commands/CreateHistoryCommand.cs b/EnvelopeGenerator.Application/Histories/Commands/CreateHistoryCommand.cs index c8a53f59..4cd83f01 100644 --- a/EnvelopeGenerator.Application/Histories/Commands/CreateHistoryCommand.cs +++ b/EnvelopeGenerator.Application/Histories/Commands/CreateHistoryCommand.cs @@ -34,7 +34,7 @@ public record CreateHistoryCommand : EnvelopeReceiverQueryBase, IRequest /// /// - public DateTime AddedWhen { get; } = DateTime.UtcNow; + public DateTime AddedWhen { get; } = DateTime.Now; /// /// diff --git a/EnvelopeGenerator.Tests/Application/Fake.cs b/EnvelopeGenerator.Tests/Application/Fake.cs index 1281e7bb..66b3e168 100644 --- a/EnvelopeGenerator.Tests/Application/Fake.cs +++ b/EnvelopeGenerator.Tests/Application/Fake.cs @@ -215,7 +215,7 @@ public static class Extensions Title = faker.Lorem.Paragraph(faker.Random.Number(1, 2)), Message = faker.Lorem.Paragraph(faker.Random.Number(2, 5)), TfaEnabled = tfaEnabled, - AddedWhen = DateTime.UtcNow, + AddedWhen = DateTime.Now, CertificationType = (int)CertificationType.AdvancedElectronicSignature, UseAccessCode = false, ContractType = (int)ContractType.Contract, @@ -273,9 +273,9 @@ public static class Extensions EnvelopeId = envelopeId, ReceiverId = receiverId, Status = ReceiverStatus.Unsigned, - AddedWhen = DateTime.UtcNow, + AddedWhen = DateTime.Now, AccessCode = faker.Random.Number(1000, 9999).ToString(), - ChangedWhen = DateTime.UtcNow, + ChangedWhen = DateTime.Now, CompanyName = faker.Company.CompanyName(), JobTitle = faker.Name.JobTitle(), Name = faker.Name.FullName(),