Dev.to WebDev 🛠 Dev 👁 0 📖 3 min read

My form wrote a sentence that wasn't true, and the user would have signed it

I built a small page that writes appeal letters for UK private parking tickets. You answer a few questions, it produces a letter. I tested it the way I test most forms. Fill in good data, check the output looks right. E

I built a small page that writes appeal letters for UK private parking tickets. You answer a few questions, it produces a letter.

I tested it the way I test most forms. Fill in good data, check the output looks right. Every combination passed: three parts of the UK, keeper or driver, five grounds. No script errors.

Then I did the thing I should have done first. I picked a ground and typed in data that did not support it.

The ground

One of the five grounds is about a deadline. In England and Wales, if a private parking company posts you a ticket and nothing was left on the windscreen, the notice has to be delivered to the registered keeper within 14 days. It's in Schedule 4 of the Protection of Freedoms Act 2012, paragraph 9. People ask about it on forums all the time. Here is one thread where the notice took more than 30 days: https://www.ftla.uk/private-parking-tickets/late-notice-to-keeper-30-days-worth-appealing/

So the form asks for the date of parking and the date the notice arrived.

The bug

I entered a parking date and a received date 7 days apart. Under the field, the helper text did the right thing:

You received it 7 days after the parking date. This ground needs more than 14 days, so it may not apply.

And the letter, a few centimetres to the right, said this:

Your notice is dated 6 October 2026 and I received it on 6 October 2026, which is outside that period.

That sentence is false, and the page wrote it. The person using it is stressed, skims the preview, prints, signs.

The cause was boring. The helper text and the letter were built by two different functions. One compared the dates. The other just filled a template.

The fix

I did not make the letter clever. A letter that silently rewrites its own argument is hard to trust. The page now puts a warning above the letter, next to the count of unfilled fields:

const pd = $('parkDate').value, rd = $('receivedDate').value;
if (radio('ground') === 'keeper' && $('jurisdiction').value === 'EW'
    && pd && rd && daysBetween(pd, rd) <= 14) {
  add('', '<strong>Check your dates.</strong> This letter says the notice ' +
    'arrived more than 14 days after parking, but the dates you entered are ' +
    'within 14 days. Correct the dates or choose a different ground.');
}

The second one

While I was in there I found the letter's date came from this:

new Date().toISOString().slice(0, 10)

toISOString() is UTC. The UK is an hour ahead of UTC in summer. Between midnight and 1 am the letter would be dated yesterday. Not a disaster, but it is a dated legal letter, and the fix is three lines:

const localIso = d =>
  `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;

What I took from it

If a form generates text that a person will sign, test each option with inputs that contradict it. "Does it render" is not the test. "Can it say something untrue" is.

The page is here if you want to poke at it: https://mianazeemdaula.github.io/parking-appeal-letter/
Source: https://github.com/mianazeemdaula/parking-appeal-letter

I'm a developer, not a lawyer, and no solicitor has reviewed the wording. It was tested in headless Chrome only, not on real phones, Safari or Firefox.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.