GithubHelp home page GithubHelp logo

meteor-timezone's Introduction

Overview

This is a meteor package to help developers deal with users in different locations and displaying dates in their local timezone.

If you have users all over the world, it makes sense to store dates in a single timezone. GMT/UTC is generally the timezone of choice. This package is a simple way to capture your user's timezone and easily convert to and from GMT/UTC using the utility functions provided.

The package will capture the users local timezone once per session and store it in their User.profile document. Also provided is a utility function that will show a given javascript date object in the user's local timezone.

Installation

Install by typing meteor add em0ney:timezone

Usage

Just install and we'll start tracking your user's timezones straight away.

Use the timezone offset

Getter:

Timezone.getTimezoneOffset();
	> "+1000"

Convert GMT/UTC time to user's timezone:

Timezone.userTimeFromGMT(date);

Convert user time to GMT/UTCL

Timezone.userTimeToGMT(date);

On the server side, Timezone.checkTimezone() will return the timezone offset of the server.

meteor-timezone's People

Contributors

em0ney avatar

Watchers

 avatar  avatar  avatar

meteor-timezone's Issues

Support for audit-argument-checks and SimpleSchema

The idea of this package is good, but unfortunately it neither supports audit-argument-checks nor SimpleSchema. So if you're using one of them, it throws errors: SimpleSchema complains that the user profile schema does not contain the timezone field, and audit-argument-checks does complain that the method call does not check the input parameter.

SimpleSchema support can be added easily on the app side, and I think this should also be the duty of the app developer. Yet, it would be nice if the package docs stated which data format is used for the timezone (I think it's just a Number).

The audit-argument-checks problem, however, cannot be solved on the app side, since it has to be done in the method code. So I would recommend to add a check() in the method. For now, I will have to do a fork of this package to make it work in my app.

BTW: I was also missing a license information and a link from Atmosphere to Github.

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.