DEV Community

anders lee
anders lee

Posted on

The car fee that changes every January 1: storing indexed fees with a year, not just a number

Most numbers in a car tax calculator change when a legislature votes. A few change on a schedule, every year, whether anyone votes or not. Pennsylvania has two of them on the same receipt, and they changed how I store fee data.

This post covers those two fees, the four fields I ended up keeping for each, and the checks that go with them. Every number below comes from PennDOT or the state dealer board, and each one sits in the data file next to its source URL.

Two fees on one Pennsylvania receipt

The road user charge (RUC). Under Acts 85 and 149 of 2024, battery-electric and plug-in hybrid vehicles in Pennsylvania pay an annual road user charge together with their registration. For 2026:

Vehicle 1 year 2 years
Battery-electric (EV) $250 $500
Plug-in hybrid (PHEV) $63 $126

From 2027 PennDOT adjusts it every January 1 by the consumer price index. The PHEV amount is 25% of the EV amount, rounded up to the next dollar: 25% of $250 is $62.50, so $63.

The dealer documentary fee cap. Pennsylvania limits what a dealer may charge for paperwork. The State Board of Vehicle Manufacturers, Dealers and Salespersons re-indexes the limit to CPI every year:

Year Electronic Non-electronic
2025 $477 $398
2026 $490 $409

Two fees, two different agencies, the same pattern: the number is only true for one calendar year.

A number alone is a bug waiting for January

The first version of my data had "ev": 250. Nothing about that line tells you it stops being correct on January 1, 2027. The page would keep showing $250 with full confidence, and the date on the page (when I last checked the source) would make it look more trustworthy, not less.

So each indexed fee now carries the year it applies to, separately from the date I checked it:

"roadUserCharge": {
  "year": 2026,
  "ev": 250,
  "evTwoYear": 500,
  "phev": 63,
  "phevTwoYear": 126,
  "asOf": "2026-11-05",
  "sources": ["https://www.pa.gov/agencies/dmv/vehicle-services/road-user-charge"]
}
Enter fullscreen mode Exit fullscreen mode
"docFee": {
  "cap": 490,
  "capOther": 409,
  "capYear": 2026,
  "asOf": "2026-11-05"
}
Enter fullscreen mode Exit fullscreen mode

asOf answers "when did someone last read the source?". year answers "for which period is this number the law?". They drift apart: in December 2026 a check on the 5th is still fresh, but the year is about to end.

Don't compute next year's number

It's tempting to store a formula: last year's fee times CPI. I don't, for three reasons:

  1. The agency picks the CPI series, the period and the rounding. Pennsylvania's dealer board publishes the new cap in an annual notice; your CPI guess and their number can differ by a dollar, and a dollar off on a legal cap is wrong.
  2. The base can change. A legislature can reset an indexed fee at any time, and the formula would keep running on the old base.
  3. The published number is what a buyer sees at the counter. If my estimate disagrees with the receipt, the receipt wins.

So next year's value is data I copy from the published notice, not a value I derive. The code only knows how to show it.

Derived values: store them, then test the rule

The PHEV charge is defined by a rule (25% of the EV charge, rounded up). I still store it as data, because the official page lists it, and I'd rather a data test catch a mismatch than have the code silently disagree with PennDOT:

test("PA PHEV road user charge is 25% of EV, rounded up; two-year amounts are double", () => {
  const ruc = PA.registration.roadUserCharge;
  assert.equal(ruc.phev, Math.ceil(ruc.ev * 0.25));
  assert.equal(ruc.evTwoYear, ruc.ev * 2);
  assert.equal(ruc.phevTwoYear, ruc.phev * 2);
});
Enter fullscreen mode Exit fullscreen mode

When the 2027 amounts arrive, typing them in is one edit, and this test tells me if I copied one of the four wrong.

Put the year in the label

The calculator line for an EV reads "Road user charge, electric vehicle (2026, 1 year)". Two reasons:

  • A buyer reading the estimate in January sees immediately which year it was built for.
  • "1 year" matters because Pennsylvania also sells two-year registrations, and the estimate shows the one-year registration fee. Mixing a one-year registration with a two-year charge would be internally inconsistent.

The code is small:

const ruc = reg.roadUserCharge;
if (i.ev || i.phev) {
  const what = i.ev ? "electric vehicle" : "plug-in hybrid";
  const label = i.plateTransfer
    ? `Road user charge, ${what} (none if the plate comes from another EV/PHEV)`
    : `Road user charge, ${what} (${ruc.year}, 1 year)`;
  lines.push({ key: "ev", label, amount: i.ev ? ruc.ev : ruc.phev });
}
Enter fullscreen mode Exit fullscreen mode

The plate-transfer branch is the other lesson from this fee. In Pennsylvania the plate belongs to the owner, not the car. If you move your plate from one EV or PHEV to another, the RUC balance moves with it for the same registration period. The calculator can't know what car your old plate was on, so it keeps the charge in the total and says in the label when it would be zero. An estimate that admits what it can't see beats one that guesses.

A cap, a threshold and "no cap" are three different fields

Once doc fees had a capYear, I looked at how the other states in the calculator handle them. "Max doc fee" turned out to mean different things:

State Rule Field
Pennsylvania Hard cap, re-indexed yearly: $490 / $409 (2026) cap, capOther, capYear
New York Hard cap: $175 for handling registration and title paperwork cap
Texas No flat cap. On financed sales a dealer may charge up to $225 without a filing; above that it must file a notice and cost analysis with the Office of Consumer Credit Commissioner first cap: null, threshold: 225
Florida No dollar cap; the fee must carry a printed disclosure cap: null

A Texas cap: 225 would be wrong: a dealer can charge more after filing. A Florida cap: 0 would be wrong too. null plus a separate threshold keeps the meaning.

Whether the fee is taxed is yet another field, and it doesn't follow from the cap. Pennsylvania's fee is not taxable. New York and Texas don't tax a separately stated fee. Florida treats discretionary dealer charges as part of the taxable price. So in the calculator, the doc fee is added to the taxable amount in Florida and stays outside it in the other three.

A reminder that runs itself

The last piece is boring and the most useful: every field with a year is a date on which the data expires. A build step can compare it with the current year and warn:

const thisYear = new Date().getFullYear();
for (const [st, d] of Object.entries(states)) {
  const ruc = d.registration?.roadUserCharge;
  if (ruc && ruc.year < thisYear) console.warn(`${st}: road user charge is for ${ruc.year}`);
  if (d.docFee?.capYear && d.docFee.capYear < thisYear) console.warn(`${st}: doc fee cap is for ${d.docFee.capYear}`);
}
Enter fullscreen mode Exit fullscreen mode

It doesn't fix anything. It just makes sure the first build in January says out loud that two numbers are now from last year.

Takeaways

  1. Store the period a fee applies to (year) separately from when you checked it (asOf).
  2. Copy indexed values from the official notice; don't project them with your own CPI math.
  3. Keep derived values as data and test the rule that links them.
  4. Put the year in the user-facing label of any fee that changes on a schedule.
  5. Model "cap", "threshold" and "no cap" as different fields, and taxability as its own field.

The Pennsylvania fees, with the road user charge and doc fee cap applied, are on the Pennsylvania registration fees page of carsalestax.com.

Top comments (0)