Newline Proliferating Maniac

    canadian-city-timezones
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.0 • Public • Published

    Canadian City Timezones

    Searchable timezones for all Canadian cities, towns, townships, villages, hamlets, and municipalities.

    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.

    Install

    npm i canadian-city-timezones

    DownloadsWeekly Downloads

    23

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    75.9 kB

    Total Files

    6

    Last publish

    Collaborators

    • botovance