You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
According to the documentation, version 33.x introduced a new way to consider timezones. According to the code in FtpClient_Timezone.cs file, the code (at least for CORE) is:
if (m_timeConversion == FtpDate.LocalTime) {
date = date + m_localTimeOffset;
}
where m_localTimeOffset is (not sure) the offset specified in the FtpClient.LocalTimeZone property.
But, m_localTimeOffset should be different in case of summer-winter time, so, it depends on the date that is going to be converted itself.
In my opinion, the code used for .net framework (that is, date = System.TimeZone.CurrentTimeZone.ToLocalTime(date);) should be also applied in CORE.
You are right. System.TimeZone is marked as "Obsolete" in .net standard 2.x and not even available in .net standard 1.x.
However is it possible to rewrite everything using System.TimeZoneInfo (any .net standard):
date = TimeZoneInfo.ConvertTime(date, TimeZoneInfo.Local);
But, I don't know if the timestamp sent by the server is always UTC or not. Otherwise a workaround is to allow user to inject a "IConvertTimestamp" object or just a Func<DateTime, DateTime> to handle the conversion manually. Otherwise, I can (in my code) remove 1h, and convert it later. Just hypothesis.
What I know is that:
2020-01-01 00:00:00 (UTC) should be converted to 2020-01-01 01:00:00 (CET)
2020-06-01 00:00:00 (UTC) should be converted to 2020-06-01 02:00:00 (CET)
Activity
robinrodricks commentedon Dec 6, 2020
.NET core was coded differently because it did not support the same methods as .NET Framework.
sierrodc commentedon Dec 6, 2020
You are right. System.TimeZone is marked as "Obsolete" in .net standard 2.x and not even available in .net standard 1.x.
However is it possible to rewrite everything using System.TimeZoneInfo (any .net standard):
date = TimeZoneInfo.ConvertTime(date, TimeZoneInfo.Local);But, I don't know if the timestamp sent by the server is always UTC or not. Otherwise a workaround is to allow user to inject a "IConvertTimestamp" object or just a Func<DateTime, DateTime> to handle the conversion manually. Otherwise, I can (in my code) remove 1h, and convert it later. Just hypothesis.
What I know is that:
2020-01-01 00:00:00 (UTC) should be converted to 2020-01-01 01:00:00 (CET)
2020-06-01 00:00:00 (UTC) should be converted to 2020-06-01 02:00:00 (CET)
robinrodricks commentedon Jan 3, 2021
If you can suggest some part of the API to change, it can be done.
robinrodricks commentedon Sep 19, 2022
Added to the bucket list. We will pick this up as and when we have free time. Comment on this issue if you want us to prioritize it. Thanks!
robinrodricks commentedon Nov 30, 2024
Done!
See #1680 (comment)