{"record":{"id":"79bd7a05de065eba","repo":"Humanizr/Humanizer","slug":"grammatical-case-is-not-supported-for-time-unit-sy","errorCode":null,"errorMessage":"Grammatical case is not supported for time-unit symbols.","messagePattern":"Grammatical case is not supported for time-unit symbols\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/Humanizer/TimeSpanHumanizeExtensions.cs","lineNumber":652,"sourceCode":"        TimeSpan timeSpan,\n        int precision,\n        bool countEmptyUnits,\n        CultureInfo? culture,\n        TimeUnit maxUnit,\n        TimeUnit minUnit,\n        string? collectionSeparator,\n        bool toWords,\n        bool toSymbols,\n        GrammaticalCase? grammaticalCase)\n    {\n        if (grammaticalCase is { } requestedCase)\n        {\n            ValidateGrammaticalCase(requestedCase);\n        }\n\n        if (toSymbols && grammaticalCase is not null)\n        {\n            throw new NotSupportedException(\"Grammatical case is not supported for time-unit symbols.\");\n        }\n\n        if (precision == 1 && !countEmptyUnits)\n        {\n            return HumanizeSinglePart(timeSpan, culture, maxUnit, minUnit, toWords, toSymbols, grammaticalCase);\n        }\n\n        var timeParts = CreatePrecisionLimitedTimeParts(\n            timeSpan,\n            culture,\n            maxUnit,\n            minUnit,\n            precision,\n            countEmptyUnits,\n            toWords,\n            toSymbols,\n            grammaticalCase);\n","sourceCodeStart":634,"sourceCodeEnd":670,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer/TimeSpanHumanizeExtensions.cs#L634-L670","documentation":"Thrown by DefaultHumanizeCore when both toSymbols is true and a grammaticalCase is specified. Time-unit symbols (e.g. \"1h\", \"30m\") are abbreviations that do not inflect by grammatical case, so requesting a case alongside symbols is logically contradictory.","triggerScenarios":"Calling a humanize overload that sets toSymbols=true while also passing a non-null grammaticalCase. This can happen indirectly through HumanizeWithCase when the code path routes to symbol output.","commonSituations":"Developer combines toSymbols and grammaticalCase in the same call expecting case-aware abbreviations. Misunderstanding that symbols are case-invariant. Passing both parameters from a configuration object.","solutions":["Do not combine toSymbols=true with a grammaticalCase; choose words (toWords) for case support.","Set grammaticalCase to null when using symbols.","Split the call: use symbols without case, or words with case."],"exampleFix":"// before\nvar s = ts.HumanizeWithCase(GrammaticalCase.Genitive, precision: 1, toSymbols: true);\n\n// after\nvar s = ts.HumanizeWithCase(GrammaticalCase.Genitive, precision: 1);\n// symbols are not requested; words support case inflection","handlingStrategy":"validation","validationCode":"static void AssertSymbolCaseCompat(bool toSymbols, GrammaticalCase? grammaticalCase)\n{\n    if (toSymbols && grammaticalCase is not null)\n        throw new InvalidOperationException(\"Symbols and grammatical case are mutually exclusive.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass both toSymbols=true and a grammaticalCase.","Use words (toWords=true) when you need case inflection.","Document the mutual exclusivity in your API wrapper."],"tags":["timespan","grammatical-case","symbols","not-supported"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}