Template talk:Table Age Calculator

Latest comment: 6 months ago by ThylacineHunter in topic Error message on template documentation page

Error message on template documentation page edit

There is a ParserFunction error message, Approx. Expression error: Unexpected < operator, on the documentation page. I do not know if it is new due to a change somewhere else, or if it has been there for a while. Pinging ThylacineHunter. – Jonesey95 (talk) 17:47, 31 August 2023 (UTC)Reply

There is a bug that happens when no day of a month is provided in variables of "TAC2" (which I thought I fixed), the template add a default current day th preform the age calculation, this results in things like 31st April (which doesn't exist).
Unfortunately, it is fine now. I'll have to try and catch it next time it happens so I can fix it properly this time. -- ThylacineHunter (talk) 01:30, 1 September 2023 (UTC)Reply
Set an alarm on your calendar for October 31, I guess. Or, if it's approximate, you might be able to use {{Max}} so that the output of your math would not exceed a reasonable value. If you did something like {max|CURRENTDAY|28} (to account for February), would that get the job done? – Jonesey95 (talk) 01:35, 1 September 2023 (UTC)Reply
@Jonesey95 and ThylacineHunter: It's happening again and needs to be fixed (also showing up in articles). Deor (talk) 13:48, 31 October 2023 (UTC)Reply
I'm a little stumped. The error has to have something to do with the use of Template:Extract (even though I'm using fix=on which should prevent this issue).
It doesn't help that I only been using a limited time of one day (31st of the month) to try and fix this.
I have just realised I can extend it to 2-3 days a month if I test it with using the variable of Feb during a non-leap year (but I can still only do that on the 29th - 31st of each month). This only gives me 29 days of the year to effectively test and try to fix this error. -- ThylacineHunter (talk) 14:59, 31 October 2023 (UTC)Reply
I tried swapping "28" for the current day in the template sandbox if the current day is greater than 28, but I don't know if I did it in the right place. The undocumented tangle of if statements and extractions is not easy to parse. This feels like a job for a Lua module, but I don't know Lua. – Jonesey95 (talk) 15:22, 31 October 2023 (UTC)Reply
I'm still not too familiar with Lua, but I think I may have fixed this template now...
I added extra "{{extract|year formula|month formula|day formula|fix=on}}" and did a rough test by changing "{{CURRENTDAY}}" to "31" to try a force a date of 31st Feb 2023.
It appears to finally be fixed, although the real test will be either 30 Nov (for the February 1894 example in the document) or 31 Dec (for all other months with only 30 days).
On a side note I also cleared up "{{CURRENTYEAR}}}{{CURRENTMONTH}}{{CURRENTDAY}}" with the simpler "{{TODAY}}". -- ThylacineHunter (talk) 10:05, 2 November 2023 (UTC)Reply