Base solution for your next web application
Open Closed

Changing the time zone breaks the system #4782


User avatar
0
softcial created

Hi,

I changed the time zone value for the admin user for the default tenant. Then I clicked on the button to refresh the app and it crashed. I was not able to login again until I deleted the time zone setting for the admin user at the AbpSettings table.

Prior to delete the time zone setting at the AbpSettings table I inspected the Audit Logs and found the following exception: System.Exception: Unable to map America/Tijuana to iana timezone. at Abp.Timing.Timezone.TimezoneHelper.WindowsToIana(String windowsTimezoneId) at Abp.Web.Configuration.AbpUserConfigurationBuilder.

This exception is happening at the AbpUserConfigurationController.GetAll method

I realized that the time zone value stored at the AbpSettings table was "America/Tijuana" which corresponds to the IANA time zone format and so when calling the WindowsToIana method it fails cause "America/Tijuana' is not a valid Windows Standard time zone value.

So, I'm wondering if this is a bug in the system or a missing configuration.

Please advice! Thanks!


7 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @softcial,

    What is your AspNet Zero version ? This problem must be fixed with <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/667">https://github.com/aspnetzero/aspnet-ze ... issues/667</a>.

  • User Avatar
    0
    softcial created

    I'm using version 5.0.0

    Do I have to replace the library you are using by the one specified in the provided link?

  • User Avatar
    0
    alper created
    Support Team

    yes

  • User Avatar
    0
    softcial created

    You mean that I have to update to ASP.NET zero 5.1, right?

  • User Avatar
    0
    softcial created

    @ismcagdas

    Unfortunately, updating the system to the 5.1.0 version didn't work. The TimingService.GetTimeZones method continues returning IANA time zone values as show below: "result": { "items": [ { "name": "Default [UTC]", "value": "" }, { "name": "GMT-12:00", "value": "Etc/GMT+12" }, { "name": "GMT-11:00", "value": "Etc/GMT+11" }, { "name": "Hawaii-Aleutian Standard Time", "value": "America/Adak" }, { "name": "Hawaii-Aleutian Standard Time", "value": "Pacific/Honolulu" }, { "name": "Marquesas Time", "value": "Pacific/Marquesas" }, { "name": "Alaska Standard Time", "value": "America/Anchorage" }, { "name": "GMT-09:00", "value": "Etc/GMT+9" }, { "name": "Pacific Standard Time", "value": "America/Tijuana" }, { "name": "Pacific Standard Time", "value": "America/Los_Angeles" }, ...

    I modified the code as follows (changing Id to StandardName as the entry for the "value" property) ...

    public List<NameValueDto> GetWindowsTimezones() { return TZConvert.KnownWindowsTimeZoneIds.Select(TZConvert.GetTimeZoneInfo) .OrderBy(tz => tz.BaseUtcOffset) .Select(tz => new NameValueDto { Value = tz.StandardName,//tz.Id, Name = tz.DisplayName }).ToList(); }

    ... obtaining the following output from the TimingService.GetTimeZones method: { "result": { "items": [ { "name": "Default [UTC]", "value": "" }, { "name": "GMT-12:00", "value": "GMT-12:00" }, { "name": "GMT-11:00", "value": "GMT-11:00" }, { "name": "Hawaii-Aleutian Standard Time", "value": "Hawaii-Aleutian Standard Time" }, { "name": "Hawaii-Aleutian Standard Time", "value": "Hawaii-Aleutian Standard Time" }, { "name": "Marquesas Time", "value": "Marquesas Time" }, { "name": "Alaska Standard Time", "value": "Alaska Standard Time" }, { "name": "GMT-09:00", "value": "GMT-09:00" }, ...

    and now I'm getting the following exception when setting any user time zone property: System.TimeZoneNotFoundException: The time zone ID 'Central Standard Time' was not found on the local computer. ---> System.IO.FileNotFoundException: Could not find file '/usr/share/zoneinfo/Central Standard Time'.

    That is because "Central Standard Time" does not exist as a time zone in Ubuntu (the OS for the hosting server).

    So, I think that the system must be updated in order to properly handle IANA time zones for Unix based operating systems. Any thoughts? Thanks!

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks for detailed explanation, I have created an issue here <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/903">https://github.com/aspnetzero/aspnet-ze ... issues/903</a>. We forgot to update some parts when fixing that problem. I will work on this issue in a short time. You can follow related issue to get updated.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Can you try the fix in this issue <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/903">https://github.com/aspnetzero/aspnet-ze ... issues/903</a> ?

    By they way, the latest version of GetWindowsTimezones method should be like below;

    public List<NameValueDto> GetWindowsTimezones()
    {
    	return TimezoneHelper.GetWindowsTimeZoneInfos().OrderBy(tz => tz.BaseUtcOffset)
    		.Select(tz => new NameValueDto
    		{
    			Value = tz.Id,
    			Name = tz.DisplayName
    		}).ToList();
    }