Difference between revisions of "Template:IfSaturday"

From Geohashing
(add tests)
m (Examples)
Line 1: Line 1:
<includeonly>{{#ifexpr:{{#time:N| {{{date|{{CURRENTTIMESTAMP}}}}}}}=6|{{{1}}}|{{{2}}}}}</includeonly><noinclude>
+
<includeonly>{{#ifexpr:{{#time:N|{{{date|{{CURRENTTIMESTAMP}}}}}}}=6|{{{1}}}|{{{2}}}}}</includeonly><noinclude>
 
Based on the <code>date</code> argument (or the current date if not specified), returns argument 1 if it is saturday, argument 2 otherwise.
 
Based on the <code>date</code> argument (or the current date if not specified), returns argument 1 if it is saturday, argument 2 otherwise.
  
 
<code>&#123;{IsSaturday|y|n}}</code> &rarr; {{IsSaturday|y|n|date=2020-03-06}} (as of this writing)<br>
 
<code>&#123;{IsSaturday|y|n}}</code> &rarr; {{IsSaturday|y|n|date=2020-03-06}} (as of this writing)<br>
 
<code>&#123;{IsSaturday|y|n|date=2020-03-06}}</code> &rarr; {{IsSaturday|y|n|date=2020-03-06}} <br>
 
<code>&#123;{IsSaturday|y|n|date=2020-03-06}}</code> &rarr; {{IsSaturday|y|n|date=2020-03-06}} <br>
<code>&#123;{IsSaturday|y|n|date=2020-03-07}}</code> &rarr; {{IsSaturday|y|n|date=2020-03-07}}
+
<code>&#123;{IsSaturday|y|n|date=2020-03-07}}</code> &rarr; {{IsSaturday|y|n|date=2020-03-07}} <br>
 +
<code>&#123;{IsSaturday|y|n|date=aspoidmapi}}</code> &rarr; {{IsSaturday|y|n|date=aspoidmapi}}
 
</noinclude>
 
</noinclude>

Revision as of 20:46, 6 March 2020

Based on the date argument (or the current date if not specified), returns argument 1 if it is saturday, argument 2 otherwise.

{{IsSaturday|y|n}} → n (as of this writing)
{{IsSaturday|y|n|date=2020-03-06}} → n
{{IsSaturday|y|n|date=2020-03-07}} → y
{{IsSaturday|y|n|date=aspoidmapi}}Expression error: Unexpected < operator.