Git Product home page Git Product logo

timezone-picker's Introduction

timezone-picker

timezone-picker is the plugin to select and get timezone value of selected area from WorldMap.


Imgur

Installation and usage


npm install --save timezone-picker

Include the following lines of code in the section of your HTML.

<script type="text/javascript" src="[yourpath]/jquery.min.js"></script>
<script type="text/javascript" src="[yourpath]/timezone-picker.js"></script>

Select any dom element where you want to create map.

$(selector).timezonePicker();

Options


  • width : (type:number) Sets width of map.
  • height : (type:number) Sets height of map.
  • defaultCss : (type:boolean) No need to include css if it is true
  • hoverColor :(type:string) Shows color on hover
  • selectedColor :(type:string) Sets selected ** timezone** color
  • mapColor :(type:string) Sets map color
  • quickLink :(type:Array of string) Creates shortcuts to select zone ["IST","MST".......]
  • selectBox :(type:boolean) If it is set tofalse select box will not be created
  • showHoverText : (type:boolean) If it is set to false hover text will not be shown
  • hoverText: (type:function | string) text you want to show when you hover on map (works only if showHoverText is true)
  • mapHover : (type:string) by default it will show hovered polygon(area) on which mouse is pointed (value: timezone, country, zonename)
    • "timezone" : when you hover on map it will heighlight all are with same timezone
    • "country" : when you hover on map it will heighlight all are with same country code
    • "zonename" : when you hover on map it will heighlight all are with same zonename

Methods


.setValue(string,string)

First parameter takes timezone string for example: 'Asia/Kolkata' (zone name). Second parameter is optinal when 1st parameter is zonename

$(selector).data('timezonePicker').setValue('Asia/Kolkata')

When you want to pass offset value as 1st parameter 2nd parameter should be 'offset'

$(selector).data('timezonePicker').setValue('5.5','offset')

When you want to pass country code as 1st parameter 2nd parameter should be 'country'

$(selector).data('timezonePicker').setValue('IN','country')

.getValue()

It returns object containing timezone details of seleted area:

$(selector).data('timezonePicker').getValue()

Sameple returned Object

  [
    {
        "selected":true,
        "zonename":"IST",
        "offset":5.5,
        "pin":"361,115",
        "country":"LK",
        "timezone": "Asia/Colombo",
    },
    {
        "zonename":"IST",
        "offset":5.5,
        "pin": "373,94",
        "country":"IN",
        "timezone": "Asia/Kolkata",
    }
]

License


It is available under the MIT LICENSE

timezone-picker's People

Contributors

kevalbhatt avatar

Watchers

James Cloos avatar The Digital Orchard ๐Ÿ‡จ๐Ÿ‡ฆ 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.