coords-timezone
v6.0.0
Published
A JavaScript library to calculate timezone information and local time based on latitude and longitude.
Downloads
648
Maintainers
Readme
Coords-Timezone
Coords-Timezone is a JavaScript library to calculate timezone information and local time based on latitude and longitude.
Installation
You can install the package using npm:
npm install coords-timezone
Example Usage
const timezoneCalculator = require('coords-timezone');
const latitude = 30.0444;
const longitude = 31.2357;
const formatOffset = 'hh:mm';
const info = timezoneCalculator.getTimezoneInfo(latitude, longitude, formatOffset);
console.log(`Timezone: ${info.timezone}, Current Offset: ${info.currentOffset}, Standard Offset: ${info.standardOffset}, DST: ${info.dst}, Abbreviation: ${info.abbreviation}, Local Time: ${info.current}`);
Offset Formats
Here are the available offset formats: | Format | Example | |--------|----------| | hh:mm | +02:00 | | hh | +02 | | h | +2 |
License
This project is licensed under the ISC License.