[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Tag Time Adjust - strange behaviour
Quoting Mike Heins (mike@valuemedia.com):
> Quoting Bruno Cantieni (bruno@digi-land.com):
[snip]
> > Now try it with values such as 100, 200, 300 ... 600 for [scratch TimeTmp].
> >
> > I keep getting Friday, June 14, 2002 (unadjusted current date) for
> > values like that!!!!
> >
> > Since my [scratch TimeTmp] is generated in a perl block algorithm I have to do
> >
> > $Scratch->{TimeTmp} += 1;
> >
> > to get past this "buggy" behaviour.
> >
> > Anyone else noticed this or can shed some light on the matter??
> >
>
> I believe the last two trailing zeros are removed if present to allow
> input of a time zone like +0500 or -0400. If that is not documented,
> that is a documentation bug; the behavior is not a bug but a feature. 8-)
>
> [loop 2400 4800 9600 20000 30000]
>
> [loop-code] -- [seti TimeFinal][time adjust="[loop-code]"]%A, %B %d, %Y[/time][/seti]
> [scratch TimeFinal]<br>
>
> [/loop]
>
> -2400 -- Thursday, June 13, 2002
Thanks for finding this. Behavior is less than optimal and logical, I think.
I have updated the development branch to reflect this documentation:
Accepts the following options:
4.77.2.1. adjust
----------------
If you wish to temporarily adjust the time for display purposes, you
can pass an adjust parameter with the number of hours (plus or minus).
[time]%c[/time]
[time adjust="-3"]%c[/time]
Will display:
Mon 01 Jan 2001 11:29:03 AM EST
Mon 01 Jan 2001 08:29:03 AM EST
If the number ends in zero and has 3 digits or more, it is assumed
that the number is in timezone format (i.e +500) the local time or
from GMT:
[time]%c[/time]
[time adjust="-330"]%c[/time]
[time adjust="-300"]%c[/time]
Will display:
Mon 01 Jan 2001 11:29:03 AM EST
Mon 01 Jan 2001 07:59:03 AM EST
Mon 01 Jan 2001 08:29:03 AM EST
If you want to force the number to be just a number of hours, add the
hours parameter:
[time]%c[/time]
[time adjust="100" hours=1]%c[/time]
Will display:
Mon 01 Jan 2001 11:29:03 AM EST
Fri 05 Jan 2001 15:29:03 PM EST
If adjust is an Interchange time duration with a suffix of sec, min,
hrs, days, or weeks, that will be used.
[time]%c[/time]
[time adjust="2 days"]%c[/time]
Will display:
Mon 01 Jan 2001 11:29:03 AM EST
Wed 03 Jan 2001 11:29:03 AM EST
--
Mike Heins
Perusion -- Expert Interchange Consulting
phone +1.513.523.7621 <mike@perusion.com>
I don't want to get to the end of my life and find I have just
lived the length of it. I want to have lived the width of it as
well. -- Diane Ackerman