Skip to content

Releases: ANDERSON1808/mapstructure

Add Time Format Support to decodeTime Function

Choose a tag to compare

@ANDERSON1808 ANDERSON1808 released this 29 Nov 20:36

Description:
This pull request introduces enhancements to the decodeTime function in the mapstructure package. The primary objective is to enable the function to handle time values with dynamic formats, providing more flexibility in decoding time representations.

Changes Made:

  1. Modified the decodeTime function to support dynamic time formats.
  2. Updated the test cases in mapstructure_test.go to cover various scenarios, including decoding time.Time, *time.Time, nil *time.Time, and a string representation of time with a dynamic format.

Code Modifications:

  • Adjustments made to decodeTime function in mapstructure.go to handle dynamic time formats.
  • Addition of a new test case in mapstructure_test.go to cover the scenario of decoding a string representation of time with a dynamic format.

Test Cases Added:

  • Decode string time:
    • Purpose: To ensure that the decodeTime function correctly decodes a string representation of time with a dynamic format.
    • Input: "2023-11-30T12:34:56Z" (format: RFC3339, but can be any valid format)
    • Expected Output: No error, and the time value is correctly set in the output.

Testing Approach:

  1. Run existing test cases to ensure that the original functionality remains intact.
  2. Execute the new test case to verify the added support for dynamic time formats.
  3. Manually review the modified code to ensure clarity and adherence to coding standards.
  4. Conduct additional testing with various time formats to validate the flexibility of the updated decodeTime function.

Add Time Format Support to decodeTime Function

Choose a tag to compare

@ANDERSON1808 ANDERSON1808 released this 29 Nov 20:08

Description:
This pull request introduces enhancements to the decodeTime function in the mapstructure package. The primary objective is to enable the function to handle time values with dynamic formats, providing more flexibility in decoding time representations.

Changes Made:

  1. Modified the decodeTime function to support dynamic time formats.
  2. Updated the test cases in mapstructure_test.go to cover various scenarios, including decoding time.Time, *time.Time, nil *time.Time, and a string representation of time with a dynamic format.

Code Modifications:

  • Adjustments made to decodeTime function in mapstructure.go to handle dynamic time formats.
  • Addition of a new test case in mapstructure_test.go to cover the scenario of decoding a string representation of time with a dynamic format.

Test Cases Added:

  • Decode string time:
    • Purpose: To ensure that the decodeTime function correctly decodes a string representation of time with a dynamic format.
    • Input: "2023-11-30T12:34:56Z" (format: RFC3339, but can be any valid format)
    • Expected Output: No error, and the time value is correctly set in the output.

Testing Approach:

  1. Run existing test cases to ensure that the original functionality remains intact.
  2. Execute the new test case to verify the added support for dynamic time formats.
  3. Manually review the modified code to ensure clarity and adherence to coding standards.
  4. Conduct additional testing with various time formats to validate the flexibility of the updated decodeTime function.