Since we can no longer use .NET assemblies directly in Cloud development, a lot of time zone related calculations have made us dependent on the TypeHelper codeunit. However, this codeunit does not allow for daylight saving time.
The procedure GetTimezoneOffset(var Duration: Duration; TimeZoneID: Text), for example, only returns the base UTC offset for a time zone. There is no similar function that has a datetime as an input and then returns the UTC offset based off of that datetime.
Since we cannot contribute to W1 via GitHub as we can to the system app, I will attempt to request it here. What we essentially need are the following two procedures added to the TypeHelper codeunit:
procedure GetTimeZoneOffset(SourceDateTime: DateTime; TimeZoneId: Text): Duration
var
TimeZoneInfoDotNet: DotNet TimeZoneInfo;
begin
TimeZoneInfoDotNet.FindSystemTimeZoneById(TimeZoneId);
exit(TimeZoneInfoDotNet.GetUtcOffset(SourceDateTime));
end;
procedure IsTimeZoneDaylightSavingTimeSupported(TimeZoneId: Text): Boolean
var
TimeZoneInfoDotNet: DotNet TimeZoneInfo;
begin
TimeZoneInfoDotNet.FindSystemTimeZoneById(TimeZoneId);
exit(TimeZoneInfoDotNet.SupportsDaylightSavingTime);
end;