summaryrefslogtreecommitdiff
path: root/sample/goodfriday.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-09-18 04:48:51 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-09-18 04:48:51 +0000
commit7152df6b9b3b95d93607127d853c02e03e42a327 (patch)
tree988114e2435a507f4b00c7bd568adeed7c587243 /sample/goodfriday.rb
parent12494013d2dc8597924e30581fbf55feeb3290a4 (diff)
990918-repack
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/goodfriday.rb')
-rw-r--r--sample/goodfriday.rb19
1 files changed, 16 insertions, 3 deletions
diff --git a/sample/goodfriday.rb b/sample/goodfriday.rb
index cc541af..f0027ec 100644
--- a/sample/goodfriday.rb
+++ b/sample/goodfriday.rb
@@ -1,12 +1,25 @@
#! /usr/local/bin/ruby
# goodfriday.rb: Written by Tadayoshi Funaba 1998
-# $Id: goodfriday.rb,v 1.3 1999/08/04 14:54:18 tadf Exp $
+# $Id: goodfriday.rb,v 1.1 1998/03/08 09:44:44 tadf Exp $
require 'date2'
-require 'holiday'
-es = Date.easter(Date.today.year)
+def easter(y)
+ g = (y % 19) + 1
+ c = (y / 100) + 1
+ x = (3 * c / 4) - 12
+ z = ((8 * c + 5) / 25) - 5
+ d = (5 * y / 4) - x - 10
+ e = (11 * g + 20 + z - x) % 30
+ e += 1 if e == 25 and g > 11 or e == 24
+ n = 44 - e
+ n += 30 if n < 21
+ n = n + 7 - ((d + n) % 7)
+ if n <= 31 then [y, 3, n] else [y, 4, n - 31] end
+end
+
+es = Date.new3(*easter(Time.now.year))
[[-9*7, 'Septuagesima Sunday'],
[-8*7, 'Sexagesima Sunday'],
[-7*7, 'Quinquagesima Sunday (Shrove Sunday)'],