Difference between revisions of "Template:Version to date/doc"

From RimWorld Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ == Summary == This template converts the last part of the version number, which represents the number of days since one of the first builds of RimWorld, into the dat...")
 
(switch to template)
 
(3 intermediate revisions by the same user not shown)
Line 11: Line 11:
  
 
== Examples ==
 
== Examples ==
<pre>The (fictional) '''version 0.0.0''' would have been released on {{#time: M j, Y | {{Version to date|0.0.0}} }}.</pre>
+
<pre>The (fictional) '''version 0.0.0''' would have been released on {{#time: F j, Y | {{Version to date|0.0.0}} }}.</pre>
The (fictional) '''version 0.0.0''' would have been released on {{#time: M j, Y | {{Version to date|0.0.0}} }}.
+
The (fictional) '''version 0.0.0''' would have been released on {{#time: F j, Y | {{Version to date|0.0.0}} }}.
  
<pre>The current '''version {{:Version/Current_version}}''' has been released on {{#time: M j, Y | {{Version to date|{{:Version/Current_version}}}} }}.</pre>
+
<pre>The current '''version {{Current Version}}''' has been released on {{#time: F j, Y | {{Version to date|{{Current Version}} }} }}.</pre>
The current '''version {{:Version/Current_version}}''' has been released on {{#time: M j, Y | {{Version to date|{{:Version/Current_version}} }} }}.
+
The current '''version {{Current Version}}''' has been released on {{#time: F j, Y | {{Version to date|{{Current Version}} }} }}.
  
 
== Test cases ==
 
== Test cases ==
 
=== Specific versions ===
 
=== Specific versions ===
1.3.3069 was released on {{#time: M j, Y | {{#vardefineecho:testDate|2021-07-24}} }}. <code><nowiki>{{Version to date|1.3.3069}}</nowiki></code> returns {{#vardefineecho:testTemplate|{{Version to date|1.3.3069}} }} {{#ifeq: {{#var:testDate}} | {{#var:testTemplate}} | {{Check}} | {{Cross}} }}
+
<code><nowiki>{{Version to date|1.3.3069}}</nowiki></code> was released on {{#vardefineecho:testDate|2021-07-24}} and returns {{#vardefineecho:testTemplate|{{Version to date|1.3.3069}} }} {{#ifeq: {{#var:testDate}} | {{#var:testTemplate}} | {{Check}} | {{Cross}} }}
  
1.4.3530 was released on {{#time: M j, Y | {{#vardefineecho:testDate|2022-10-28}} }}. <code><nowiki>{{Version to date|1.4.3530}}</nowiki></code> returns {{#vardefineecho:testTemplate|{{Version to date|1.4.3530}} }} {{#ifeq: {{#var:testDate}} | {{#var:testTemplate}} | {{Check}} | {{Cross}} }}
+
<code><nowiki>{{Version to date|1.4.3530}}</nowiki></code> was released on {{#vardefineecho:testDate|2022-10-28}} and returns {{#vardefineecho:testTemplate|{{Version to date|1.4.3530}} }} {{#ifeq: {{#var:testDate}} | {{#var:testTemplate}} | {{Check}} | {{Cross}} }}
  
 
=== Special dates ===
 
=== Special dates ===
Line 39: Line 39:
 
<code><nowiki>{{Version to date|2589}}</nowiki></code> should result in {{#vardefineecho:testDate|2020-03-31}} and returns: {{#vardefineecho:testTemplate|{{Version to date|2589}} }} {{#ifeq: {{#var:testDate}} | {{#var:testTemplate}} | {{Check}} | {{Cross}} }}
 
<code><nowiki>{{Version to date|2589}}</nowiki></code> should result in {{#vardefineecho:testDate|2020-03-31}} and returns: {{#vardefineecho:testTemplate|{{Version to date|2589}} }} {{#ifeq: {{#var:testDate}} | {{#var:testTemplate}} | {{Check}} | {{Cross}} }}
  
<code><nowiki>{{Version to date|2560}}</nowiki></code> should result in {{#vardefineecho:testDate|2020-04-01}} and returns: {{#vardefineecho:testTemplate|{{Version to date|2560}} }} {{#ifeq: {{#var:testDate}} | {{#var:testTemplate}} | {{Check}} | {{Cross}} }}
+
<code><nowiki>{{Version to date|2590}}</nowiki></code> should result in {{#vardefineecho:testDate|2020-04-01}} and returns: {{#vardefineecho:testTemplate|{{Version to date|2590}} }} {{#ifeq: {{#var:testDate}} | {{#var:testTemplate}} | {{Check}} | {{Cross}} }}
  
 
==== Leap year to common year ====
 
==== Leap year to common year ====

Latest revision as of 18:16, 4 December 2023

Summary[edit]

This template converts the last part of the version number, which represents the number of days since one of the first builds of RimWorld, into the date of the release of that particular version.

This templates takes leap years until Feb 28, 2400 into account.

Usage[edit]

Simply add {{Version to date}} to any subpage with a name like "Version/<version number>" (e.g. Version/1.3.3069).

Alternatively you can simply add the the version number as the first parameter like {{Version to date|Version/1.3.3069}}, {{Version to date|1.3.3069}} or even {{Version to date|3069}}.

Examples[edit]

The (fictional) '''version 0.0.0''' would have been released on {{#time: F j, Y | {{Version to date|0.0.0}} }}.

The (fictional) version 0.0.0 would have been released on February 27, 2013.

The current '''version {{Current Version}}''' has been released on {{#time: F j, Y | {{Version to date|{{Current Version}} }} }}.

The current version 1.5.4241 has been released on October 8, 2024.

Test cases[edit]

Specific versions[edit]

{{Version to date|1.3.3069}} was released on 2021-07-24 and returns 2021-07-24 Check.png

{{Version to date|1.4.3530}} was released on 2022-10-28 and returns 2022-10-28 Check.png

Special dates[edit]

Common year to leap year[edit]

{{Version to date|2498}} should result in 2019-12-31 and returns: 2019-12-31 Check.png

{{Version to date|2499}} should result in 2020-01-01 and returns: 2020-01-01 Check.png

February to March in leap year[edit]

{{Version to date|2557}} should result in 2020-02-28 and returns: 2020-02-28 Check.png

{{Version to date|2558}} should result in 2020-02-29 and returns: 2020-02-29 Check.png

{{Version to date|2559}} should result in 2020-03-01 and returns: 2020-03-01 Check.png

March to April in leap year[edit]

{{Version to date|2589}} should result in 2020-03-31 and returns: 2020-03-31 Check.png

{{Version to date|2590}} should result in 2020-04-01 and returns: 2020-04-01 Check.png

Leap year to common year[edit]

{{Version to date|2864}} should result in 2020-12-31 and returns: 2020-12-31 Check.png

{{Version to date|2865}} should result in 2021-01-01 and returns: 2021-01-01 Check.png

February to March in common year[edit]

{{Version to date|2923}} should result in 2021-02-28 and returns: 2021-02-28 Check.png

{{Version to date|2924}} should result in 2021-03-01 and returns: 2021-03-01 Check.png

March to April in common year[edit]

{{Version to date|2954}} should result in 2021-03-31 and returns: 2021-03-31 Check.png

{{Version to date|2955}} should result in 2021-04-01 and returns: 2021-04-01 Check.png