Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/parse-tzdata-coordinate
Parse a coordinate string in zone.tab format, e.g. `-2439+02555`
https://github.com/shinnn/parse-tzdata-coordinate
Last synced: 27 days ago
JSON representation
Parse a coordinate string in zone.tab format, e.g. `-2439+02555`
- Host: GitHub
- URL: https://github.com/shinnn/parse-tzdata-coordinate
- Owner: shinnn
- License: mit
- Created: 2016-06-15T09:45:25.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-31T10:53:48.000Z (about 6 years ago)
- Last Synced: 2024-10-11T22:25:50.162Z (about 1 month ago)
- Language: JavaScript
- Homepage: https://tonicdev.com/npm/parse-tzdata-coordinate
- Size: 23.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# parse-tzdata-coordinate
[![NPM version](https://img.shields.io/npm/v/parse-tzdata-coordinate.svg)](https://www.npmjs.com/package/parse-tzdata-coordinate)
[![Bower version](https://img.shields.io/bower/v/parse-tzdata-coordinate.svg)](https://github.com/shinnn/parse-tzdata-coordinate/releases)
[![Build Status](https://travis-ci.org/shinnn/parse-tzdata-coordinate.svg?branch=master)](https://travis-ci.org/shinnn/parse-tzdata-coordinate)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/parse-tzdata-coordinate.svg)](https://coveralls.io/github/shinnn/parse-tzdata-coordinate?branch=master)
[![dependencies Status](https://david-dm.org/shinnn/parse-tzdata-coordinate/status.svg)](https://david-dm.org/shinnn/parse-tzdata-coordinate)
[![devDependencies Status](https://david-dm.org/shinnn/parse-tzdata-coordinate/dev-status.svg)](https://david-dm.org/shinnn/parse-tzdata-coordinate?type=dev)Parse a coordinate string in [`zone.tab`](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) format
```javascript
import parseTzdataCoordinate from 'parse-tzdata-coordinate';parseTzdataCoordinate('+394606-0860929');
/*
=> {
latitude: {
sign: '+',
degree: 39,
minute: 46,
second: 6
},
longitude: {
sign: '-',
degree: 86,
minute: 9,
second: 29
}
}
*/
```## Installation
### [npm](https://www.npmjs.com/)
```
npm install parse-tzdata-coordinate
```### [Bower](https://bower.io/)
```
bower install parse-tzdata-coordinate
```## API
### parseTzdataCoordinate(*str*)
*str*: `String`
Return: `Object`It takes a string of time zone coordinates in [tz database](https://www.iana.org/time-zones) format:
> Latitude and longitude of the zone's principal location in [ISO 6709](https://www.iso.org/iso/catalogue_detail.htm?csnumber=39242) sign-degrees-minutes-seconds format, either `+-DDMM+-DDDMM` or `+-DDMMSS+-DDDMMSS`, first latitude (`+` is north), then longitude (`+` is east).
and returns an object in the form:
```
{
latitude: {
sign: ('+' or '-'),
degree: ,
minute: ,
[second: ] (if available)
},
longitude: {
sign: ('+' or '-'),
degree: ,
minute: ,
[second: ] (if available)
}
}
``````javascript
parseTzdataCoordinate('+394606-0860929');
/*
=> {
latitude: {
sign: '+',
degree: 34,
minute: 31
},
longitude: {
sign: '+',
degree: 69,
minute: 12
}
}
*/
```## License
Copyright (c) 2016 [Shinnosuke Watanabe](https://github.com/shinnn)
Licensed under [the MIT License](./LICENSE).