[Bug 7114] Introduce {{#timediff:}} parser function
https://bugzilla.wikimedia.org/show_bug.cgi?id=7114 --- Comment #15 from Danny B. 2009-04-26 21:51:49 UTC --- (In reply to comment #14) > With the #time and #expr parser functions we can trivially calculate the > number > of seconds between two dates: > > {{#expr: {{#time:U|date1}} - {{#time:U|date2}} }} > > If we had a function #timeformat to match #dateformat, that converted that > string into a relative time, then you have your prettified output; as noted in > comment7, it would be nice to be able to get only a part of the output. But > such a function could also be used to, for instance, convert between units of > time (eg {{#timeformat: numberofseconds | Y }} converts seconds to years). Of > course this can be done using #expr but guess what, so can #timeformat > itself. > If you're determined to ignore the fact that this can be quite easily handled > on-wiki without any extra bells-and-whistles from the software end, the > resulting function might as well be as useful as possible. > > You're right, I guess, that this bug isn't really FIXED because the available > solution is not software-based, but I'd strongly suggest WONTFIX for exactly > that reason. It's easily doable on-wiki, without bloating the code with > another myserious parser function, and without running into performance > issues. > Aha, so we're going to bloat the wikitext with way so complex template(s) to return the time diff in desired format instead? When I want the time difference, I want it in human legible format - "the difference is 1 year, 2 months, 3 days, 4 hours, 5 minutes and 6 seconds", not in a number of seconds or so. I also want to be able to format the result any possible way simply by adding the format string as a parameter of the function (such as {{#time:}} has now) without having to create and call either bunch of one-format-purpose templates or way so complex, very possibly nested, templates with dozens of {{#if:}}s and {{#switch:}}es and other stuff which actually would run into performance issues much earlier. Anyway, so far we don't have any #timeformat or any other function, right? So _after_ we'll have it, thus we'll be able to format the time differences easier than by dozens of {{#expr:}}s in dozens of (nested) templates, this request might be closed. We do not have any _simple_ way how to do what's requested. -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. You are on the CC list for the bug. ___ Wikibugs-l mailing list Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 7114] Introduce {{#timediff:}} parser function
https://bugzilla.wikimedia.org/show_bug.cgi?id=7114 --- Comment #14 from Happy-melon 2009-04-22 20:25:36 UTC --- With the #time and #expr parser functions we can trivially calculate the number of seconds between two dates: {{#expr: {{#time:U|date1}} - {{#time:U|date2}} }} If we had a function #timeformat to match #dateformat, that converted that string into a relative time, then you have your prettified output; as noted in comment7, it would be nice to be able to get only a part of the output. But such a function could also be used to, for instance, convert between units of time (eg {{#timeformat: numberofseconds | Y }} converts seconds to years). Of course this can be done using #expr but guess what, so can #timeformat itself. If you're determined to ignore the fact that this can be quite easily handled on-wiki without any extra bells-and-whistles from the software end, the resulting function might as well be as useful as possible. You're right, I guess, that this bug isn't really FIXED because the available solution is not software-based, but I'd strongly suggest WONTFIX for exactly that reason. It's easily doable on-wiki, without bloating the code with another myserious parser function, and without running into performance issues. -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. You are on the CC list for the bug. ___ Wikibugs-l mailing list Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 7114] Introduce {{#timediff:}} parser function
https://bugzilla.wikimedia.org/show_bug.cgi?id=7114 Danny B. changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED | --- Comment #13 from Danny B. 2009-04-22 20:01:37 UTC --- (In reply to comment #12) > See, for instance, [[Template:Time ago]]. This is miles off the template > limits, and is simple and effective. A specific function #time*diff* would > actually be less useful than a function that simply converts a > number-of-seconds value into a relative time, but that's not specifically what > this bug is about. > Actually, what exactly would be less useful? Did you read the proposals of behavior? Please, don't close this as FIXED since it is not fixed in fact. I'm also pointing to the fact that PHP 5.3.0 introduces DateTime::diff. So basically this can be left open until a wikisyntax wrapper for that method (as a separate extension probably - thus the entire ParserFunctions wouldn't have to depend on high version of PHP) will be developed. -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. You are on the CC list for the bug. ___ Wikibugs-l mailing list Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 7114] Introduce {{#timediff:}} parser function
https://bugzilla.wikimedia.org/show_bug.cgi?id=7114 Happy-melon changed: What|Removed |Added CC||happy-me...@live.com Status|REOPENED|RESOLVED Resolution||FIXED --- Comment #12 from Happy-melon 2009-04-22 19:18:27 UTC --- See, for instance, [[Template:Time ago]]. This is miles off the template limits, and is simple and effective. A specific function #time*diff* would actually be less useful than a function that simply converts a number-of-seconds value into a relative time, but that's not specifically what this bug is about. -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. You are on the CC list for the bug. ___ Wikibugs-l mailing list Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l