0.0
No commit activity in last 3 years
No release in over 3 years
A jQuery plugin provides to display time in user's timezone.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.10
~> 10.0
>= 0
 Project Readme

usertime-rails

Build Status Coverage Status

A jQuery plugin provides to display time in user's timezone. (See usertime.js)

Dependencies

usertime.js requires moment.js library, please add this library first.

Installation

Add this line to your application's Gemfile:

gem 'usertime-rails'

And then execute:

bundle

Or install it yourself as:

gem install usertime-rails

Usage

Require Javascript

Add the following to /app/assets/javascripts/application.js:

//= require usertime

Helpers

You can use usertime_tag to wrap Time objects.

usertime_tag(Time.now)

It will output:

<usertime>1441099707000</usertime>

You can specify format:

usertime_tag(Time.now, :format => 'lll')

Output:

<usertime format="lll">1441099707000</usertime>

Notice this format is moment.format, not ruby format.

License

The gem is available as open source under the terms of the MIT License.

Contact

The project's website is located at https://github.com/emn178/usertime-rails
Author: Chen, Yi-Cyuan (emn178@gmail.com)