[ic] Modification of a passed Date Value

Aaron Hazelton aaronmail at hazenet.net
Thu Mar 4 16:33:12 EST 2004


On Thu, 4 Mar 2004 19:20:27 -0000, Kevin Walsh <kevin at cursor.biz> wrote:

> Aaron Hazelton [aaronmail at hazenet.net] wrote:
>>
>> this for example works fine:
>> 	[convert-date][scratch value][/convert-date]
>>
>> however, I am having trouble doing something like this:
>> 	[convert-date adjust="6 days"][scratch value][/convert-date]
>>
>> by getting this error:
>> 	[04/March/2004:09:32:24 -0500] ccs /i/calendar.html Runtime error:
>> Undefined subroutine &Vend::Interpolate::mktime called at (tag 
>> 'scratch')
>> line 34. >
>>
>> any ideas? should this not work?
>>
> It works for me:
>
> [set value]2004-02-18[/set]
> [convert-date][scratch value][/convert-date]<br>
> [convert-date adjust="6 days"][scratch value][/convert-date]<br>
>
> Gives me:
>
> 18-Feb-2004
> 24-Feb-2004
>
> It could be just my setup that's making it work, so try the following
> patch:
>
> ======================================================================
> *** convert_date.tag    2 Mar 2004 22:35:26 -0000       1.3
> --- convert_date.tag    4 Mar 2004 19:18:56 -0000
> ***************
> *** 39,45 ****
> }
>
> if ($adjust) {
> !               $now ||= mktime(@t);
> $adjust .= ' days' if $adjust =~ /^[-\s\d]+$/;
>
> if ($adjust =~ s/^\s*-\s*//) {
> --- 39,45 ----
> }
>
> if ($adjust) {
> !               $now ||= POSIX::mktime(@t);
> $adjust .= ' days' if $adjust =~ /^[-\s\d]+$/;
>
> if ($adjust =~ s/^\s*-\s*//) {
> ======================================================================
>
> if that fixes it for you then I'll commit to CVS.
>

yep!

so doing:

[convert-date adjust="6 days" format="%Y%m%d"][scratch start][/convert- 
date]<br />
[convert-date adjust="7 days"][scratch start][/convert-date]

yields:

20040306
07-Mar-2004

as always, thanks Kevin!

-- 
Aaron Hazelton
Hazenet.net


More information about the interchange-users mailing list