Skip to content

libfec outputs raw YYYYMMDD, FastFEC outputs YYYY-MM-DD #12

Description

@asg017

Note

Much of this ticket was composed with Claude

Description

libfec's fastfec subcommand passes date values through as raw FEC format (YYYYMMDD), while FastFEC converts them to ISO 8601 format (YYYY-MM-DD). This affects every filing and every form type that contains date fields (coverage dates, contribution dates, disbursement dates, etc.).

Note: FastFEC's date conversion is itself inconsistent - it fails to convert dates on H3 and H4 form types, leaving those as raw YYYYMMDD.

Affected Filing

Filing ID: 1935668 (237KB, Chevron PAC F3XN filing)

Reproduction

libfec fastfec ~/.cache/libfec/cache/1935668.fec /tmp/out_libfec
fastfec --no-stdin ~/.cache/libfec/cache/1935668.fec /tmp/out_fastfec

Observe the Difference

# Cover record date fields:
diff \
  <(sed -n '2p' /tmp/out_libfec/1935668/F3XN.csv | tr ',' '\n' | sed -n '14,15p') \
  <(sed -n '2p' /tmp/out_fastfec/1935668/F3XN.csv | tr ',' '\n' | sed -n '14,15p')
# < 20251201
# < 20251231
# ---
# > 2025-12-01
# > 2025-12-31

# Itemization date fields:
diff \
  <(awk -F, '{print $20}' /tmp/out_libfec/1935668/SA11AI.csv | head -5) \
  <(awk -F, '{print $20}' /tmp/out_fastfec/1935668/SA11AI.csv | head -5)
# < 20251205
# ---
# > 2025-12-05

# Show FastFEC's own inconsistency on H3/H4 (filing 1942420):
libfec fastfec ~/.cache/libfec/cache/1942420.fec /tmp/out_libfec_2
fastfec --no-stdin ~/.cache/libfec/cache/1942420.fec /tmp/out_fastfec_2
awk -F, '{print $8}' /tmp/out_fastfec_2/1942420/H3.csv
# date_of_receipt
# 20251219   <-- FastFEC left this unconverted!
awk -F, '{print $20}' /tmp/out_fastfec_2/1942420/SA11AI.csv | head -2
# contribution_date
# 2025-12-13  <-- But converted this one

Decision

If the goal is exact FastFEC compatibility, add date conversion (YYYYMMDD -> YYYY-MM-DD) in the fastfec writer for all form types. The try_format_fec_date() function already exists in fec-parser/src/lib.rs but is only used by the SQLite export path.

If the goal is correctness over compatibility, raw passthrough is arguably more faithful to the source data.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions