2.0.0 • Published 4 years ago

canadian-city-timezones v2.0.0

Weekly downloads
198
License
MIT
Repository
github
Last release
4 years ago

Usage

npm install canadian-city-timezones

import {find} from 'canadian-city-timezones';

const result = await find((city, province) => city === 'Lethbridge' && province === 'Alberta');
result.city // Lethbridge
result.province // Alberta
result.timezone // America/Edmonton

API

Methods

find(predicate: (value: TimezoneResult) => boolean): Promise<TimezoneResult | null>

Returns the first matching result for the given predicate.

filter(predicate: (value: TimezoneResult) => boolean): AsyncGenerator<TimezoneResult>

Yields all matching results for the given predicate.

values(): AsyncGenerator<TimezoneResult>

Yields all values.

Interfaces

TimezoneResult

{
  city: string;
  province: string;
  timezone: string;
}

Development

Timezones are generated automatically by pulling the list of areas from gc.ca and feeding them into mapbox.com to get their coordinates, then getting the timezone using geo-tz.

2.0.0

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago