Sha256: 68ae844bfceccd0f782ecda869cd632c0c88812cfbc3bf07b2e76fb0b7650b43

Contents?: true

Size: 1.69 KB

Versions: 3

Compression:

Stored size: 1.69 KB

Contents

{<img src="https://badge.fury.io/rb/timepiece.svg" alt="Gem Version" />}[http://badge.fury.io/rb/timepiece]

= Timepiece

Timepiece is a Rails plugin providing a simple digital clock, accurate to your server's time and maintained by jQuery.

== Installation

1. Add Timepiece to your application's Gemfile

    gem 'timepiece'

2. Require timepiece in app/assets/javascripts/application.js

    //= require timepiece

== Usage

* Add a functional clock to your views

    <%= timepiece %>

* Pass a timezone paramater (Defaults to 'UTC')

    <%= timepiece('London') %>

* Show a 12 hour clock by specifying its `type:` explicitly

    <%= timepiece('London', type: '12') %>

=== 12 Hour Clock Options

By default the 12 hour clock displays time without any leading character, in the format '1:23pm'. You can add either a zero, as present on the 24 hour clock, or a leading space character the size of a numerical digit - useful for keeping your clocks aligned. To achieve this, set the Timepiece's `lead:`

* To add a leading zero to hour values less than ten

    <%= timepiece('London', type: '12', lead: '0') %>

  or

    <%= timepiece('London', type: '12', lead: 'zero') %>

* To add a space character

    <%= timepiece('London', type: '12', lead: '_') %>

  or

    <%= timepiece('London', type: '12', lead: 'space') %>

You can apply your own styles to any part of the Timepiece clock. For instance, you can capitalize the AM/PM abbreviation by targeting the span with class 'timepiece-abbr'. By default, the abbreviations are displayed without punctuation. To add punctuation, you can specify it with the `abbr_sep:` option.

* Add punctuation to am/pm abbreviation

    <%= timepiece('London', type: '12', abbr_sep: '.') %>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
timepiece-0.1.7 README.rdoc
timepiece-0.1.6 README.rdoc
timepiece-0.1.5 README.rdoc