time_in_words
Version, currently master branch1 version
- master branchlatestSep 18, 2026
github.com/crystal-china/time_in_words
No description declared in shard.yml.
1 stars
1 dependent
License: MIT
Installation
# Add this to your shard.yml
dependencies:
time_in_words:
github: crystal-china/time_in_words
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 1.16.0- License
- MIT
- Author
- Billy.Zheng
Dependencies
This version declares no dependencies.
README
time_in_words
All code stolen from lucky framework time_helpers, but added the Chinese support.
Only EN and ZH_CN supported for now, PR is welcome.
The locale name will follow name in this file.
Installation
-
Add the dependency to your
shard.yml:dependencies: time_in_words: github: crystal_china/time_in_words -
Run
shards install
Usage
require "time_in_words"
alias TimeHelper = TimeInWords::Helpers(TimeInWords::I18n::ZH_CN)
TimeHelper.from(past_time: Time.local - 13.months) # => "大约一年前"
from_time = Time.local
TimeHelper.distance(from: from_time, to: from_time + 50.minutes) # => "大约一个小时前"
TimeHelper.distance(from: from_time, to: from_time + 35.minutes) # => "35 分钟前"
span = 4.minutes
TimeHelpers.distance(span: span) # => "四分钟前"
Check the time_in_words_en_spec.cr for usage about English time words.
Development
TODO: Write development instructions here
Contributing
- Fork it (https://github.com/zw963/time_in_words/fork)
- Run
maketo ensure spec passed. - Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Run
makeagain to ensure spec passed. - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Billy.Zheng - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Sep 18, 2026
- Crystal
>= 1.16.0- Indexed
- yes
Dependents
Repository
github.com/crystal-china/time_in_words
Metadata
- Created
- Aug 19, 2026
- Updated
- Oct 12, 2026
- Synced
- Oct 12, 2026
- Versions
- 1