Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

google_tz

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google_tz

  • 0.3.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

GoogleTZ

Get timezone information for a location from the Google Timezone API using the locations latitude, longitude, and optionally a timestamp, sensor, and language.

Installation

gem install google_tz

Usage

Require

require 'google_tz'

Lookup

# Lookup timezone information on a location using latitude and longitude.
GoogleTZ.lookup(39.7392, -104.9847)

# Lookup timezone information on a location using latitude, longitude, timestamp, and language
GoogleTZ.lookup(39.7392, -104.9847, timestamp: 1377891332, language: "es")

Response

# Seeing if the Google API call was a success.
resp = GoogleTZ.lookup(39.7392, -104.9847)
resp.success?
  => true

# Getting data out of the lookup response object.
resp = GoogleTZ.lookup(39.7392, -104.9847)
resp.data
  => {"dstOffset"=>3600, "rawOffset"=>-25200, "status"=>"OK", "timeZoneId"=>"America/Denver", "timeZoneName"=>"Mountain Daylight Time"}

# Get daylight saving time offset 
resp.dst_offset
  => 3600 

# Get the raw time zone offset
resp.raw_offset
  => -25200 

# Get the status of the google api call
resp.status
  => "OK" 

# Get the time zone id
resp.timezone_id
  => "America/Denver" 

# Get the time zone name
resp.timezone_name 
  => "Mountain Daylight Time" 

FAQs

Package last updated on 05 Sep 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc