Difference between revisions of "Template:SetDatePropertyValueFromDateString"

From Encyclopedia of Scientonomy
Jump to navigation Jump to search
Line 19: Line 19:
 
  --><!-- set individual values and build the overall date string
 
  --><!-- set individual values and build the overall date string
 
  -->|{{#if: {{{datestring|}}}<!--
 
  -->|{{#if: {{{datestring|}}}<!--
   --><!--
+
   --><!-- nullify all the variables since they might be defined by the previous call of this function
   --><!-- check if BC this is a BC year
+
  -->{{#vardefine: varYear|}}<!--
 +
  -->{{#vardefine: varMonth|}}<!--
 +
  -->{{#vardefine: varDay|}}<!--
 +
   --><!--  
 
   -->|{{#vardefine: varSlash1|{{#pos:{{{datestring|}}}|/}}|}}<!-- search for the first occurrence of slash
 
   -->|{{#vardefine: varSlash1|{{#pos:{{{datestring|}}}|/}}|}}<!-- search for the first occurrence of slash
 
     -->{{#switch: {{#var: varSlash1}}<!--
 
     -->{{#switch: {{#var: varSlash1}}<!--

Revision as of 09:48, 24 August 2016

This template takes a date string in yyyy/mm/dd format and stores it as a complex date property value using Template:SetDatePropertyValue. This whole headache is necessary to support incomplete date values with BC support.

The template will store up to four values:

  • {{{property|}}} - the combined date.
  • {{{property|}}} Year - the year part.
  • {{{property|}}} Month - the month part.
  • {{{property|}}} Day - the day part.

NOTE: As any "set" template, it doesn't print anything on the page, but merely sets the appropriate values.

Parameters:

  • |property= - the name of the property.
  • |datestring= - the date value in yyyy/mm/dd format. The month and day are optional. YYYY BC and YYYY BCE formats are allowed for BC years.