aboutsummaryrefslogtreecommitdiffstats
path: root/lib/carlosgoce/calendar.rb
diff options
context:
space:
mode:
authorCarlos Goce <carlosgoce@gmail.com>2015-01-25 17:29:34 +0100
committerCarlos Goce <carlosgoce@gmail.com>2015-01-25 17:29:34 +0100
commit89f0e7ca8e4612904de5ff9b98a5de991a01b632 (patch)
treefff0e447fd548ecc3da7da1b3a010dd3ca7811b6 /lib/carlosgoce/calendar.rb
parent36d4411136969d56312533f95e7bedd53415138e (diff)
downloadpdf-calendars-89f0e7ca8e4612904de5ff9b98a5de991a01b632.tar.gz
pdf-calendars-89f0e7ca8e4612904de5ff9b98a5de991a01b632.tar.bz2
pdf-calendars-89f0e7ca8e4612904de5ff9b98a5de991a01b632.zip
Fix calendar blank spaces
Diffstat (limited to 'lib/carlosgoce/calendar.rb')
-rw-r--r--lib/carlosgoce/calendar.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/carlosgoce/calendar.rb b/lib/carlosgoce/calendar.rb
index 48f0071..4445d1f 100644
--- a/lib/carlosgoce/calendar.rb
+++ b/lib/carlosgoce/calendar.rb
@@ -29,9 +29,13 @@ module CarlosGoce
}
# Formatted days creation
- days_before_week_start = Date.new(@year, 1, h[1][:days].first).wday
- empty_days = [''] * (days_before_week_start - 1)
- h[month][:formatted_days] = empty_days + h[1][:days]
+ # @todo First day defaults to Sunday but I should be able to change it to Monday
+ day_of_week = Date.new(@year, month, h[1][:days].first).wday
+ # Fix to change to spanish
+ days_before_week_start = if day_of_week == 0 then 6 else day_of_week -1 end
+
+ empty_days = [''] * days_before_week_start
+ h[month][:formatted_days] = empty_days + h[month][:days]
end
end
}