Jump to content

User:J JMesserly

From mediawiki.org


  • Problem- The string could be a year value only, which is in most cases will be a 4 digit number, but could be even 1 digit. These are ambiguous to #time. So handle all numeric digit values as a special case and send the rest to normal processing. Some values will return as numeric eg 1941-12-7 = 1922, so we test if the evaluation equals the string value. eg: {{#ifeq:"1941-12-7"|"{{#expr:1941-12-7}}"|is_year|not_year}} = not_year
  • This works with non numerics without cumbersome error checking logic. {{#ifeq:"November 21, 1856"|"{{#expr:November 21, 1856}}"|is_year|not_year}} = not_year
  • However the test is not foolproof. EG: possible leading or trailing spaces. EG:{{#ifeq:"1941 "|"{{#expr:1941 }}"|true|false}} = not_year
  • 0023
  • Trunc:0043.02.05 → 43
  • round:0043.02.05 → 0.020000000000003
  • time 1943.02.05 → 0043-02-01
  • Less:strip year, mod by 2000, then add 3000=4983


  • 1962
  • demo end date arithmetic with appropriate precision adjustment: 1962-07-05 UTC00
  • 4961-12/-m/+1 month,