[ic] Tag Time Adjust - strange behaviour

Kevin Walsh interchange-users@icdevgroup.org
Fri Jun 14 08:58:00 2002


> 
> Today is Friday, June 14, 2002
> 
> For [scratch TimeTmp] = 24
> 
> [seti TimeFinal][time adjust="[scratch TimeTmp]"]%A, %B %d, %Y[/time][/seti]
> 
> will properly produce Saturday, June 15, 2002
> 
> For [scratch TimeTmp] = 48
> 
> [seti TimeFinal][time adjust="[scratch TimeTmp]"]%A, %B %d, %Y[/time][/seti]
> 
> will properly produce Sunday, June 16, 2002
> 
> etc. etc...
> 
> 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??
> 
The last two zeros are stripped from the "adjust" parameter to allow
for time adjustments specified as "+0100" (1 hour).

You have a couple of choices:

Either Add "00" to the end of your adjustments:

    2400, 4800, 10000, 20000 etc.

or apply a patch like this:

*** Interpolate.pm      6 Jun 2002 02:14:47 -0000       2.9.2.16
--- Interpolate.pm      14 Jun 2002 12:54:43 -0000
***************
*** 2911,2917 ****
        $fmt = '%Y%m%d' if $opt->{sortable};

        if($opt->{adjust}) {
!               $opt->{adjust} =~ s/00$//;
          $opt->{adjust} =~ s/^(-)?[0+]/$1/;
          $now += (60 * 60) * $opt->{adjust};
        }
--- 2911,2917 ----
        $fmt = '%Y%m%d' if $opt->{sortable};

        if($opt->{adjust}) {
!               $opt->{adjust} =~ s/00$// unless $opt->{nostrip};
          $opt->{adjust} =~ s/^(-)?[0+]/$1/;
          $now += (60 * 60) * $opt->{adjust};
        }

With a patch like that, you would change your [time] tags to look
like this:

    [time adjust="[scratch TimeTmp]" nostrip=1]%A, %B %d, %Y[/time]

(Usual disclaimer - untested code etc.)

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/