davispuh / TimezoneParser

Library for parsing Timezone names and abbrevations to corresponding UTC offsets and much more
The Unlicense
39 stars 1 forks source link

TimezoneParser

Probably the best, most complete Timezone parsing library ever made!

Library for parsing Timezone names and abbreviations to corresponding UTC offsets and much more. Supports multiple languages.

Features

Input formats:

Output formats:

Installation

Add this line to your application's Gemfile:

gem 'TimezoneParser'

And then execute:

$ bundle

Or install it yourself as:

$ gem install TimezoneParser

Dependencies

Usage Example

To get UTC offsets from Timezone abbreviations

> require 'timezone_parser'
=> true
> offsets = TimezoneParser::Abbreviation.new('FKT').getOffsets
=> [-14400]
> offsets.first
=> -14400

Timezone name to Timezone identifier

> TimezoneParser::Timezone.new('Nord-Marianene-tid').getTimezones
=> ["Pacific/Saipan"]

Localized Windows zone to original Windows zone identifier

> TimezoneParser::WindowsZone.new('Jerusalem (normaltid)').getZone
=> "Israel Standard Time"

Find actual Timezones from uknown platform-dependent Ruby zone

> tz = Time.now.zone # on localized Windows
=> "FLE standarta laiks"
> TimezoneParser::getTimezones(tz)
=> ["Europe/Helsinki", "Europe/Kiev", "Europe/Mariehamn", "Europe/Riga", "Europe/Simferopol", "Europe/Sofia", "Europe/Tallinn", "Europe/Uzhgorod", "Europe/Vilnius", "Europe/Zaporozhye"]

Documentation

YARD with markdown is used for documentation (redcarpet required)

Specs

RSpec and simplecov are required, to run tests just rake spec code coverage will also be generated

Code status

Gem Version Build Status Coverage Status Code Climate

Other

Did you found this library useful? Tell about it Tweet #2FTimezoneParser

You can also Flattr FTimezoneParser

Unlicense

Copyright-Free

All text, documentation, code and files in this repository are in public domain (including this text, README). It means you can copy, modify, distribute and include in your own work/code, even for commercial purposes, all without asking permission.

About Unlicense

Contributing

Feel free to improve as you see.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Export .yaml data files to binary .dat with rake export
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

Warning: By sending pull request to this repository you dedicate any and all copyright interest in pull request (code files and all other) to the public domain. (files will be in public domain even if pull request doesn't get merged)

Also before sending pull request you acknowledge that you own all copyrights or have authorization to dedicate them to public domain.

If you don't want to dedicate code to public domain or if you're not allowed to (eg. you don't own required copyrights) then DON'T send pull request.