local_time_helper
Version, currently 0.2.04 versions
- 0.2.2latestMar 24, 2021
- 0.2.1not indexedMar 24, 2021
- 0.2.0not indexedMar 24, 2021
- 0.1.0not indexedMar 24, 2021
github.com/anamba/local_time_helper.cr
Crystal port of local_time view helper from local_time gem (https://github.com/basecamp/local_time)
Nothing has been indexed for 0.2.0 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:
local_time_helper:
github: anamba/local_time_helper.cr
version: ~> 0.2.0Then run:
shards installshard.yml
No shard.yml has been indexed for 0.2.0. 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.
local_time_helper.cr
Crystal implementation of view helper from https://github.com/basecamp/local_time, with one small Crystal-specific improvement to save you some typing (both kinds): a nil_message option (a string returned when the provided time argument is nil; typically something like "never", or just "").
Installation
Add this to your application's shard.yml:
dependencies:
local_time_helper:
github: anamba/local_time_helper.cr
Add the local-time js to your project using npm or yarn.
Usage
Made to be used with Amber, but will probably work fine in other situations. Require/include like other helpers.
require "local_time_helper"
include LocalTimeHelper
<%= local_time(Time.utc(2018, 11, 21, 6), format: "%B %e, %Y %l:%M%p") %>
produces:
<time data-format="%B %e, %Y %l:%M%P" data-local="time" datetime="2018-11-21T06:00:00Z">November 21, 2018 6:00am</time>
See specs for more helper usage examples. Note that Crystal's %p and %P are swapped, which makes plenty of sense, but is different from other implementations (including JavaScript and Ruby).
Development
It's not a complete implementation of everything the ruby gem does, just enough to get the specs to pass (translated the relevant tests from the original). Contributions welcome if it doesn't support the options you need.
Contributing
- Fork it (https://github.com/anamba/local_time_helper.cr/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
- anamba Aaron Namba - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.2.0- Tagged
- Mar 24, 2021
- Commit
d3c5f8de7ff6- Indexed
- not yet
Dependents
Repository
github.com/anamba/local_time_helper.cr
Metadata
- Created
- Aug 19, 2026
- Updated
- Oct 12, 2026
- Synced
- Oct 12, 2026
- Versions
- 4