Difference between revisions of "Template:Deadline"

From BlogNomic Wiki
Jump to navigation Jump to search
(add an "off" option)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<span {{#ifexpr:{{#time: U | now }}>{{#time: U|{{{1|}}}}}| style="font-weight:bold; color:red"}}>{{{1|}}}</span><noinclude>
+
<span {{#if: {{{off|}}}||{{#ifexpr:{{#time: U | now }}>{{#time: U|{{{1|}}}}}| style="font-weight:bold; color:red"}}}}>{{{1|}}}</span><noinclude>
 
==Usage==
 
==Usage==
  
 
Wrapping this template around a timestamp or datestamp will cause the date to be bolded and highlighted in red if that time is not in the future.
 
Wrapping this template around a timestamp or datestamp will cause the date to be bolded and highlighted in red if that time is not in the future.
  
This template was created as a test in August 2024 - in practice it may not update itself frequently enough to be reliable, although in use cases where the deadline only applies to wiki gamestate actions, it may still work usefully as an immediately retrospective alert. (If you take a move but doing so causes a deadline date to become red, that may be a sign that your move forgot to bear this deadline in mind.)
+
This template was created as a test in August 2024 - in practice it may not update itself frequently enough to be reliable, although in use cases where the deadline only applies to wiki gamestate actions, it may still work usefully as an immediately retrospective alert. (If you take a move but doing so causes a deadline date to become red, that may be a sign that your move forgot to bear this deadline in mind.) ''Update:'' It looks like the sidebar embed of a gamestate page is displaying and updating this live, with only the wiki page itself being cached.
  
 
Examples:
 
Examples:
Line 17: Line 17:
 
*<code><nowiki>{{deadline|October 1}}</nowiki></code> displays as {{deadline|October 1}}
 
*<code><nowiki>{{deadline|October 1}}</nowiki></code> displays as {{deadline|October 1}}
 
*<code><nowiki>{{deadline|December 31}}</nowiki></code> displays as {{deadline|December 31}}
 
*<code><nowiki>{{deadline|December 31}}</nowiki></code> displays as {{deadline|December 31}}
 +
 +
You can manually switch the template off using <code>off=1</code>, in cases where it seems worth disabling the template after the dynasty has ended, rather than removing it and suggesting that it was never used.
 +
*<code><nowiki>{{deadline|2003-01-13|off=1}}</nowiki></code> displays as {{deadline|2003-01-13|off=1}}
  
 
[[Category:Display templates]]
 
[[Category:Display templates]]
 
</noinclude>
 
</noinclude>

Latest revision as of 15:01, 10 September 2024

Usage

Wrapping this template around a timestamp or datestamp will cause the date to be bolded and highlighted in red if that time is not in the future.

This template was created as a test in August 2024 - in practice it may not update itself frequently enough to be reliable, although in use cases where the deadline only applies to wiki gamestate actions, it may still work usefully as an immediately retrospective alert. (If you take a move but doing so causes a deadline date to become red, that may be a sign that your move forgot to bear this deadline in mind.) Update: It looks like the sidebar embed of a gamestate page is displaying and updating this live, with only the wiki page itself being cached.

Examples:

  • {{deadline|2024-08-23 10:12}} displays as 2024-08-23 10:12
  • {{deadline|1 January 2024}} displays as 1 January 2024
  • {{deadline|12:00, 2040-01-01}} displays as 12:00, 2040-01-01
  • {{deadline|31 December 2099}} displays as 31 December 2099

Less specific dates will also work, assuming the current year (with the outputs being correct when this documentation page was last refreshed on 2024-11-14):-

  • {{deadline|January 1}} displays as January 1
  • {{deadline|June 1}} displays as June 1
  • {{deadline|October 1}} displays as October 1
  • {{deadline|December 31}} displays as December 31

You can manually switch the template off using off=1, in cases where it seems worth disabling the template after the dynasty has ended, rather than removing it and suggesting that it was never used.

  • {{deadline|2003-01-13|off=1}} displays as 2003-01-13