Giter VIP home page Giter VIP logo

craft-worldtime's Introduction

Craft WorldTime.io plugin

Uses WorldTime.io to fetch timezone information about the visitors ip. If a valid IP address can't be detected, it tries to look it up through selize.com

Usage

{% set timestats = craft.worldtime.ipToTime() %}

<p>
    Country: {{ timestats.location.region }}<br/>
    Local time: {{ timestats.summary.local }}<br/>
</p>

Example return:

{
  "current": {
    "abbreviation": "GMT",
    "description": "Greenwich Mean Time",
    "utcOffset": "+6:30",
    "effectiveUntil": "2012-03-25 01:00:00",
    "isDst": true
  },
  "location": {
    "latitude": 51.02314,
    "longitude": -0.13343543,
    "region": "United Kingdom"
  },
  "summary": {
    "hasDst": true,
    "local": "2011-11-24 18:40:13",
    "utc": "2011-11-24 18:40:13"
  },
  "url": "http://worldtimeengine.com/current/51.02314_-0.13343543",
  "version": 1.2,
  "next": {
    "abbreviation": "GMT",
    "description": "Greenwich Mean Time",
    "utcOffset": "+6:30",
    "effectiveUntil": "2012-03-25 01:00:00",
    "isDst": true
  }
}

You may also define a IP address to look up:

{% set timestats = craft.worldtime.ipToTime('216.58.209.142') %}

craft-worldtime's People

Contributors

sjelfull avatar

Stargazers

Mario Pizzinini avatar mig avatar Luiz Boaretto avatar

Watchers

 avatar James Cloos avatar mig avatar

craft-worldtime's Issues

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.