0.0.3 • Published 3 years ago

city-time v0.0.3

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

City Time

Usage

$ npm i city-time

Example

Basic method as follows

const citytime= require('city-time');
console.log(citytime.getTimeForCity('Colombo'))

The following is the output for above code

Sun Sep 05 2021 22:31:22 GMT+0530

getTimeForCity() function accpets two paramters 1. City Name (Required) 2. option (Optional)

Usage

const citytime= require('city-time');
console.log(citytime.getTimeForCity('Colombo',options={object=true}))

Object Property is false in default.But once you set it to true it will return a mooment.js object

The following is the output for above code

Moment<2021-09-05T22:42:58+05:30>
const citytime= require('city-time');
console.log(citytime.getTimeForCity('Colombo',options={format='YYYY'}))

The following is the output for above code

2021

format Property is empty in default.You can pass mooment js options to get the relevent format dates Available format :

YYYY: 4-digit year 
YY: 2-digit year 
MMMM: Full-length month 
MMM: 3 character month 
MM: Month of the year, zero-padded 
M: Month of the year 
DD: Day of the month, zero-padded 
D: Day of the month 
Do: Day of the month with numeric ordinal contraction 

Speiccla thanks for city-timezonescity-timezones