https://github.com/riboseinc/tzinfo_js
Pure-JS TZInfo Rails Gem
https://github.com/riboseinc/tzinfo_js
javascript-library rails timezone-library
Last synced: about 2 months ago
JSON representation
Pure-JS TZInfo Rails Gem
- Host: GitHub
- URL: https://github.com/riboseinc/tzinfo_js
- Owner: riboseinc
- License: mit
- Created: 2017-06-06T09:58:10.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-10-17T06:00:42.000Z (over 1 year ago)
- Last Synced: 2025-04-11T03:49:00.129Z (about 2 months ago)
- Topics: javascript-library, rails, timezone-library
- Language: JavaScript
- Homepage:
- Size: 1 MB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
= tzinfo_js
ifdef::env-github[]
image:https://github.com/riboseinc/tzinfo_js/actions/workflows/Ruby.yml/badge.svg[
GitHub Workflow Status, link="https://github.com/riboseinc/tzinfo_js/actions/workflows/Ruby.yml"]
endif::[]== NOTE
Rails only supports tzinfo gem of versions ~0.3.38. 1.0+ is not
supported.This gem supports both 0.3.38+ and 1.0+. The major difference is in 1.0+
data definitions are included in a separate gem, tzinfo-data.== Installation
Add `tzinfo_js` to your Gemfile:
[source,ruby]
----
gem 'tzinfo_js', github: 'riboseinc/tzinfo_js'
----== Usage with Rails
`tzinfo_js` provides `.js` file per TZInfo timezone, such as
`America/New_York.js`.[source,ruby]
----
<%= javascript_include_tag "tzinfo_js/tzinfo.js" %>
<%= javascript_include_tag "tzinfo_js/definitions/#{tzinfo_identifier}.js" %>
----Run `TzinfoJs::Registry.instance.zone_map` to obtain a map from all
TZInfo zone names to their corresponding TzinfoDefinition class (with
their offsets and transitions). The resulting hash also maps
`linked_zones` to the correct zone information, so you will have
multiple zone names linking to the same zone definition classes.[source,ruby]
----
TzinfoJs::Registry.instance.zone_map
=> {"Africa/Asmera"=>#, "Africa/Juba"...}
----== Updating timezone definitions
Simply run from this gem's path:
----
rake tzinfo_js:generate
----== Requirements
`tzinfo_js` requires the `tzinfo` gem and Rails 3.2 or later.
== Running Tests
TODO
== License
The gem is available as open source under the terms of the
http://opensource.org/licenses/MIT[MIT License].