Removed an unused local var
Removed a ton of unused local vars
Hardened the test introduced in ded11aa6. Refs #18766.

Inputs acceptable to time.mktime are platform-dependent.
Further hardening. Refs #18766.
Removed some more unused local vars
Fix #20745: Don't silence TypeError raised inside templates.

Thanks to robin for the report and claudep for the review.