Template talk:Duration

to do
Further work is needed:


 * if h is present and m less than 10, add leading zero to m
 * if h is present and m = "0", display m as "00"
 * if h or m is present and s less than 10, add leading zero to s
 * if h or m is present and s = "0", display s as "00"
 * validation - throw an error message if :
 * (not done: style guide for albums says to use, say, 74:32 not 1:14:32)
 * values non-numeric
 * values other than s are not whole numbers (or allow decimal h & m values?)
 * shorter template name? ( is taken :-
 * shorter template name? ( is taken :-

Can you help? Andy Mabbett (User: Pigsonthewing ); Andy's talk; Andy's edits 19:27, 8 August 2010 (UTC)
 * Perhaps ask @ Wikipedia_talk:WikiProject_Templates? --Cyber cobra (talk) 20:10, 8 August 2010 (UTC)
 * Thank you. That seemed to work ;-) Andy Mabbett (User: Pigsonthewing ); Andy's talk; Andy's edits 00:55, 9 August 2010 (UTC)
 * I have done the rest of what you requested above (except the shorter name, there I cannot help you). Intelligent  sium  01:52, 10 August 2010 (UTC)
 * Thank you. Andy Mabbett (User: Pigsonthewing ); Andy's talk; Andy's edits 11:25, 10 August 2010 (UTC)

Formatting issues
For some reason, all the occurrences of "duration" now have a message saying: "‹The template Duration is being considered for possible deletion.›"

That leads to the following layout issues in the track listing template: example. As you can see, in the "length" column, this sentence is added before the track length, making each row 9 lines tall, instead of just one line.

Can somebody please fix this and make sure the notice of consideration does not get displayed where it shouldn't? Thank you. --Eddyspeeder (talk) 07:50, 7 March 2013 (UTC)

Additional formats
We could do with adding a switch or switches, such that, say:


 * renders as: 1hr 22min 34sec
 * renders as: 1hr 22min 00sec
 * renders as: 1:02
 * renders as: 1hr 02min
 * renders as: 22min 34sec

Thoughts? Should we implement Lua at the same time? Can someone help, please? Andy Mabbett ( Pigsonthewing ); Talk to Andy; Andy's edits 23:55, 20 March 2013 (UTC)

Requested move 3 May 2020

 * The following is a closed discussion of a requested move. Please do not modify it. Subsequent comments should be made in a new section on the talk page. Editors desiring to contest the closing decision should consider a move review after discussing it on the closer's talk page. No further edits should be made to this discussion. 

The result of the move request was: moved (closed by non-admin page mover) DannyS712 (talk) 06:23, 11 May 2020 (UTC)

– Match name with template * Pppery * it has begun... 03:40, 3 May 2020 (UTC)
 * Module:Hms → Module:Duration
 * Support per WP:CONSISTENT, although strictly that only applies to article titles. In the absence of Template:Hms, this could also be confused with being a module for Template:HMS. 62.165.227.49 (talk) 04:54, 3 May 2020 (UTC)


 * The discussion above is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.

Follow up edit
Please change the error message in module line 4: "Error in Module:Hms:" &rarr; "Error in Module:Duration:". -DePiep (talk) 14:04, 11 May 2020 (UTC)
 * ✅ * Pppery * it has begun... 14:06, 11 May 2020 (UTC)

Use of template
Should this template only be used in Template:Infobox album and Template:Infobox song? The documentation states so, but in my years on Wikipedia I've come across quite a few uses in Template:Track listing, which I have removed per what the template explains microformats are for. It seems that there are some editors on Wikipedia who believe any instance of a duration should be formatted using this template and my understanding of what the documentation states is that is not what it's for. Ping as the creator of this template to clarify.  Ss  112   13:09, 30 September 2022 (UTC)


 * Your understanding is broadly correct, albeit and  are not the only templates where this one may be used.  Andy Mabbett ( Pigsonthewing ); Talk to Andy; Andy's edits 11:55, 2 October 2022 (UTC)
 * Is it considered a misuse of this template if it's used to format durations in Template:Track listing? Does it even have a use in track listings?  Ss  112   12:44, 2 October 2022 (UTC)
 * I'm not familiar with the current state of, but it has no microformat markup, so is not needed for that purpose It may be desirable for its standardised formatting.  Andy Mabbett ( Pigsonthewing ); Talk to Andy; Andy's edits 20:31, 3 October 2022 (UTC)