Open caryp opened 5 months ago
Not sure how to assign to myself, but I am happy to submit a proposed change for this.
@adamdecaf what do you think about this change?
Is this true for every usage of Time? Or just that one field?
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?
I would like to error if required fields aren't set, but that could be done in Validate() rather than during formatting.
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.