Difference between revisions of "Template:SetDatePropertyValue"

From Encyclopedia of Scientonomy
Jump to navigation Jump to search
(Created page with "<noinclude> This template is used to set a value of type date given the year, month, and day. Month and day are optional parameters. The template will also store all the parts...")
 
 
(50 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
This template is used to set a value of type date given the year, month, and day. Month and day are optional parameters. The template will also store all the parts individually to keep track of which parts of the date are '''incomplete'''.
 
This template is used to set a value of type date given the year, month, and day. Month and day are optional parameters. The template will also store all the parts individually to keep track of which parts of the date are '''incomplete'''.
  
'''NOTE:''' As any "set" template, it doesn't print anything on the page, but merely sets the appropriate values.  
+
The template will store up to four values:
 +
* <code><nowiki>{{{property|}}}</nowiki></code> - the combined date.
 +
* <code><nowiki>{{{property|}}} Era</nowiki></code> - BCE or CE; default is CE.
 +
* <code><nowiki>{{{property|}}} Year</nowiki></code> - the year part.
 +
* <code><nowiki>{{{property|}}} Month</nowiki></code> - the month part.
 +
* <code><nowiki>{{{property|}}} Day</nowiki></code> - the day part.
 +
* <code><nowiki>{{{property|}}} Approximate</nowiki></code> - if ''Yes'', the date is approximate; the default is ''No''.
 +
 
 +
'''NOTE:''' As any "set" template, it doesn't print anything on the page, but merely sets the appropriate values.
  
 
'''Parameters:'''
 
'''Parameters:'''
 
* <code><nowiki>|property=</nowiki></code> - the name of the property.
 
* <code><nowiki>|property=</nowiki></code> - the name of the property.
* <code><nowiki>|year=</nowiki></code> - the year.
+
* <code><nowiki>|era=</nowiki></code> - the era: BCE or CE. The default is CE.
 +
* <code><nowiki>|year=</nowiki></code> - the year; mandatory.
 
* <code><nowiki>|month=</nowiki></code> - the month.
 
* <code><nowiki>|month=</nowiki></code> - the month.
 
* <code><nowiki>|day=</nowiki></code> - the day.
 
* <code><nowiki>|day=</nowiki></code> - the day.
 +
* <code><nowiki>|approximate=</nowiki></code> - if ''Yes'', the date will be considered approximate (circa); this value is not passed to SMW, since the latter doesn't support approximate dates, but will be useful when printing dates (e.g. ''circa. 480 BC'').
  
</noinclude>
+
</noinclude><includeonly><!--
<includeonly><!--
 
 
-->{{#if: {{{property|}}}<!--
 
-->{{#if: {{{property|}}}<!--
 
  --><!-- set individual values and build the overall date string
 
  --><!-- set individual values and build the overall date string
  -->{{#if: {{{year|}}}
+
  -->|{{#if: {{{year|}}}<!-- if there is no year,
  -->|{{#set: {{{property|}}} Year={{{year|}}}|}}<!--  
+
  --><!--
  -->{{#if: {{{month|}}}<!--
+
  -->|{{#if: {{{month|}}}<!--
    -->|{{#set: {{{property|}}} Month={{{month|}}}|}}<!--  
+
    -->|{{#if: {{{day|}}}<!--
    -->{{#vardefine: varDate|{{{year|}}}}}<!--
+
      -->|{{#set: {{{property|}}} Year={{#time:Y|{{{day|}}} {{{month|}}} {{{year|}}} }}|}}<!-- store year
    -->{{#if: {{{day|}}}<!--
+
      -->{{#set: {{{property|}}} Month={{#time:F|{{{day|}}} {{{month|}}} {{{year|}}} }}|}}<!-- store month
       -->|{{#set: {{{property|}}} Day={{{day|}}}|}}<!--
+
      -->{{#set: {{{property|}}} Day={{#time:j|{{{day|}}} {{{month|}}} {{{year|}}} }}|}}<!-- store day
       -->{{#vardefine: varDate|{{{day|}}} {{{month|}}} {{{year|}}}}}<!-- all components are present 
+
      -->{{#set: {{{property|}}}={{#time:j F Y|{{{day|}}} {{{month|}}} {{{year|}}} }} {{#ifeq: {{{era|CE}}}|BCE|BCE|}} |}}<!-- all components are given
      -->|{{#vardefine: varDate|{{{month|}}} {{{year|}}}}}<!-- only month and year are present
+
       -->|{{#set: {{{property|}}} Year={{#time:Y|28 {{{month|}}} {{{year|}}} }}|}}<!-- store year
     -->}}<!--
+
       -->{{#set: {{{property|}}} Month={{#time:F|28 {{{month|}}} {{{year|}}} }}|}}<!-- store month
     -->|{{#vardefine: varDate|{{{year|}}}}}<!-- only year is present 
+
      -->{{#set: {{{property|}}}={{#time:F Y|28 {{{month|}}} {{{year|}}} }} {{#ifeq: {{{era|CE}}}|BCE|BCE|}} |}}<!-- only month and year are given
 +
     -->}}<!-- if day
 +
     -->|{{#set: {{{property|}}} Year={{#time:Y|{{{year|}}} }}|}}<!-- store year
 +
    -->{{#set: {{{property|}}}={{#time:Y|{{{year|}}}}} {{#ifeq: {{{era|CE}}}|BCE|BCE|}} |}}<!-- only year is given
 
   -->}}<!-- if month
 
   -->}}<!-- if month
 
   --><!--
 
   --><!--
   --><!--set the overall date
+
   -->{{#set: {{{property|}}} Era={{{era|CE}}}|}}<!-- set the era; CE is default
   -->{{#set: {{{property|}}}={{#var: varDate}}|}}<!--  
+
   -->{{#set: {{{property|}}} Approximate={{{approximate|No}}}|}}<!-- set approximate; No is default
-->}}<!-- if year
+
  --><!--
 +
  -->}}<!-- if year
 
-->}}<!-- if property
 
-->}}<!-- if property
 
--></includeonly>
 
--></includeonly>

Latest revision as of 01:36, 26 August 2016

This template is used to set a value of type date given the year, month, and day. Month and day are optional parameters. The template will also store all the parts individually to keep track of which parts of the date are incomplete.

The template will store up to four values:

  • {{{property|}}} - the combined date.
  • {{{property|}}} Era - BCE or CE; default is CE.
  • {{{property|}}} Year - the year part.
  • {{{property|}}} Month - the month part.
  • {{{property|}}} Day - the day part.
  • {{{property|}}} Approximate - if Yes, the date is approximate; the default is No.

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.
  • |era= - the era: BCE or CE. The default is CE.
  • |year= - the year; mandatory.
  • |month= - the month.
  • |day= - the day.
  • |approximate= - if Yes, the date will be considered approximate (circa); this value is not passed to SMW, since the latter doesn't support approximate dates, but will be useful when printing dates (e.g. circa. 480 BC).