diff --git a/DigitalData.Core.Security/Config/AsymCryptParams.cs b/DigitalData.Core.Security/Config/AsymCryptParams.cs index c4ef697..7547f50 100644 --- a/DigitalData.Core.Security/Config/AsymCryptParams.cs +++ b/DigitalData.Core.Security/Config/AsymCryptParams.cs @@ -41,11 +41,11 @@ namespace DigitalData.Core.Security.Config ///
/// - is used when converting to tag. ///
- /// - 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: ///
- /// - 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). ///
/// - If the format does not contain "//", the method uses the default format. ///
diff --git a/DigitalData.Core.Security/Config/StringExtensions.cs b/DigitalData.Core.Security/Config/StringExtensions.cs index 379af2e..889075f 100644 --- a/DigitalData.Core.Security/Config/StringExtensions.cs +++ b/DigitalData.Core.Security/Config/StringExtensions.cs @@ -13,15 +13,14 @@ /// /// Converts a to a formatted string based on the specified format string. ///
- /// - 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: ///
- /// - 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). ///
/// - If the format does not contain "//", the method uses the default format. ///
- /// This method provides a way to format the date based on typical or customized rules, including mathematical operations like division. ///
/// The value to be formatted. /// 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 @@ /// /// Converts a to a formatted string based on the specified format string. ///
- /// - 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: ///
- /// - 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). ///
/// - If the format does not contain "//", the method uses the default format. ///