[ic] date_convert zerofix fails unless surrounded by space

David Christensen david at endpoint.com
Tue Aug 9 21:50:33 UTC 2011

On Aug 9, 2011, at 4:17 PM, Paul Jordan wrote:

> Hi
> I've notice that the zerofix parameter doesn't work if the format specifier is butted up to another specifier. Here is some test code that can be pasted onto any page.
> This will work as expected:<br />
> [convert_date zerofix=1 fmt="%I %P"][/convert_date]
> <br /><br />
> This will not:<br />
> [convert_date zerofix=1 fmt="%I%P"][/convert_date]
> BTW - that is a captial eye, not lowercase L.
> I think it is a bug, or...?
> Paul Jordan

It looks like zerofix operates on the formatted value, which in turn is implemented via:

	$out =~ s/\b0(\d)\b/$1/g if $opt->{zerofix};

So this will only remove leading zeros if the final output value matches that regex, which is dependent on word breaks.  %P I assume in this case is alpha-numeric, not digits.  (My system strftime() has %p but not %P).  Definitely unintuitive behavior, but not sure what the best fix would be in general; maybe remove the trailing \b from the regex?


David Christensen
End Point Corporation
david at endpoint.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1395 bytes
Desc: not available
URL: <http://www.icdevgroup.org/pipermail/interchange-users/attachments/20110809/68be6991/attachment.bin>

More information about the interchange-users mailing list