Template:Date: Difference between revisions

From railML 2 Wiki
Jump to navigation Jump to search
[checked revision][checked revision]
No edit summary
(Corrected subscript to superscript)
Line 14: Line 14:
|#default=FIXME!
|#default=FIXME!
}} {{#switch:{{#sub:{{{1}}}|8}}
}} {{#switch:{{#sub:{{{1}}}|8}}
|01=1<sub>st</sub>
|01=1<sup>st</sup>
|02=2<sub>nd</sub>
|02=2<sup>nd</sup>
|03=3<sub>rd</sub>
|03=3<sup>rd</sup>
|21=21<sub>st</sub>
|21=21<sup>st</sup>
|22=22<sub>nd</sub>
|22=22<sup>nd</sup>
|23=23<sub>rd</sub>
|23=23<sup>rd</sup>
|31=31<sub>st</sub>
|31=31<sup>st</sup>
|#default={{#ifeq:{{#sub:{{{1}}}|8|1}}|0|{{#sub:{{{1}}}|9}}|{{#sub:{{{1}}}|8}}}}<sub>th</sub>
|#default={{#ifeq:{{#sub:{{{1}}}|8|1}}|0|{{#sub:{{{1}}}|9}}|{{#sub:{{{1}}}|8}}}}<sup>th</sup>
}} {{#sub:{{{1}}}|0|4}}</includeonly><noinclude>
}} {{#sub:{{{1}}}|0|4}}</includeonly><noinclude>
==Usage==
==Usage==

Revision as of 16:24, 27 May 2019

Usage

This template parses a date of shape yyyy-mm-dd into spoken language like March 18th 1975

Parameters

The template hase one obligatory unnamed parameter:

  • 1: a date of shape yyyy-mm-dd

Examples

Code Result
{{date|1900-01-01}} January 1st 1900
{{date|2025-11-22}} November 22nd 2025
{{date|2019-02-31}} February 31st 2019 (rubbish in→rubbish out ;)