Skip Menu |

This queue is for tickets about the DateTime-Format-Duration CPAN distribution.

Report information
The Basics
Id: 41843
Status: open
Priority: 0/
Queue: DateTime-Format-Duration

People
Owner: Nobody in particular
Requestors: ddascalescu+perl [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.03a
Fixed in: (no value)



Subject: %k pads hours with a space instead of not padding at all
Please see attached file for a test case. Also, there's a typo in the documentation: "vslues" Finally, it would be very useful to have a way of not displaying the leading zero values, e.g. "0 years, 00 months, 0 days, 0 hours, 01 minutes, 40 seconds" should just be displayed as "1 minute, 40 seconds"
Subject: dateTime_Format_Duration_bug.pl
#!/usr/local/bin/perl -w use strict; use DateTime::Format::Duration; my $d = DateTime::Format::Duration->new( pattern => '<%k> hours' ); print $d->format_duration( DateTime::Duration->new( hours => 6, ) ); # will print '< 6> hours' instead of '<6> hours'
From: ozcoder [...] gmail.com
Hi, According to the strftime man page %k The hour (24-hour clock) as a decimal number (range 0 to 23); single digits are preceded by a blank. (See also %H.) and so the original author formats the duration the same way. I have added a Glibc extension where you put a leading "-" to eliminate the leading blank. See my diff https://github.com/ozcoder/DateTime-Format-Duration/commit/f7a476608704c65c5080c55bcb05f82c6325194b Gordon On Sat Dec 20 19:34:23 2008, dandv wrote: Show quoted text
> Please see attached file for a test case. > > Also, there's a typo in the documentation: "vslues" > > Finally, it would be very useful to have a way of not displaying the > leading zero values, e.g. > > "0 years, 00 months, 0 days, 0 hours, 01 minutes, 40 seconds" > > should just be displayed as > > "1 minute, 40 seconds"