humanize_time
Version, currently 0.12.324 versions
- 0.12.6latestJun 29, 2026
- 0.12.5not indexedJun 29, 2026
- 0.12.4not indexedJun 29, 2026
- 0.12.3not indexedJun 29, 2026
- 0.12.2not indexedJun 29, 2026
- 0.12.1not indexedJun 29, 2026
- 0.12.0not indexedJun 29, 2026
- 0.11.0not indexedJun 29, 2026
- 0.10.3not indexedJun 29, 2026
- 0.10.2not indexedJun 29, 2026
- 0.10.1not indexedJun 29, 2026
- 0.10.0not indexedJun 29, 2026
- 0.9.0not indexedJun 29, 2026
- 0.8.2not indexedJun 29, 2026
- 0.8.1not indexedJun 29, 2026
- 0.8.0not indexedJun 29, 2026
- 0.7.1not indexedJun 29, 2026
- 0.7.0not indexedJun 29, 2026
- 0.6.0not indexedJun 29, 2026
- 0.5.0not indexedJun 29, 2026
- 0.4.0not indexedJun 29, 2026
- 0.3.0not indexedJun 29, 2026
- 0.2.0not indexedJun 29, 2026
- 0.1.0not indexedJun 29, 2026
github.com/mamantoha/humanize_time
Express time spans in natural language
Nothing has been indexed for 0.12.3 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
humanize_time:
github: mamantoha/humanize_time
version: ~> 0.12.3Then run:
shards installshard.yml
No shard.yml has been indexed for 0.12.3. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
humanize_time
Reports the approximate distance in time between two Time objects.
Pass include_seconds: true if you want more detailed approximations when distance < 1 min, 29 secs.
humanize_time supports i18n translations too so it can be used in internationalized apps.
humanize_time implementation is heavily inspired by (read: stolen) distance_of_time_in_words method.
Many thanks to Rails community!
Distances are reported based on the following table:
| Value | Result |
|---|---|
| 0 <-> 29 secs | less than a minute |
| 30 secs <-> 1 min, 29 secs | 1 minute |
| 1 min, 30 secs <-> 44 mins, 29 secs | [2..44] minutes |
| 44 mins, 30 secs <-> 89 mins, 29 secs | about 1 hour |
| 89 mins, 30 secs <-> 23 hrs, 59 mins, 29 secs | about [2..24] hours |
| 23 hrs, 59 mins, 30 secs <-> 41 hrs, 59 mins, 29 secs | 1 day |
| 41 hrs, 59 mins, 30 secs <-> 29 days, 23 hrs, 59 mins, 29 secs | [2..29] days |
| 29 days, 23 hrs, 59 mins, 30 secs <-> 44 days, 23 hrs, 59 mins, 29 secs | about 1 month |
| 44 days, 23 hrs, 59 mins, 30 secs <-> 59 days, 23 hrs, 59 mins, 29 secs | about 2 months |
| 59 days, 23 hrs, 59 mins, 30 secs <-> 1 yr minus 1 sec | [2..12] months |
| 1 yr <-> 1 yr, 3 months | about 1 year |
| 1 yr, 3 months <-> 1 yr, 9 months | over 1 year |
| 1 yr, 9 months <-> 2 yr minus 1 sec | almost 2 years |
| 2 yrs <-> max time or date | (same rules as 1 yr) |
Installation
Add this to your application's shard.yml:
dependencies:
humanize_time:
github: mamantoha/humanize_time
Usage
require "humanize_time"
HumanizeTime.locale = "es" # or `I18n.locale = "es"`
HumanizeTime.distance_of_time_in_words(42.minutes.ago, Time.local)
# => 42 minutos
HumanizeTime.distance_of_time_in_words(3.seconds.ago, Time.local, include_seconds: true)
# => menos de 5 segundos
Available locales
Locale data synced with rails-i18n repository from files found in rails/locale directory.
Available 123 locales:
["af", "ar", "az", "be", "bg", "bn", "bs", "ca", "cnr", "cs", "cy", "da", "de", "de-AT", "de-CH", "de-DE", "dz", "el", "el-CY", "en", "en-AU", "en-CA", "en-CY", "en-GB", "en-IE", "en-IN", "en-NZ", "en-TT", "en-US", "en-ZA", "eo", "es", "es-419", "es-AR", "es-CL", "es-CO", "es-CR", "es-EC", "es-ES", "es-MX", "es-NI", "es-PA", "es-PE", "es-US", "es-VE", "et", "eu", "fa", "fi", "fr", "fr-CA", "fr-CH", "fr-FR", "fy", "gd", "gl", "he", "hi", "hi-IN", "hr", "hu", "hy", "id", "is", "it", "it-CH", "ja", "ka", "kk", "km", "kn", "ko", "lb", "lo", "lt", "lv", "mg", "mk", "ml", "mn", "mr-IN", "ms", "nb", "ne", "nl", "nn", "oc", "or", "pa", "pap-AW", "pap-CW", "pl", "pt", "pt-BR", "rm", "ro", "ru", "sc", "sk", "sl", "sq", "sr", "st", "sv", "sv-FI", "sv-SE", "sw", "ta", "te", "th", "tl", "tr", "tt", "ug", "uk", "ur", "uz", "vi", "wo", "zh-CN", "zh-HK", "zh-TW", "zh-YUE"]
To re-sync locales run:
crystal tool/sync_locales.cr
Contributing
- Fork it (https://github.com/mamantoha/humanize_time/fork)
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- mamantoha Anton Maminov - creator, maintainer
Special thanks
- rails-i18n community - Locale data
- Morgan Aubert - creator and maintainer of i18n an internationalization library for Crystal
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.12.3- Tagged
- Jun 29, 2026
- Commit
a699225dfb13- Indexed
- not yet
Dependents
Repository
github.com/mamantoha/humanize_time
Metadata
- Created
- Aug 12, 2026
- Updated
- Sep 24, 2026
- Synced
- Sep 24, 2026
- Versions
- 24