Template talk:Datediff

From Guild Wars Wiki
Jump to navigationJump to search

year/month/days template?[edit]

Is there any way that a template could be made that would change the current datediff template to display the days in years/months/days instead of one large day number? Look on my character's pages to see what I'm meaning, my warrior is said to be an age of 900+ days. Is there a way to change this by template that'll automatically update itself? The preceding unsigned comment was added by Neithan Diniem (talk • contribs) at 17:23, 1 February 2009 (UTC).

Sorry about unsigned >_< forgot...Neithan Diniem 18:14, 1 February 2009 (UTC)
Don't worry forgetting to sign. We all do that once in a while.
As for the output, it's meant to output as one big number as it's mainly used to track the number of days that has passed since treasure hunting :) Proper date calculation will require a bit more work and will be much easier to create by using additional templates that attempt to break down the value returned by this template. -- ab.er.rant User Ab.er.rant Sig.png 14:33, 2 February 2009 (UTC)
Is there any particular templates you have in mind? this question was asked by someone who isn't all too savvy with advanced wikicode and complex template creation/interface.Neithan Diniem 22:08, 2 February 2009 (UTC)
What I meant was that to get the calculation you want, you'd need to create additional templates that makes used of the value returned by this template. -- ab.er.rant User Ab.er.rant Sig.png 08:52, 3 February 2009 (UTC)
I whipped up something for you. For your characters, use {{Age}} instead {{Datediff}}. It just shows years and days based on the date diff. -- ab.er.rant User Ab.er.rant Sig.png 09:41, 3 February 2009 (UTC)
I was looking at doing this last night too, but it seems you ran into the same problem (or tried to bypass it) that I did. Yours doesn't configure in leap year or months/weeks (which is damn near impossible without a rather large template) I will look more into it later if I think of a better way to handle it. I don't like the fact that this {{age}} will show a max of 364 days, which is the same as datediff if the diff is less than a year. — Rappy 22:38, 3 February 2009 (UTC)
Well this will work for me, it will let me actually place a good, well organized age date than just ~3 years or 900+ days, Thanks for whipping this up! Neithan Diniem 22:42, 3 February 2009 (UTC)
Well, found an oddity, I may be doing this wrong, but the Age template is displaying an incorrect date, Am I doing it wrong? I have it on my war as {{Age|1 Aug 2006}} and its saying its over 3 years 180 days, when my character is only 30 months old (2 years, 180 days), so its a year off? --The preceding unsigned comment was added by User:Neithan Diniem (talk).
That's because the round 0 is rounding 2.5 up to 3, and it seems our parcer here doesn't allow trunc or floor options, so there's no way around that currently. — Rappy 23:24, 3 February 2009 (UTC)
Yep. The rounding functions suck. I already had a template that does a more natural rounding on another wiki but that wiki was down the other day so I couldn't copy :) lazy to rewrite it so I just did the simplest thing possible. -- ab.er.rant User Ab.er.rant Sig.png 02:28, 5 February 2009 (UTC)
Should be fixed now. -- ab.er.rant User Ab.er.rant Sig.png 02:36, 5 February 2009 (UTC)