Base solution for your next web application
Open Closed

Deploying to Azure as web app on linux - get error finding time zones #9480


User avatar
0
marble68 created

8.9/jQuery

Deployed to azure as an app service on Linux-

Getting error: The time zone ID 'Central Standard Time' was not found on the local computer.

What do I need to do to make this go away and resolve?


2 Answer(s)
  • User Avatar
    0
    rickfrankel created

    Hi Marble,

    I've worked around this by changing the TimeZoneService.cs

        public List<NameValueDto> GetWindowsTimezones()
        {
            return TZConvert.KnownWindowsTimeZoneIds
                .Where(tz =>TZConvert.TryGetTimeZoneInfo(tz, out var notUsed))
                .OrderBy(tz => TZConvert.GetTimeZoneInfo(tz).BaseUtcOffset)
                .Select(tz => new NameValueDto
                {
                    Value = tz,
                    Name = TZNames.GetDisplayNameForTimeZone(tz, "en-US")
                }).ToList();
        }
        
        I used a nuget package https://github.com/mj1856/TimeZoneNames to make this work.
        
        It works acceptably for me.  It's not perfect however.
    
  • User Avatar
    0
    marble68 created

    thank you, i'll investigate this.