Socket
Socket
Sign inDemoInstall

ngx-google-time-zone

Package Overview
Dependencies
5
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ngx-google-time-zone

Angular service for Google's Time Zone API.


Version published
Maintainers
1
Install size
118 kB
Created

Readme

Source

NgxGoogleTimeZone

Angular service for Google's Time Zone API.

w3soto

StackBlitz Demo

Official Google Time Zone API documentation

Installation

npm -i ngx-google-time-zone

Example

For more details see projects/demo application

import { NgxGoogleTimeZoneModule } from "ngx-google-time-zone";
...

@NgModule({
  imports: [
    ...,
    NgxGoogleTimeZoneModule.forRoot({
      apiKey: '---GOOGLE-API-KEY---'
    }),
  ],
  ...
})
class AppModule { ... }

Usage

import { NgxGoogleTimeZoneService } from "ngx-google-time-zone";

@Component({
  ...
})
class AppComponent { 
  
  constructor(
    private _gtz: NgxGoogleTimeZoneService
  ) {}
  
  getTimeZone() {
    this._gtz.getTimeZone({
      lat: 48.743551, 
      lng: 18.914176
    }).subscribe(resp => console.log('TimeZoneResponse:', resp));
  }
  
}

Services

  • NgxGoogleTimeZoneService
getTimeZone(tzReq: TimeZoneRequest): Observable<TimeZoneResponse>

Interfaces

  • TimeZoneRequest
export interface TimeZoneRequest {
  lat: number,
  lng: number,
  timestamp?: number, // in seconds
  language?: string,
  apiKey?: string // if not provided with NgxGoogleTimeZoneModule.forRoot(...)
}
  • TimeZoneResponse
export interface TimeZoneResponse {
  dstOffset: number,
  rawOffset: number,
  status: TimeZoneStatus,
  timeZoneId: string,
  timeZoneName: string,
}
  • TimeZoneStatus
export type TimeZoneStatus = 'OK' | 'ZERO_RESULTS' | 'OVER_DAILY_LIMIT' | 'OVER_QUERY_LIMIT' | 'REQUEST_DENIED' |
  'INVALID_REQUEST' | 'UNKNOWN_ERROR';

Keywords

FAQs

Last updated on 06 Feb 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc