From 11eeddcfa1483c6f5f9bd001d252d88452061bc9 Mon Sep 17 00:00:00 2001 From: Andreas Moth <10121161+AndreasMoth@users.noreply.github.com> Date: Fri, 1 Nov 2024 16:24:11 +0100 Subject: [PATCH] Unix Timestamp test should use offset for the specified date (#2287) The current date may have daylights savings or not. This will cause the test to fail if daylight savings is in effect. Hence getting the offset based on the given date instead. Fixes [AB#555940](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/555940) --- .../Test/Date and Time/src/UnixTimestampTest.Codeunit.al | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/System Application/Test/Date and Time/src/UnixTimestampTest.Codeunit.al b/src/System Application/Test/Date and Time/src/UnixTimestampTest.Codeunit.al index 9de8b25ac7..b74599b3d0 100644 --- a/src/System Application/Test/Date and Time/src/UnixTimestampTest.Codeunit.al +++ b/src/System Application/Test/Date and Time/src/UnixTimestampTest.Codeunit.al @@ -29,7 +29,7 @@ codeunit 132980 "Unix Timestamp Test" // [GIVEN] A DateTime with value 2024-07-01 06:30:30 in the user time zone GivenDateTime := CreateDateTime(20240701D, 063030T); // [GIVEN] The offset of the session's timezone - Offset := TimeZone.GetTimezoneOffset(CurrentDateTime); + Offset := TimeZone.GetTimezoneOffset(GivenDateTime); // [WHEN] Given DateTime is converted to a Unix timestamp after a correction for timezone offset ResultTimestamp := UnixTimestamp.CreateTimestampSeconds(GivenDateTime + Offset); @@ -52,7 +52,7 @@ codeunit 132980 "Unix Timestamp Test" // [GIVEN] A DateTime with value 2024-07-01 06:30:30 in the user time zone GivenDateTime := CreateDateTime(20240701D, 063030T); // [GIVEN] The offset of the session's timezone - Offset := TimeZone.GetTimezoneOffset(CurrentDateTime); + Offset := TimeZone.GetTimezoneOffset(GivenDateTime); // [WHEN] Given DateTime is converted to a Unix timestamp after a correction for timezone offset ResultTimestamp := UnixTimestamp.CreateTimestampMilliseconds(GivenDateTime + Offset);