{"id":19877450,"url":"https://github.com/mla/time-ago","last_synced_at":"2025-08-31T05:33:37.836Z","repository":{"id":56830338,"uuid":"38552722","full_name":"mla/time-ago","owner":"mla","description":"Convert a duration, in seconds, to an approximate time in words","archived":false,"fork":false,"pushed_at":"2017-05-18T20:14:07.000Z","size":76,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-02T12:43:16.868Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mla.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-05T01:20:58.000Z","updated_at":"2021-03-19T16:05:06.000Z","dependencies_parsed_at":"2022-09-02T05:51:34.061Z","dependency_job_id":null,"html_url":"https://github.com/mla/time-ago","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/mla/time-ago","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mla%2Ftime-ago","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mla%2Ftime-ago/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mla%2Ftime-ago/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mla%2Ftime-ago/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mla","download_url":"https://codeload.github.com/mla/time-ago/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mla%2Ftime-ago/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272940920,"owners_count":25019000,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T16:37:29.660Z","updated_at":"2025-08-31T05:33:37.791Z","avatar_url":"https://github.com/mla.png","language":"Perl","readme":"# NAME\n\nTime::Ago - Approximate duration in words\n\n# VERSION\n\nversion 1.00\n\n# SYNOPSIS\n\n    use Time::Ago;\n\n    print Time::Ago-\u003ein_words(0), \"\\n\";\n    # prints \"less than a minute\"\n\n    print Time::Ago-\u003ein_words(3600 * 4.6), \"\\n\";\n    # prints \"about 5 hours\"\n    \n    print Time::Ago-\u003ein_words(86400 * 360 * 2), \"\\n\";\n    # prints \"almost 2 years\"\n    \n    print Time::Ago-\u003ein_words(86400 * 365 * 11.3), \"\\n\";\n    # prints \"over 11 years\"\n\n# DESCRIPTION\n\nGiven a duration, in seconds, returns a readable approximation.\nThis a Perl port of the time\\_ago\\_in\\_words() helper from Rails.\n\nFrom Rails' docs:\n\n    0 \u003c-\u003e 29 secs\n      less than a minute\n\n    30 secs \u003c-\u003e 1 min, 29 secs\n      1 minute\n\n    1 min, 30 secs \u003c-\u003e 44 mins, 29 secs\n      [2..44] minutes\n\n    44 mins, 30 secs \u003c-\u003e 89 mins, 29 secs\n      about 1 hour\n\n    89 mins, 30 secs \u003c-\u003e 23 hrs, 59 mins, 29 secs\n      about [2..24] hours\n\n    23 hrs, 59 mins, 30 secs \u003c-\u003e 41 hrs, 59 mins, 29 secs\n      1 day\n\n    41 hrs, 59 mins, 30 secs \u003c-\u003e 29 days, 23 hrs, 59 mins, 29 secs\n      [2..29] days\n\n    29 days, 23 hrs, 59 mins, 30 secs \u003c-\u003e 44 days, 23 hrs, 59 mins, 29 secs\n      about 1 month\n\n    44 days, 23 hrs, 59 mins, 30 secs \u003c-\u003e 59 days, 23 hrs, 59 mins, 29 secs\n      about 2 months\n\n    59 days, 23 hrs, 59 mins, 30 secs \u003c-\u003e 1 yr minus 1 sec\n      [2..12] months\n\n    1 yr \u003c-\u003e 1 yr, 3 months\n      about 1 year\n\n    1 yr, 3 months \u003c-\u003e 1 yr, 9 months\n      over 1 year\n\n    1 yr, 9 months \u003c-\u003e 2 yr minus 1 sec\n      almost 2 years\n\n    2 yrs \u003c-\u003e max time or date\n      (same rules as 1 yr)\n\n# METHODS\n\n- in\\_words \n\n        Time::Ago-\u003ein_words(30); # returns \"1 minute\"\n        Time::Ago-\u003ein_words(3600 * 24 * 365 * 10); # returns \"about 10 years\"\n\n    Given a duration, in seconds, returns a readable approximation in words.\n\n    If an include\\_seconds parameter is supplied, durations under one minute\n    generate more granular phrases:\n\n        foreach (4, 9, 19, 39, 59) {\n          print Time::Ago-\u003ein_words($_, include_seconds =\u003e 1), \"\\n\";\n        }\n\n        # less than 5 seconds\n        # less than 10 seconds\n        # less than 20 seconds\n        # half a minute\n        # less than a minute\n\n    As a convenience, if the duration is an object with an epoch() interface\n    (as provided by Time::Piece or DateTime), the current time minus the\n    object's epoch() seconds is used.\n\n    Passing the duration as a DateTime::Duration instance is also supported.\n\n# LOCALIZATION\n\nLocale::TextDomain is used for localization.\n\nCurrently Arabic, Dutch, English, French, German, Italian, Japanese, Russian,\nand Spanish translations are available. Contact me if you need another\nlanguage.\n\nSee [Locale::TextDomain](https://metacpan.org/pod/Locale::TextDomain) for how to specify a language.\n\n    #!/usr/bin/env perl\n    \n    use strict;\n    use warnings;\n    use open qw/ :std :utf8 /;\n    use POSIX ':locale_h';\n    use Time::Ago;\n    \n    my $secs = 86400 * 365 * 10.4;\n    \n    foreach (qw/ en fr de it ja ru es /) {\n      setlocale(LC_ALL, '');\n      $ENV{LANGUAGE} = $_;\n      print Time::Ago-\u003ein_words($secs), \"\\n\";\n    }\n\nOutput:\n\n    over 10 years\n    plus de 10 ans\n    vor mehr als 10 Jahren\n    oltre 10 anni\n    10年以上\n    больше 10 лет\n    más de 10 años\n\n# BUGS\n\nThe rails' implementation includes some logic for leap years that is not\nimplemented here.\n\n# CREDITS\n\nRuby on Rails DateHelper\n[http://apidock.com/rails/v4.2.1/ActionView/Helpers/DateHelper/distance\\_of\\_time\\_in\\_words](http://apidock.com/rails/v4.2.1/ActionView/Helpers/DateHelper/distance_of_time_in_words)\n\nRuby i18n library\n[https://github.com/svenfuchs/i18n](https://github.com/svenfuchs/i18n)\n\n# SEE ALSO\n\nGithub repository [https://github.com/mla/time-ago](https://github.com/mla/time-ago)\n\n[Time::Duration](https://metacpan.org/pod/Time::Duration), [DateTime::Format::Human::Duration](https://metacpan.org/pod/DateTime::Format::Human::Duration), [Locale::TextDomain](https://metacpan.org/pod/Locale::TextDomain)\n\n# AUTHOR\n\nMaurice Aubrey \u003cmaurice.aubrey@gmail.com\u003e\n\n# COPYRIGHT AND LICENSE\n\nThis software is copyright (c) 2017 by Maurice Aubrey.\n\nThis is free software; you can redistribute it and/or modify it under\nthe same terms as the Perl 5 programming language system itself.\n\n[![Build Status](https://travis-ci.org/mla/time-ago.svg?branch=master)](https://travis-ci.org/mla/time-ago)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmla%2Ftime-ago","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmla%2Ftime-ago","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmla%2Ftime-ago/lists"}