Skip to content

runners/datetime: add conversion between time zones

Extend the DateTime runner to allow for conversion of a given time between two given time zones.


source time zone, input time, target time zone



optional time zone arguments: default to system time zone to convert between remote and local


optional date argument: default to today, otherwise specify date to make it possible to account for DST

I'm not entirely sure about the syntax. Since the runner already has the syntax time <to-timzone>, my thinking was that the most predicable would be if the time zone to display the time in is likewise positioned after the time, and then the time zone on which the input time is based positioned before the time, i.e.

<from-timzone> <time> <to-timezone>

But maybe it would better to have a syntax like

<time> <from-timezone> in <to-timezone>

like in the unit conversion runner? I don't have a strong opinion on this.

This change also includes some modifications to how the results are added and displayed:

  • Results are given a relevance based on the match overlap length so that e.g. with query "gmt+1", "GMT+14" wouldn't be higher up than "GMT+1"
  • More time zone formats are sourced to match the query: find zones by short name or offset name
  • Long lines will be wrapped rather than elided
  • Times are displayed without the full date and instead with a label "+1 d"/"-1 d" if applicable for quicker readability
Edited by Natalie Clarius

Merge request reports