At the moment, the [[date … module can not produce "time till" information via the %O format. It returns a negative value: e.g. -176383 seconds ago. This should really return a positive time till value and should not show the number of seconds but instead, show the number of minutes, days, years, etc…
From a client-side point of view, this is easy to fix. Here are some suggestions on what could be done:
- introduce a new %o (lowercase) variable which displays "time till"
- make %O return a positive value regardless if the date is in the past or the future
Option 2 takes 14 characters to solve: if(x<0){x=-x;}
Option 1 might take a little more code, but certainly possible:
if(k.match(/%o/)||h.match(/togohover/)){var x=OZONE.request.timestamp-g;x+=Math.floor(((new Date()).getTime()-OZONE.request.date.getTime())*0.001);x=-x;var l=OZONE.utils.calculateDateAgo(x);k=k.replace(/%o/,l);if(h.match(/togohover/)){var b=l+" "+ogettext("to go");OZONE.dialog.hovertip.makeTip(f,{text:b,style:{width:"auto"}});YAHOO.util.Event.addListener(f,"mouseover",function(H){var F=$j;var G=OZONE.request.timestamp-F(this).data("timestamp");G+=Math.floor(((new Date()).getTime()-OZONE.request.date.getTime())*0.001);var y=OZONE.utils.calculateDateAgo(G);this.hovertip.getElementsByTagName("div").item(0).innerHTML=y+" "+ogettext("to go")})}}if(k.match(/%O/)||h.match(/agohover/)){var x=OZONE.request.timestamp-g;x+=Math.floor(((new
Now it display time - since date to now (for past dates) or till date (for future dates). Also it is fixed for ago-hover (mouse over tooltip).
Bartłomiej Bąkowski @ Wikidot Inc.
';.;' TeRq (Write PM)
Thanks for this! The documentation should also be updated: http://www.wikidot.com/doc:wiki-syntax#toc44
Kenneth Tsang (@jxeeno)
Probably being a little fussy, but instead of the word "till", could I suggest the word "away"?
For example:
Does anybody else agree, or is the word "till" more suitable?
I guess it kinda depends on the context. I think a more direct opposite for "ago" would be "to go"…
Kenneth Tsang (@jxeeno)
As we are not natives, please agree on this one and we will change the hover message so it sounds best, ok?
I would suggest "from now". If I was describing past and future date stamps, I'd probably say something like this:
This past date stamp was one day ago.
This future date stamp is three days from now.
Community Admin
I also agree that "from now" is the very best option.
Hmmm… just an afterthought… It would be nice if we can have another variable which includes the word ago or till. For example, the current usage:
which will return:
27 Dec 2012 00:24 (27th Dec)
But once we reach the 28th December, the %O variable will change to "1"… so it'll display:
1 day to go
If we could get another variable that returns the %O and the descriptor together, it'll allow us to have an awesome countdown clock that changes once we reach the date.
What do people think? Any other suggestions to solve this problem before I submit a wish?
Kenneth Tsang (@jxeeno)
I like it, but it should support both "ago" and "to go" variables so we can handle both side of the event or what ever else you might be counting down.
Community Admin
Sounds good.
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server