
david at endpoint
Aug 9, 2011, 2:50 PM
Post #2 of 4
(220 views)
Permalink
|
|
Re: date_convert zerofix fails unless surrounded by space
[In reply to]
|
|
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? Regards, David -- David Christensen End Point Corporation david [at] endpoint
|