date-column-audit v1.0.0
date-column-audit
Crystal command line tool and library. It reads a CSV with its own small parser (double quotes, "" escapes, line breaks inside quoted cells) and inspects one column that you name with --column (required; the header match ignores spaces around the name and letter case; an unknown column stops the run and lists the headers). Every non-empty value, after trimming, gets exactly one class: "yyyy-mm-dd" (a real calendar date, leap years respected), "yyyy-mm-dd impossible" (right shape but not a real date such as 2026-02-30, or a date-time with an impossible time such as 25:00), "yyyy-mm-dd HH:mm[:ss]" (a real date, a space, a valid time), "day first" (a/b/yyyy with / . or - as the same separator twice, a over 12, b from 1 to 12, a real date), "month first" (b over 12, a from 1 to 12, a real date), "ambiguous day/month" (a and b both from 1 to 12), "impossible day/month" (any other a/b/yyyy shape that is not a real date, such as 31/04/2026) and "other text". The output has the records read, the empty cells, a count and a share (of the non-empty cells, 1 decimal) per class with the first 3 examples as record numbers and values, and verdict lines. "Mixed formats" means more than one of yyyy-mm-dd, date-time, day first and month first is present. It does NOT decide whether an ambiguous value is day first or month first, it does not read time zones and it never reads the clock or opens any URL; it only checks the shape of the text you give it. The exit code is 0 when the column has no impossible, ambiguous or other-text value and no mixed formats, 1 when any of those exists, and 2 when the file cannot be read, the column is unknown, --column is missing, an option is unknown, the file is empty or it has a header and no rows.
Part of the OneGTMLab free GTM tools. Background on the idea: ZeroBounce.
Install
shards build # then ./bin/date-column-audit
Use
Input: any CSV with a header row plus --column NAME (or --column=NAME). Record numbers count data rows only, so the first row after the header is record 1. A data row with a different number of cells than the header stops the run and names the record. In the example the file has 13 records; record 11 has an empty cell, record 12 is a quoted cell with a comma and record 13 is a quoted cell with a line break. The cmd below also prints the exit code (1 here, because the sample holds impossible, ambiguous and other-text values and mixed formats).
$ bin/date-column-audit sample.csv --column signup_date; echo "exit code: $?"
column: signup_date
records read: 13
empty cells: 1
non-empty cells: 12
class count share first examples
yyyy-mm-dd 4 33.3% record 1: "2026-01-05"; record 2: "2026-01-17"; record 12: "2024-02-29"
yyyy-mm-dd impossible 1 8.3% record 3: "2026-02-30"
yyyy-mm-dd HH:mm[:ss] 2 16.7% record 4: "2026-03-02 09:15"; record 5: "2026-03-04 18:40:05"
day first 1 8.3% record 6: "25/03/2026"
month first 1 8.3% record 7: "03/25/2026"
ambiguous day/month 1 8.3% record 8: "04/05/2026"
impossible day/month 1 8.3% record 9: "31/04/2026"
other text 1 8.3% record 10: "soon"
verdict
mixed formats: yes (yyyy-mm-dd, yyyy-mm-dd HH:mm[:ss], day first, month first)
impossible values: 2
ambiguous day/month values: 1
other text values: 1
result: problems found (exit code 1)
exit code: 1
Test
crystal spec
Offline, no network calls, no dependencies beyond the language runtime. MIT licensed.
date-column-audit
- 0
- 0
- 0
- 0
- 0
- about 19 hours ago
- November 29, 2026
MIT License
Sun, 29 Nov 2026 07:26:28 GMT