<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -32,6 +32,8 @@ Possible options are:
   * :hide_month_name: Hide the table header showing the month name. Defaults to false.
   * :use_full_day_names: Use full instead of abbreviated day names. Defaults to false.
   * :use_full_month_names: Use full instead of abbreviated month names. Defaults to true.
+  * :yield_surrounding_days: Defines whether or not days or the previous and next month are yielded to the passed block. Defaults to false.
+
   * :next_month: Defines if and how the next month should be displayed. See section &quot;Formatting the header section&quot; for further information.
   * :previous_month: Defines if and how the previous month should be displayed. See section &quot;Formatting the header section&quot; for further information.
   * :next_and_previous_month: Defines if and how the next and previous month should be displayed. See section &quot;Formatting the header section&quot; for further information.</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -72,8 +72,8 @@ module LaterDude
       options[:class] &lt;&lt; &quot; weekend&quot; if Calendar.weekend?(day)
       options[:class] &lt;&lt; &quot; today&quot; if day.today?
 
-      # block is only called for current month
-      if @block &amp;&amp; day.month == @days.first.month
+      # block is only called for current month or if :yield_surrounding_days is set to true
+      if @block &amp;&amp; (@options[:yield_surrounding_days] || day.month == @days.first.month)
         content, options_from_block = Array(@block.call(day))
 
         # passing options is optional
@@ -203,7 +203,8 @@ module LaterDude
           :current_month =&gt; I18n.translate(:'date.formats.calendar_header', :default =&gt; &quot;%B&quot;),
           :next_month =&gt; false,
           :previous_month =&gt; false,
-          :next_and_previous_month =&gt; false
+          :next_and_previous_month =&gt; false,
+          :yield_surrounding_days =&gt; false
         }
       end
     end</diff>
      <filename>lib/later_dude.rb</filename>
    </modified>
    <modified>
      <diff>@@ -190,7 +190,7 @@ class CalendarTest &lt; ActiveSupport::TestCase
 
   test &quot;highlights current day (= today)&quot; do
     Date.stubs(:current).then.returns(Date.civil(2009, 1, 14))
-    assert_match %r(&lt;td class=&quot;(.*)today(.*)&quot;&gt;14&lt;/td&gt;), LaterDude::Calendar.new(2009, 1).to_html
+    assert_match %r(&lt;td class=&quot;([^\&quot;]*)today([^\&quot;]*)&quot;&gt;14&lt;/td&gt;), LaterDude::Calendar.new(2009, 1).to_html
   end
 
   test &quot;shows special days as designated by a block&quot; do
@@ -209,13 +209,47 @@ class CalendarTest &lt; ActiveSupport::TestCase
 
     (Date.civil(2009, 1, 1)..Date.civil(2009, 1, -1)).each do |day|
       if day.day.even?
