You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicstaticstringUserUnban(OgmaUseruser,stringmodName,DateTimeuntil)=>$"User **{user.UserName}** (id: {user.Id}) has been unbanned {(DateTime.Now -until).Humanize(3)} early by **{modName}**.";
with the value of until being DateTime.Now.AddDays(35.0). With until being DateTime.Now.AddDays(3), the exception is TimeSpanHumanize_MultipleDays.
Issue seems to persist even if no precision is given.
Exception:
System.ArgumentException: The resource object with key 'TimeSpanHumanize_MultipleWeeks' was not found (Parameter 'resourceKey')
at Humanizer.Localisation.Formatters.DefaultFormatter.Format(String resourceKey, Int32 number, Boolean toWords) in /_/src/Humanizer/Localisation/Formatters/DefaultFormatter.cs:line 118
at Humanizer.Localisation.Formatters.DefaultFormatter.GetResourceForTimeSpan(TimeUnit unit, Int32 count, Boolean toWords) in /_/src/Humanizer/Localisation/Formatters/DefaultFormatter.cs:line 83
at Humanizer.Localisation.Formatters.DefaultFormatter.TimeSpanHumanize(TimeUnit timeUnit, Int32 unit, Boolean toWords) in /_/src/Humanizer/Localisation/Formatters/DefaultFormatter.cs:line 71
at Humanizer.TimeSpanHumanizeExtensions.CreateTheTimePartsWithUpperAndLowerLimits(TimeSpan timespan, CultureInfo culture, TimeUnit maxUnit, TimeUnit minUnit, Boolean toWords) in /_/src/Humanizer/TimeSpanHumanizeExtensions.cs:line 63
at Humanizer.TimeSpanHumanizeExtensions.Humanize(TimeSpan timeSpan, Int32 precision, Boolean countEmptyUnits, CultureInfo culture, TimeUnit maxUnit, TimeUnit minUnit, String collectionSeparator, Boolean toWords) in /_/src/Humanizer/TimeSpanHumanizeExtensions.cs:line 50
at Humanizer.TimeSpanHumanizeExtensions.Humanize(TimeSpan timeSpan, Int32 precision, CultureInfo culture, TimeUnit maxUnit, TimeUnit minUnit, String collectionSeparator, Boolean toWords) in /_/src/Humanizer/TimeSpanHumanizeExtensions.cs:line 33
at Ogma3.Data.ModeratorActionTemplates.UserUnban(OgmaUser user, String modName, DateTime until) in G:\VS Projects\Ogma3\Ogma3\Data\ModeratorActionTemplates.cs:line 13
at Ogma3.Api.V1.UsersController.BanUser(BanData data) in G:\VS Projects\Ogma3\Ogma3\Api\V1\UsersController.cs:line 141
at lambda_method801(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.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
The text was updated successfully, but these errors were encountered:
I thought Humanizer uses CultureInfo.InvariantCulture by default, but it seems it tried to use a culture whose dictionary wasn't installed. Specifying the culture explicitly seems to have helped:
Versions:
My code:
with the value of
until
beingDateTime.Now.AddDays(35.0)
. Withuntil
beingDateTime.Now.AddDays(3)
, the exception isTimeSpanHumanize_MultipleDays
.Issue seems to persist even if no precision is given.
Exception:
The text was updated successfully, but these errors were encountered: