How to typeset a date range properly

As I write this we in the UK are reaching the culmination of 10 days of mourning following the death of the Queen. Wherever you look – on websites and billboards, in bus stops and shop windows – we are reminded of the longevity of Her Majesty’s life. More specifically we’re presented with a date range: 1926 – 2022.

A badly typeset date range, usually comprising a hyphen surrounded by two spaces. “What’s wrong with that?,” you might well ask. A lack of attention to detail for a start. There is a long-standing convention for how to properly typeset a date range, or any numerical range for that matter, but it involves going a bit deeper than what faces us on our laptop keyboards (which are still relics from the age of typewriters).
Even the Royals’ own website makes the same mistake:

The preferred way is to use an en-dash instead of a hyphen, and separate it from the numerals with a thin-space, like this:
1926 – 2022
Compare with the poorly typeset:
1926 - 2022
The point here is that the date range is a self-contained element, an individual thought if you like, not two loosely connected items. Using a tightly spaced dash joins the numerals together into a single element.
Any typographically configured CMS should automatically convert your number-space-hyphen-space-number combination for you, swapping in thin spaces and en-dash. If you need to manually insert the desired characters, the easiest way for you right now is to cut and paste straight out of this page – they are standard Unicode glyphs.
I also use a handy Unicode character finder for these purposes. There’s a few around, but my favourite is Glyphfinder for MacOS. (The Glyphfinder website was down for me at the time of writing, but you can get the download from Gumroad for the price of a pint).