Code Monkey home page Code Monkey logo

tzdata-coordinate-regex's Introduction

tzdata-coordinate-regex

npm version Github Actions

A regular expression for time zone coordinates in zone.tab format

tzdataCoordinateRegex.test('+313200+0350542'); //=> true
tzdataCoordinateRegex.test('+3843-00908'); //=> true

Installation

Use npm.

npm install tzdata-coordinate-regex

API

import tzdataCoordinateRegex from 'tzdata-coordinate-regex';

tzdataCoordinateRegex

Type: RegExp

It matches time zone coordinates in tz database format:

Latitude and longitude of the zone's principal location in ISO 6709 sign-degrees-minutes-seconds format, either +-DDMM+-DDDMM or +-DDMMSS+-DDDMMSS, first latitude (+ is north), then longitude (+ is east).

tzdataCoordinateRegex.exec('+4254-07436');
/*=> [
  '+4254-07436',
  '+',
  '42',
  '54',
  undefined,
  '-',
  '074',
  '36',
  undefined,
  index: 0,
  input: '+4254-07436',
  groups: {
    latitudeSeconds: undefined,
    longitudeSeconds: undefined
  }
] */

tzdataCoordinateRegex.exec('-353916+1394441');
/*=> [
  '-353916+1394441',
  '-',
  '35',
  '39',
  '16',
  '+',
  '139',
  '44',
  '41',
  index: 0,
  input: '-353916+1394441',
  groups: {
    latitudeSeconds: '16',
    longitudeSeconds: '41'
  }
] */

License

ISC License © 2018 - 2019 Watanabe Shinnosuke

tzdata-coordinate-regex's People

Contributors

shinnn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.