postgres row to column
As I said, simplify it using count(DISTINCT...)

SELECT county,
  date_s,
  count(DISTINCT date_mdy) AS unique_date_count
FROM air_quality2
GROUP BY county,
  date_s
ORDER BY 1,2;


Now wrap it in crosstab

SELECT *
FROM crosstab($$
    SELECT county,
      date_s::int,
      count(DISTINCT date_mdy) AS unique_date_count 
    FROM air_quality2
    GROUP BY county,
      date_s
    ORDER BY 1,2;
  $$,
  $$ SELECT DISTINCT county FROM air_quality2; $$
)
AS ct(
  year               int,
  "Bergen County"    int,
  "Essex County"     int,
  "Hunterdon County" int,
  "Middlesex County" int,
  "Monmouth County"  int,
  "Morris County"    int,
  "Union County"     int
);


Update


forgot to put the row_name year in the definition.
You may have to cast date_s to int
You may have to cast count(DISTINCT...) to int, (or bigint and change the types).
You will have to make sure you gave all the counties in your sample data. Or, paste the results of SELECT DISTINCT county FROM air_quality2;.