DateTime-Format-Human-Duration
view release on metacpan or search on metacpan
lib/DateTime/Format/Human/Duration.pm view on Meta::CPAN
Note L</format_duration_between>(), does not suffer from this since we're using a specific DateTime object already.
print $span->format_duration_between( $dt, $dt->clone()->add('seconds'=> 62) ); # 1 minute and 2 seconds
=head2 Why do you put a comma before the 'and' in a group of more than 2 items?
We want to use the so-called Oxford comma to avoid ambiguity.
=head2 My DateTime::Format::Human::Duration::Locale::XX still outputs in English!
That is because it defined neither the L</get_human_span_hashref()> or the L</get_human_span_from_units()> functions
It must define one of them or defaults are used.
=head2 Why didn't you just use 'DateTime::Format::Duration'
Essencially DateTime::Format::Duration is an object representing a single strftime() type string to apply to any given duration. This is not flexible enough for the intent of this module.
DateTime::Format::Duration is not a bad module its just for a different purpose than DateTime::Format::Human::Duration
=over 4
=item * It was not localizable
You either got '2 days' or '1 days' which a) forces it to be in English and b) doesn't even make sense in English.
You could get around that by adding logic each time you wanted to call it but that is just messy.
=item * Had to keep an item even if it was zero
If 'days' was in there you got '0 days', we only want items with a value to show.
That'd also require a lot of logic each time you wanted to call which is again messy.
=item * This module has no need for reparsing output back into an object
Since the datetime info for 2 points in time are generally in a form easily rendered into a DateTime object it'd be silly to even attempt to store and parse the output of this module back into an object.
Plus since it all depends on the locale it is in it'd be difficult.
=back
The purpose of DateTime::Format::Human::Duration was to generate a localized human language description of a duration without the caller needing to supply any logic.
=head1 DIAGNOSTICS
Throws no warnings or errors of its own
=head1 CONFIGURATION AND ENVIRONMENT
DateTime::Format::Human::Duration requires no configuration files or environment variables.
=head1 DEPENDENCIES
None.
=head1 INCOMPATIBILITIES
None reported.
=head1 BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to
C<bug-datetime-format-span@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.
=head1 AUTHOR
Daniel Muey C<< <http://drmuey.com/cpan_contact.pl> >>
=head1 LICENCE AND COPYRIGHT
Copyright (c) 2008, Daniel Muey C<< <http://drmuey.com/cpan_contact.pl> >>. All rights reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>.
=head1 DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
( run in 2.136 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )