Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert date to string #77

Merged
merged 9 commits into from
Nov 14, 2023
Merged

Convert date to string #77

merged 9 commits into from
Nov 14, 2023

Conversation

CarlosGamero
Copy link
Contributor

@CarlosGamero CarlosGamero commented Nov 13, 2023

Changes

Adding convertDatesToIsoString to transform an input object with Date members into an object with the corresponding Date members replaced by their ISO string representation. This transformation is done recursively, covering nested objects as well.

Checklist

  • Apply one of following labels; major, minor, patch or skip-release
  • I've updated the documentation, or no changes were necessary
  • I've updated the tests, or no changes were necessary

@CarlosGamero CarlosGamero self-assigned this Nov 13, 2023
@CarlosGamero CarlosGamero marked this pull request as ready for review November 13, 2023 14:31
@CarlosGamero CarlosGamero marked this pull request as draft November 13, 2023 14:33
src/utils/objectUtils.ts Outdated Show resolved Hide resolved
@CarlosGamero CarlosGamero marked this pull request as ready for review November 13, 2023 18:27
code: 100,
}

const output: TestExpectedType = convertDateFieldsToIsoString(input)
Copy link
Collaborator

@kibertoad kibertoad Nov 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to do explicit type here? is it meant as a assert-like?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is automatically inferring the type.

yes, it is like an assert to make sure the type is being inferred correctly

@CarlosGamero CarlosGamero merged commit adedaee into main Nov 14, 2023
5 checks passed
@CarlosGamero CarlosGamero deleted the feature/convert_date_to_string branch November 14, 2023 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants