What is your product version? 10.3.0
What is your product type (Angular or MVC)? Angular
What is product framework type (.net framework or .net core)? .NET 5
Hi, Is there a way we can update the Time Zone list in settings to show based on the time zones rather than time zone names? For ex. GMT - 11:30 (City names) GMT - 11:00 (City names)
GMT (City names)
GMT + 11:30 (City names) GMT + 12:00 (City Names)
Or, as an alternative is it possible to append the Timezone against each of the currently shown time zone names? Such As
GMT + 5:30 - India Standard Time
Any of these two options possible? If yes could you help us underatand how best we can do this?
Thanks
9 Answer(s)
-
0
Hi,
This list is retrieved in https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Core/Timing/TimeZoneService.cs#L58.
You can change
GetWindowsTimezonesmethod as shown below;public List<NameValueDto> GetWindowsTimezones() { return TZConvert.KnownWindowsTimeZoneIds.OrderBy(tz => tz) .Select(tz => new NameValueDto { Value = TZConvert.GetTimeZoneInfo(tz).DisplayName, Name = tz }).ToList(); }Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
HI ismcagdas, after changing the list and saving the time zone for user it is given us below exception and it is not allowing user to access the application
Exception of type 'System.TimeZoneNotFoundException' was thrown. System.TimeZoneNotFoundException: Exception of type 'System.TimeZoneNotFoundException' was thrown. at TimeZoneConverter.TZConvert.GetTimeZoneInfo(String windowsOrIanaTimeZoneId)
at Abp.Timing.Timezone.TimezoneHelper.FindTimeZoneInfo(String windowsOrIanaTimeZoneId) at Abp.Web.Configuration.AbpUserConfigurationBuilder.GetUserTimingConfig()
at Abp.Web.Configuration.AbpUserConfigurationBuilder.GetAll()
at Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll() at lambda_method2024(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi,
Could you share your final code for
GetWindowsTimezones?Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
I have used the same code which you have shared with us I have just copied and paste it
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi,
Sorry, I think I made a mistake, could you try this:
public List<NameValueDto> GetWindowsTimezones() { return TZConvert.KnownWindowsTimeZoneIds.OrderBy(tz => tz) .Select(tz => new NameValueDto { Value = tz, Name = TZConvert.GetTimeZoneInfo(tz).DisplayName }).ToList(); }Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
I too get an error. V11 MVC Jquery
System.MissingMethodException HResult=0x80131513 Message=Method not found: 'System.Collections.Generic.ICollection`1<System.String> TimeZoneConverter.TZConvert.get_KnownWindowsTimeZoneIds()'. Source=inzibackend.Core StackTrace: at inzibackend.Timing.TimeZoneService.GetWindowsTimezones() in C:\Dev\Surpathv2\src\inzibackend.Core\Timing\TimeZoneService.cs:line 76 at inzibackend.Timing.TimingAppService.<GetTimezoneInfos>d__4.MoveNext() in C:\Dev\Surpathv2\src\inzibackend.Application\Timing\TimingAppService.cs:line 50 This exception was originally thrown at this call stack: inzibackend.Timing.TimingAppService.GetTimezoneInfos(Abp.Configuration.SettingScopes) in TimingAppService.csThis is the function that throws:
return TZConvert.KnownWindowsTimeZoneIds.OrderBy(tz => tz) .Select(tz => new NameValueDto { Value = tz, Name = TZConvert.GetTimeZoneInfo(tz).DisplayName }).ToList();Haven't resolved it yet.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
I too get an error. V11 MVC Jquery
System.MissingMethodException HResult=0x80131513 Message=Method not found: 'System.Collections.Generic.ICollection`1<System.String> TimeZoneConverter.TZConvert.get_KnownWindowsTimeZoneIds()'. Source=inzibackend.Core StackTrace: at inzibackend.Timing.TimeZoneService.GetWindowsTimezones() in C:\Dev\Surpathv2\src\inzibackend.Core\Timing\TimeZoneService.cs:line 76 at inzibackend.Timing.TimingAppService.<GetTimezoneInfos>d__4.MoveNext() in C:\Dev\Surpathv2\src\inzibackend.Application\Timing\TimingAppService.cs:line 50 This exception was originally thrown at this call stack: inzibackend.Timing.TimingAppService.GetTimezoneInfos(Abp.Configuration.SettingScopes) in TimingAppService.csThis is the function that throws:
return TZConvert.KnownWindowsTimeZoneIds.OrderBy(tz => tz) .Select(tz => new NameValueDto { Value = tz, Name = TZConvert.GetTimeZoneInfo(tz).DisplayName }).ToList();Haven't resolved it yet.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
What's interesting, is if I move that function from the TimeZoneService, and run it inside the TimingAppService, it works fine.
Only when it's under Core project does it fail.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
I determined why: I was importing a project into the .core project and it downgraded TZConvert.
I made sure my imported project's csproj file, packages, etc were as identical to .core as I could - and in doing so, the TZConvert is behaving as expected.
Therefore, shedspotter, check your nuget packages, and more in the csproj file - in the event you're importing a project or a package downgraded your TZConvert.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)