Reputation: 661
I have a WebAPI application hosted on Azure (on US), which I don't have full controll of the server.
My decision about globalization for showing date was making it fixed for my country (BR), using the ID E. South America Standard Time
.
The following method worked just fine:
TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById("E. South America Standard Time");
That method somehow checks if the specified day IsDaylightSavingTime
or not, to make sure it shows the correct datetime. Works perfectly!
But this year the President announced that the daylight saving on Brazil will not start on the 3º sunday of October, but on November from now.
This method is considering, that it starts on day 21/10/2018, WHICH HAS CHANGED. I'll have problems for sure if it stays like that.
I found out that the the IsDaylightSavingTime belongs to the System namespace, which makes me believe that the issue is within the Windows configuration.
I don't know if Microsoft is able to change it automatically on all Azure servers, or if I'm able to somehow change it manually.
*Obs: I don't want to do that to fix it, will have more issues if Microsoft updates the daylight time:
if (date > XXXX && date < XXXX) date.AddHours(1);
Google stills shows it wrong for me, some other websites already have it updated.
Upvotes: 1
Views: 136
Reputation: 241563
Yes, you are correct that the start of DST in Brazil has changed for 2018. This is described well here.
On behalf of Microsoft, I can tell you that we are aware of this change and it is currently in-progress through our servicing process. An official announcement will be made on the Microsoft Daylight Saving Time & Time Zone Blog when it is available.
Like prior TZ/DST updates, systems that are kept updated will receive this change automatically, through Windows Update or the Windows 10 servicing process. Azure PaaS services have their own process of how they receive updates. As they do, they will pick up this change. You should expect some time to pass between the release of the update and when it is applied in your environment.
It is not advisable to try to correct for this yourself by adding an hour as you showed in your question. Doing so will lead to being an hour off when the update has been applied.
As an alternative, if you feel you want to take control over this functionality yourself, then consider implementing Noda Time in your application. The latest 2.2.4 release includes IANA TZDB 2018c, which includes the Brazil change. You would use America/Sao_Paulo
for the time zone ID.
Upvotes: 1