Calendar-generating plugin for Ruby
Ruby CSS Shell
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
app/assets/stylesheets/calendar_styles add ability to display week numbers May 2, 2013
lib Update VERSION in CalendarHelper to match 0.2.6. Dec 26, 2014
test add ability to display week numbers May 2, 2013
.rvmrc RVM environment for test and development. Apr 4, 2011
.travis.yml add travis build config Mar 7, 2012
Gemfile added a Gemfile for convenience Mar 2, 2012
History.rdoc re-added the changelog Mar 7, 2012
MIT-LICENSE First import Nov 10, 2008
README.rdoc added travis build status image to README Mar 9, 2012
Rakefile Repackge Gem to use current fashonable tools. Mar 7, 2012
calendar_helper.gemspec bumping version number Jun 24, 2013
init.rb First import Nov 10, 2008



Build Status


A simple helper for creating an HTML calendar. The “calendar” method will be automatically available to your Rails view templates, or can be used with Sinatra or other webapps.

Some example stylesheets are provided via the Rails asset pipeline. Add to your main stylesheet with one of the following:

 *= require 'calendar_styles/grey'
 *   OR
 *= require 'calendar_styles/red'
 *   OR
 *= require 'calendar_styles/blue'


# Simple
calendar(:year => 2005, :month => 6)

# Set table class
calendar({:year => 2005, :month => 6, :table_class => "calendar_helper"})

# Full featured
calendar(:year => 2005, :month => 5) do |d| # This generates a simple calendar, but gives special days
  if listOfSpecialDays.include?(d)          # (days that are in the array listOfSpecialDays) one CSS class,
    [d.mday, {:class => "specialDay"}]      # "specialDay", and gives the rest of the days another CSS class,
  else                                      # "normalDay". You can also use this highlight today differently
    [d.mday, {:class => "normalDay"}]       # from the rest of the days, etc.

If using with ERb (Rails), put in a printing tag.

<%= calendar(:year => @year, :month => @month, :first_day_of_week => 1) do |d|

With Haml, use a helper to set options for each cell.

= calendar(:year => @year, :month => @month, :first_day_of_week => 1) do |d|
  - render_calendar_cell(d)

In Sinatra, include the CalendarHelper module in your helpers:

helpers do
  include CalendarHelper

Accessibility & 508 Compliance:

  • The table tag has a summary attribute (overridable).

  • Each th has an id.

  • Each td as a headers attribute, containing the element id of the appropriate th.


Jeremy Voorhis – Original implementation

Geoffrey Grosenbach – Test suite and conversion to a Rails plugin



See the RDoc (or use “rake rdoc”).

To copy the CSS files, use

./script/generate calendar_styles

CSS will be copied to subdirectories of public/stylesheets/calendar.