Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a454258ebbf2bde9

Jump to content

Template talk:Timeline-event

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
Latest comment: 1 month ago by Yodin in topic Unspaced dash

Problem

[edit]

When |end_date= is used together with |date=, the template appears like so:

  • April 21, 2012 (2012-04-21) – November 18, 2012 (2012-11-18): Another thing happened

Is there any way one can code the template, so that a space appears both before and after the en dash for full dates only? So that if a year is inputted like so...

  • 2012–2013: Another thing happened

... There is no space before and after the dash. I tried copying Izkala's edit here with this edit, which I thought worked. But if one were to use |date= on its own...

  • {{Timeline-event |date={{Start date|2012|04|21}} |event= Something happened}}

... It appears like so:

  • April 21, 2012 – {{{end_date}}}: Something happened

I am not quite sure how to solve this.--Nevé–selbert 22:47, 9 September 2017 (UTC)Reply

The issue is that the {{#if:{{#invoke:String... is it's own if statement. In Izkala's diff you gave above, {{{end}}} was always used. Thus, I just added in an extra #if statement around the whole thing to check if |end_date= existed. Primefac (talk) 23:13, 9 September 2017 (UTC)Reply

Unspaced dash

[edit]

I don't quite understand the remarks above about an unspaced en dash for years only.

"{{Timeline-event|date={{Start date|1887}}|end_date={{End date|1888}}|location=Leipzig}}" produces

"1887 (1887)–1888 (1888): Leipzig". That en dash ought to be unspaced. -- Michael Bednarek (talk) 15:23, 11 February 2020 (UTC)Reply

Fixed There was code to check whether both |date= and |end_date= were both just years, and if so to use an unspaced en dash, but it didn't work with {{Start date}} and {{End date}} (which the documentation requires). This was because it assumed that year-only dates wouldn't contain any spaces, but these templates also emit hidden spans that contain spaces. I've changed it to look for the pattern [letter][non-breaking space][number], as year-only dates don't have that, while all {{Start date}} and {{End date}} dates that are more than just a year always do (the month name followed either by the year, or the day). --YodinT 16:48, 21 August 2026 (UTC)Reply

Optionally hide some values

[edit]

May want a switch to hide all but the |event= parameter value, esp as many editors prefer/in some contexts we need timelines in tabular form, or in structured lists (eg years as hd1, months as hd2, etc). Would allow us to have timeline metadata while still presenting timelines to readers in the most useful/preferred style for the given context. - Asdfjrjjj (talk) 07:18, 13 August 2026 (UTC)Reply