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

JSON conversion for not available date fields is “0001-01-01T00:00:00Z" #196

Open
caryp opened this issue Jun 6, 2024 · 5 comments · May be fixed by #197
Open

JSON conversion for not available date fields is “0001-01-01T00:00:00Z" #196

caryp opened this issue Jun 6, 2024 · 5 comments · May be fixed by #197

Comments

@caryp
Copy link

caryp commented Jun 6, 2024

Metro2 Version: latest|0.9.0

What were you trying to do?
Convert a METRO2 file to JSON with zero-filled dates for some non-required date fields.

What did you expect to see?
From the CDIA's METRO2 2020 Credit Reporting Resource Guide, we see that the Header Record (Char format) Field 10 is Program Date, is not required, and is Recording Technique of "numeric".

From the "Programing standards" section in the same guide it mentions:
"If a numeric field is not available, it should be zero filled."

I would expect the converted JSON data for a zero-filled date field to be blank (e.g. "")

What did you see?
Zero-filled dates are being converted to JSON with a value of “0001-01-01T00:00:00Z" -- which is the IsZero() value.

How can we reproduce the problem?
Convert any non-required data field (like Base Record Field 10 "dateClosed") to all zeros and convert to JSON.

@caryp
Copy link
Author

caryp commented Jun 6, 2024

Not sure how to assign to myself, but I am happy to submit a proposed change for this.

@caryp caryp linked a pull request Jun 7, 2024 that will close this issue
@caryp
Copy link
Author

caryp commented Jun 7, 2024

@adamdecaf what do you think about this change?

@adamdecaf
Copy link
Member

Is this true for every usage of Time? Or just that one field?

@caryp
Copy link
Author

caryp commented Jun 10, 2024

This applies to all date fields that are not required. There are some date fields that are required though -- for example: Header Field 8 "Activity Date" is required. Perhaps that would be another improvement to fail if required date fields IsZero() is true?

@adamdecaf
Copy link
Member

I would like to error if required fields aren't set, but that could be done in Validate() rather than during formatting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants