Open main menu

Changes

no edit summary
* <code><nowiki>|property=</nowiki></code> - the name of the property.
* <code><nowiki>|datestring=</nowiki></code> - 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.'''
* <code><nowiki>|reporterror=</nowiki></code> - if given, an error message will be printed if no date is found in datestring.
</noinclude><includeonly><!--
-->{{#if: {{{property|}}}<!--
--><!-- set individual values and build the overall date string
-->|{{#if: {{{datestring|}}}<!--
--><!-- nullify all the variables since they might be defined by the previous call of this function -->{{#vardefine: varYear|}}<!-- -->{{#vardefine: varMonth|}}<!-- -->{{#vardefine: varDay|}}<!-- --><!-- check if BC this is a BC year
-->|{{#vardefine: varSlash1|{{#pos:{{{datestring|}}}|/}}|}}<!-- search for the first occurrence of slash
-->{{#ifswitch: {{#var: varSlash1}}<!-- -->|0={{#if: {{{reporterror|}}}| The datestring of property {{{property|}}} doesn't contain any date. |}}<!-- slash is the first symbol: don't do anyhting -->|={{#vardefine: varYear|{{{datestring|}}}|}}<!-- empty: assume that only the year is given -->|#default={{#vardefine: varYear|{{#sub:{{{datestring|}}}|0|{{#expr: {{#var: varSlash1}}-1}} }}|}}<!-- extract the year
-->{{#vardefine: varSlash2|{{#pos:{{{datestring|}}}|/|{{#expr: {{#var: varSlash1}}+1}} }}|}}<!-- search for the next occurrence of slash
-->{{#if: {{#var: varSlash2}}<!--
--><!--
-->|{{#vardefine: varYear|{{{datestring|}}}|}}<!-- assume that only the year is given
-->}}<!--
--><!--
-->Year: {{#var: varYear}}<!--now store the values -->Month{{SetDatePropertyValue|property={{{property|}}}|year={{#var: varYear}}|month={{#var: varMonth}}<!-- -->Day: |day={{#var: varDay}}|}}<!-- --><!-- 
--><!--
-->}}<!-- if datestring
-->}}<!-- if property
--></includeonly>