DateTimeX-Format-Ago
view release on metacpan or search on metacpan
Castillian Spanish ('es') is also provided, but some of the strings
were translated with Google Translate, so they might not be perfect.
Methods
`format_datetime($dt)`
Returns something like "3 days ago", "just now" or "hace un año".
`parse_datetime($string)`
Croaks. Don't use this.
BUGS AND LIMITATIONS
High resolution datetimes
Imagine the time is currently 2020-01-01T12:00:00.200. If you try to
format the time 2020-01-01T12:00:00.100 you'll get back the result "in the
future". So what's going on? DateTimeX::Format::Ago figures out when "now"
is using `DateTime->now`, which rounds back to the nearest whole second.
If you know you're going to be dealing with high resolution datetimes, and
don't want to occasionally see "in the future" for times in the very
recent past, then use Time::HiRes.
lib/DateTimeX/Format/Ago.pm view on Meta::CPAN
=item C<< format_datetime($dt) >>
Returns something like "3 days ago", "just now" or "hace un año".
=item C<< parse_datetime($string) >>
Croaks. Don't use this.
=back
=head1 BUGS AND LIMITATIONS
=head2 High resolution datetimes
Imagine the time is currently 2020-01-01T12:00:00.200. If you try to format
the time 2020-01-01T12:00:00.100 you'll get back the result "in the future".
So what's going on? DateTimeX::Format::Ago figures out when "now" is using
C<< DateTime->now >>, which rounds back to the nearest whole second.
If you know you're going to be dealing with high resolution datetimes, and
don't want to occasionally see "in the future" for times in the very recent
( run in 0.467 second using v1.01-cache-2.11-cpan-4d50c553e7e )