From 909ca236742e5577b43f89c01df448c1b79961f1 Mon Sep 17 00:00:00 2001 From: Paul Welter Date: Mon, 6 May 2024 16:14:11 -0500 Subject: [PATCH] improve datetime merge --- src/FluentCommand.SqlServer/Merge/DataMergeGenerator.cs | 4 ++-- ...taMergeGeneratorTests.BuildMergeDataTypeTests.verified.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/FluentCommand.SqlServer/Merge/DataMergeGenerator.cs b/src/FluentCommand.SqlServer/Merge/DataMergeGenerator.cs index e77e69a3..5abef28f 100644 --- a/src/FluentCommand.SqlServer/Merge/DataMergeGenerator.cs +++ b/src/FluentCommand.SqlServer/Merge/DataMergeGenerator.cs @@ -461,8 +461,8 @@ private static string GetValue(object value) return value switch { string stringValue => stringValue, - DateTime dateTimeValue => dateTimeValue.ToString("u"), - DateTimeOffset dateTimeOffset => dateTimeOffset.ToString("u"), + DateTime dateTimeValue => dateTimeValue.ToString("yyyy-MM-dd HH:mm:ss.fff"), + DateTimeOffset dateTimeOffset => dateTimeOffset.ToString("yyyy-MM-dd HH:mm:ss.ffffffzzz"), byte[] byteArray => ToHex(byteArray), bool boolValue => boolValue ? "1" : "0", #if NET6_0_OR_GREATER diff --git a/test/FluentCommand.SqlServer.Tests/Snapshots/DataMergeGeneratorTests.BuildMergeDataTypeTests.verified.txt b/test/FluentCommand.SqlServer.Tests/Snapshots/DataMergeGeneratorTests.BuildMergeDataTypeTests.verified.txt index 072d2f14..230f0a5c 100644 --- a/test/FluentCommand.SqlServer.Tests/Snapshots/DataMergeGeneratorTests.BuildMergeDataTypeTests.verified.txt +++ b/test/FluentCommand.SqlServer.Tests/Snapshots/DataMergeGeneratorTests.BuildMergeDataTypeTests.verified.txt @@ -2,8 +2,8 @@ USING ( VALUES - (1, 'Test1', 0, 2, 200, 200.2, 300.35, 456.12, '2024-05-01 08:00:00Z', '2024-05-01 14:00:00Z', '00000000-0000-0000-0000-000000000000', '01:00:00', '2022-12-01', '01:30:00.000000', 0, 2, 200, 200.2, 300.35, 456.12, '2024-04-01 08:00:00Z', '2024-04-01 14:00:00Z', '00000000-0000-0000-0000-000000000000', '01:00:00', '2022-12-01', '01:30:00.000000'), - (2, 'Test2', 1, 3, 400, 600.2, 700.35, 856.12, '2024-05-01 08:00:00Z', '2024-05-01 14:00:00Z', '00000000-0000-0000-0000-000000000000', '02:00:00', '2022-12-12', '06:30:00.000000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) + (1, 'Test1', 0, 2, 200, 200.2, 300.35, 456.12, '2024-05-01 08:00:00.000', '2024-05-01 08:00:00.000000-06:00', '00000000-0000-0000-0000-000000000000', '01:00:00', '2022-12-01', '01:30:00.000000', 0, 2, 200, 200.2, 300.35, 456.12, '2024-04-01 08:00:00.000', '2024-04-01 08:00:00.000000-06:00', '00000000-0000-0000-0000-000000000000', '01:00:00', '2022-12-01', '01:30:00.000000'), + (2, 'Test2', 1, 3, 400, 600.2, 700.35, 856.12, '2024-05-01 08:00:00.000', '2024-05-01 08:00:00.000000-06:00', '00000000-0000-0000-0000-000000000000', '02:00:00', '2022-12-12', '06:30:00.000000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) ) AS s (