Difference between revisions of "Template:PrettyDate"

From DAS Wiki
Line 3: Line 3:
 
</noinclude>
 
</noinclude>
 
<includeonly>
 
<includeonly>
{{#ifeq:{{#len:{{{value}}}}}|4|{{#time:Y|{{{value}}}}}| <!-- 4 digits long must mean year only -->
+
{{#ifeq:{{#len:{{{value}}}}}|4
  {{#ifeq:{{{precision}}}|2|{{#time:F Y|{{{value}}}}}| <!--precision of 2 means Month and Year -->
+
        |{{#time:Y|{{{value}}}}} <!-- 4 digits long must mean year only -->
    {{#time:F j, Y|{{{value}}}}}  <!-- or full date -->
+
        |{{#ifeq:{{{precision}}}|2
  }}<!--end of if-->
+
                |{{#time:F Y|{{{value}}}}}  <!--precision of 2 means Month and Year -->
 +
                    |{{#time:F j, Y|{{{value}}}}}  <!-- or full date -->
 +
          }}<!--end of ifeq-->
 
}}<!--end of ifeq-->
 
}}<!--end of ifeq-->
 
</includeonly>
 
</includeonly>

Revision as of 23:36, May 12, 2021

This is the PrettyDate template. It converts various date records from a 2021-2-1 format to a February 1, 2021 format.