mitchellh / mapstructure

Go library for decoding generic map values into native Go structures and vice versa.
https://gist.github.com/mitchellh/90029601268e59a29e64e55bab1c5bdc
MIT License
7.93k stars 677 forks source link

Add Time Format Support to "decodeTime" Function #345

Closed ANDERSON1808 closed 1 year ago

ANDERSON1808 commented 1 year ago

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:

Test Cases Added:

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.

Purpose: