wlpotter / csv-to-srophe

A set of XQuery modules for converting CSV data to Srophe-compliant TEI XML records. Developed for Syriaca.org
GNU General Public License v3.0
1 stars 1 forks source link

Need to handle enforcing proper ISO date format within the script #33

Closed wlpotter closed 3 years ago

wlpotter commented 3 years ago

@dlschwartz FYI. It looks like even if we add dates correctly in a Google sheet, turning them into CSV causes the cell to be treated as a number and leading zeroes get stripped out.

See, for example, person 3226 (row 41 of the Google sheet). Compare the Google sheet to the CSV input for that row. It outputs incorrectly formatted years: https://github.com/wlpotter/csv-to-srophe/blob/main/out/persons/2021-11-17/3226.xml#L113

This doesn't seem to affect fuller dates (e.g., of the form YYYY-MM-DD) because those are treated as strings/text, not as numbers. See, for example person 3229 (row 44 of the Google sheet). The CSV input keeps the correct format, and this is how it is output: https://github.com/wlpotter/csv-to-srophe/blob/main/out/persons/2021-11-17/3229.xml#L116

We can still have an error raised if the script can't convert the date (cf. #27), but for just years (YYYY), we should have the script add leading zeroes as needed. This is relatively simple to implement.