Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

How to tell ANZ to use IANA instead of Windows time zones, regardless if on windows or Linux? #9511


User avatar
0
marble68 created

8.9/ JQuery Developed on windows, deployed to Azure. Azure doesn't have windows time zones.

Tried modifying the time service to do translation. Sort of works, but my solution depends heavily on time zone conversions.

Logged in as host, changed Host's timezone to (UTC-06:00) Central Time (US & Canada), and save it.

In AbpSetting Table - it sets the value to the Windows Time Zone name.

Of course, when I go back to settings, it's incorrect, because it can't find "Central Standard Time".

How do I configure ABP to always use IANA timezoninfo, even on Windows?

Thanks!


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    hi

    Time Zones

    ABP defines a setting named Abp.Timing.TimeZone (TimingSettingNames.TimeZone constant) for storing the selected timezone of the host, tenant and user. ABP assumes that the value of a timezone setting is a valid Windows timezone name. It also defines a timezone mapping file to convert a Windows Timezone to an IANA timezone since some common libraries are using the IANA timezone id. UtcClockProvider must be used in order to support multiple timezones. Because if UtcClockProvider is used, all datetime values will be stored in UTC and all datetimes will be sent to clients in UTC format. Then on the client-side we can convert a UTC datetime to the user's timezone by using the user's current timezone setting.

    https://aspnetboilerplate.com/Pages/Documents/Timing#time-zones

    https://github.com/aspnetboilerplate/aspnetboilerplate/blob/e0ded5d8702f389aa1f5947d3446f16aec845287/src/Abp/Timing/Timezone/TimezoneHelper.cs#L31