fix(StringExtensions): Die Hauptformel der ToTag-Methode wurde von (x / y) in [(x - 1) / y + 1] geändert, um korrekt zu gruppieren.

- Aktualisierte Dokumentationskommentare
This commit is contained in:
Developer 02 2024-12-18 18:10:52 +01:00
parent 4f6ca3524a
commit d7b4c382cd
2 changed files with 13 additions and 14 deletions

View File

@ -41,11 +41,11 @@ namespace DigitalData.Core.Security.Config
/// <br />
/// - <see cref="StringExtensions.ToTag(DateTime, string)" /> is used when converting to tag.
/// <br />
/// - If the format contains the "//" symbol, the method divides the numeric value derived from the left side of the format
/// by the numeric value of the right side of the format string. For instance:
/// - If the format contains the symbol “//”, the method divides the numeric value obtained from the left side of the format
/// by one minus the numeric value obtained from the right side of the format string and adds one. For instance:
/// <br />
/// - If the date is 02.03.2024 and the format is "MM//2", it extracts the month (02), divides it by 2 (resulting in 1),
/// and returns "1".
/// - If the date is 02.03.2024 and the format is "MM//2", it extracts the month (02), subtracts one (3), divides it by 2,
/// rounds down the outgoing number (1), adds one to the number (resulting in 2).
/// <br />
/// - If the format does not contain "//", the method uses the default <see cref="DateTime.ToString"/> format.
/// <br />

View File

@ -13,15 +13,14 @@
/// <summary>
/// Converts a <see cref="DateTime"/> to a formatted string based on the specified format string.
/// <br />
/// - If the format contains the "//" symbol, the method divides the numeric value derived from the left side of the format
/// by the numeric value of the right side of the format string. For instance:
/// - If the format contains the symbol “//”, the method divides the numeric value obtained from the left side of the format
/// by one minus the numeric value obtained from the right side of the format string and adds one. For instance:
/// <br />
/// - If the date is 02.03.2024 and the format is "MM//2", it extracts the month (02), divides it by 2 (resulting in 1),
/// and returns "1".
/// - If the date is 02.03.2024 and the format is "MM//2", it extracts the month (02), subtracts one (3), divides it by 2,
/// rounds down the outgoing number (1), adds one to the number (resulting in 2).
/// <br />
/// - If the format does not contain "//", the method uses the default <see cref="DateTime.ToString"/> format.
/// <br />
/// This method provides a way to format the date based on typical or customized rules, including mathematical operations like division.
/// </summary>
/// <param name="date">The <see cref="DateTime"/> value to be formatted.</param>
/// <param name="format">The format string that dictates the formatting of the date. If the format includes the "//" symbol,
@ -51,7 +50,7 @@
if (mode == 0)
throw new DivideByZeroException("Division by zero is not allowed.");
var result = dateValue / mode;
var result = (dateValue - 1) / mode + 1;
return result.ToString();
}
@ -61,11 +60,11 @@
/// <summary>
/// Converts a <see cref="DateTime"/> to a formatted string based on the specified format string.
/// <br />
/// - If the format contains the "//" symbol, the method divides the numeric value derived from the left side of the format
/// by the numeric value of the right side of the format string. For instance:
/// - If the format contains the symbol “//”, the method divides the numeric value obtained from the left side of the format
/// by one minus the numeric value obtained from the right side of the format string and adds one. For instance:
/// <br />
/// - If the date is 02.03.2024 and the format is "MM//2", it extracts the month (02), divides it by 2 (resulting in 1),
/// and returns "1".
/// - If the date is 02.03.2024 and the format is "MM//2", it extracts the month (02), subtracts one (3), divides it by 2,
/// rounds down the outgoing number (1), adds one to the number (resulting in 2).
/// <br />
/// - If the format does not contain "//", the method uses the default <see cref="DateTime.ToString"/> format.
/// <br />