1.3.1 • Published 4 years ago

@vybornyj/input-to-utc v1.3.1

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

publish npm version npm minified size license type coverage eslint prettier

I recommend using module on the server side to keep API keys private.

Required API Keys

Google Cloud (for Place Autocomplete API and Maps Geocode API)

https://cloud.google.com

Get \$200 in free usage for Maps, Routes, and Places every month

TimeZoneDB (for Get Time Zone API)

https://timezonedb.com/api

TimeZoneDB API is free for personal and non-commercial usage. There are no limits on how many queries you can make, but there is a rate limit where you can only send request to the server once per second. Additional queries will get blocked.

Install

npm i @vybornyj/input-to-utc

or

yarn add @vybornyj/input-to-utc

Usage

Step 1: Autocomplete City and Get cityId

import { autocompleteCity } from '@vybornyj/input-to-utc'

const GOOGLE_API_KEY = '000000000000000000000000000000000000000'
const city = 'Lond'

const cities: {city: string, cityId: string}[] = await autocompleteCity(GOOGLE_API_KEY, city)

Step 2: Get dateUTC by input date-time and cityId

import { calcDateUtc } from '@vybornyj/input-to-utc'

const GOOGLE_API_KEY = '000000000000000000000000000000000000000'
const TIMEZONEDB_API_KEY = '000000000000'
const cityId = cities[0].cityId
const year = '2027'
const month = '12'
const day = '31'
const hours = '23'
const minutes = '59'

const dateUTC: Date | null = await calcDateUtc(GOOGLE_API_KEY, TIMEZONEDB_API_KEY, cityId, { year, month, day, hours, minutes })
1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.2.1

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.3

4 years ago

0.1.0

4 years ago