-        assert_match %r(&lt;td class=&quot;day(.*)specialDay&quot;&gt;&lt;a href=&quot;/calendar/#{day.year}/#{day.month}/#{day.day}&quot;&gt;#{day.day}&lt;/a&gt;&lt;/td&gt;), calendar_html
+        assert_match %r(&lt;td class=&quot;day([^\&quot;]*)specialDay&quot;&gt;&lt;a href=&quot;/calendar/#{day.year}/#{day.month}/#{day.day}&quot;&gt;#{day.day}&lt;/a&gt;&lt;/td&gt;), calendar_html
       else
-        assert_match %r(&lt;td class=&quot;day(.*)&quot;&gt;#{day.day}&lt;/td&gt;), calendar_html
-        assert_no_match %r(&lt;td class=&quot;day(.*)specialDay&quot;&gt;&lt;a href=&quot;/calendar/#{day.year}/#{day.month}/#{day.day}&quot;&gt;#{day.day}&lt;/a&gt;&lt;/td&gt;), calendar_html
+        assert_match %r(&lt;td class=&quot;day([^\&quot;]*)&quot;&gt;#{day.day}&lt;/td&gt;), calendar_html
+        assert_no_match %r(&lt;td class=&quot;day([^\&quot;]*)specialDay&quot;&gt;&lt;a href=&quot;/calendar/#{day.year}/#{day.month}/#{day.day}&quot;&gt;#{day.day}&lt;/a&gt;&lt;/td&gt;), calendar_html
       end
     end
   end
 
+  test &quot;yields days of surrounding months :yield_surrounding_days is set to true&quot; do
+    CalendarTest.send(:include, ActionView::Helpers)
+
+    # make it bold
+    special_days_proc = lambda { |day| &quot;&lt;b&gt;#{day.day}&lt;/b&gt;&quot; }
+
+    calendar_html = LaterDude::Calendar.new(2009, 4, { :yield_surrounding_days =&gt; true }, &amp;special_days_proc).to_html
+
+    # start of first week: 29 March 2009
+    # end of last week: 2 May 2009
+    surrounding_days = [Date.civil(2009, 3, 29), Date.civil(2009, 3, 30), Date.civil(2009, 3, 31), Date.civil(2009, 5, 1), Date.civil(2009, 5, 2)]
+    surrounding_days.each do |day|
+      assert_match %r(&lt;td class=&quot;day([^\&quot;]*)otherMonth([^\&quot;]*)&quot;&gt;&lt;b&gt;#{day.day}&lt;/b&gt;&lt;/td&gt;), calendar_html
+    end
+  end
+
+  test &quot;yields days of surrounding months :yield_surrounding_days isn't set to true&quot; do
+    CalendarTest.send(:include, ActionView::Helpers)
+
+    # make it bold
+    special_days_proc = lambda { |day| &quot;&lt;b&gt;#{day.day}&lt;/b&gt;&quot; }
+
+    calendar_html  = LaterDude::Calendar.new(2009, 4, &amp;special_days_proc).to_html
+    calendar_html2 = LaterDude::Calendar.new(2009, 4, { :yield_surrounding_days =&gt; false }, &amp;special_days_proc).to_html
+
+    # start of first week: 29 March 2009
+    # end of last week: 2 May 2009
+    surrounding_days = [Date.civil(2009, 3, 29), Date.civil(2009, 3, 30), Date.civil(2009, 3, 31), Date.civil(2009, 5, 1), Date.civil(2009, 5, 2)]
+    surrounding_days.each do |day|
+      assert_no_match %r(&lt;td class=&quot;day([^\&quot;]*)otherMonth([^\&quot;]*)&quot;&gt;&lt;b&gt;#{day.day}&lt;/b&gt;&lt;/td&gt;), calendar_html
+      assert_no_match %r(&lt;td class=&quot;day([^\&quot;]*)otherMonth([^\&quot;]*)&quot;&gt;&lt;b&gt;#{day.day}&lt;/b&gt;&lt;/td&gt;), calendar_html2
+    end
+  end
+
   # TODO: Should I do &quot;real&quot; output testing despite the good coverage of output-related methods? Testing HTML is tedious ...
 end
\ No newline at end of file</diff>
      <filename>test/calendar_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5e6a18cb1ed924b4cb06c3e51b1b8f38845f3f2e</id>
    </parent>
  </parents>
  <author>
    <name>Clemens Kofler</name>
    <email>clemens@railway.at</email>
  </author>
  <url>http://github.com/clemens/later_dude/commit/a8ff66d671fbb6fda031bf53a608649fa98ff4ac</url>
  <id>a8ff66d671fbb6fda031bf53a608649fa98ff4ac</id>
  <committed-date>2009-10-30T16:01:45-07:00</committed-date>
  <authored-date>2009-10-30T16:01:45-07:00</authored-date>
  <message>Include option to yield days of surrounding months to the passed block.</message>
  <tree>1abaa57d6ff848ed687671c4f1bbdfd6a6a3e066</tree>
  <committer>
    <name>Clemens Kofler</name>
    <email>clemens@railway.at</email>
  </committer>
</commit>
