ethiopic_date 0.0.16 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ethiopic_date.rb +11 -17
- data/lib/ethiopic_date/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 87e89fb624c31dc1070c0d2f035e8ff187ec897c
|
|
4
|
+
data.tar.gz: 751642d22b8eb6cefa999107532f1dd1ac85d3b8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7fe7a373ffbe0f8b425a4128eeb86b94551a0314d34c7fb38293b6899e0e7f06a2713cfc54c383fcebc022131cab02b47b4b1571a38949f4618613366d96913e
|
|
7
|
+
data.tar.gz: 9c2b7fafa46e658786d9396b61fd64f7cee16600cffb4bc3686d990ca097ff95511f5ee898456302a2387e9c00974e8dfc8ec4feededec6db24ece635629e426
|
data/lib/ethiopic_date.rb
CHANGED
|
@@ -47,17 +47,10 @@ module EthiopicDate
|
|
|
47
47
|
#Changes from in_date:GregorianDate to EthiopicDate
|
|
48
48
|
#
|
|
49
49
|
#@api public
|
|
50
|
-
#@param year,month,
|
|
50
|
+
#@param year,month,day in that order
|
|
51
51
|
#@return EthiopicDate is returned
|
|
52
52
|
#@example fromEthiopicToGregorian(2012,5,21)
|
|
53
53
|
def fromGregorianToEthiopic(year,month,day)
|
|
54
|
-
#TODO : Handle Exceptions when there is a wrong input
|
|
55
|
-
year=year
|
|
56
|
-
month=month
|
|
57
|
-
day=day
|
|
58
|
-
date = Date.new(year,month,day)
|
|
59
|
-
dayName = date.strftime('%A')
|
|
60
|
-
ethiopic_date = {:year=>-1,:month=>-1,:day => -1,:dayName=> dayName }
|
|
61
54
|
jdn = jdn_from_gregorian(year,month,day)
|
|
62
55
|
if jdn >=JD_EPOCH_OFFSET_AMETE_MIHRET + 365
|
|
63
56
|
era= JD_EPOCH_OFFSET_AMETE_MIHRET
|
|
@@ -66,11 +59,11 @@ module EthiopicDate
|
|
|
66
59
|
end
|
|
67
60
|
r = (jdn - era).modulo(1461)
|
|
68
61
|
n = (r.modulo(365) ) + (365 * (r/1460 ))
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
eyear = 4 * ((jdn - era)/1461) + r/365 - r/1460
|
|
63
|
+
emonth = (n/30) + 1
|
|
64
|
+
eday = (n.modulo(30)) + 1
|
|
72
65
|
|
|
73
|
-
return
|
|
66
|
+
return "#{eyear}/#{emonth}/#{eday}"
|
|
74
67
|
end
|
|
75
68
|
|
|
76
69
|
|
|
@@ -80,11 +73,12 @@ module EthiopicDate
|
|
|
80
73
|
#@return a formated Ethiopic date string
|
|
81
74
|
#@example ethiopic_date_format('2004-5-21') will be ጥር 21 ቀን 2004ዓ/ም
|
|
82
75
|
def ethiopic_date_format(ethiopic_date)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
d = ethiopic_date.split('/')
|
|
77
|
+
year = d[0]
|
|
78
|
+
month = d[1]
|
|
79
|
+
day = d[2]
|
|
80
|
+
day = day.to_s.length < 2 ? '0' << day.to_s : day
|
|
81
|
+
return "#{AmharicMonths[month.to_s]} #{day}, #{year}"
|
|
88
82
|
end
|
|
89
83
|
|
|
90
84
|
private
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ethiopic_date
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.17
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- G/yohannes Zenebe
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2015-08-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Simple gem to convert between Ethiopian and Gregorian dates
|
|
14
14
|
email:
|
|
@@ -17,7 +17,7 @@ executables: []
|
|
|
17
17
|
extensions: []
|
|
18
18
|
extra_rdoc_files: []
|
|
19
19
|
files:
|
|
20
|
-
- .gitignore
|
|
20
|
+
- ".gitignore"
|
|
21
21
|
- Gemfile
|
|
22
22
|
- LICENSE.txt
|
|
23
23
|
- README.md
|
|
@@ -34,17 +34,17 @@ require_paths:
|
|
|
34
34
|
- lib
|
|
35
35
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
|
-
- -
|
|
37
|
+
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
39
|
version: '0'
|
|
40
40
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
41
41
|
requirements:
|
|
42
|
-
- -
|
|
42
|
+
- - ">="
|
|
43
43
|
- !ruby/object:Gem::Version
|
|
44
44
|
version: '0'
|
|
45
45
|
requirements: []
|
|
46
46
|
rubyforge_project:
|
|
47
|
-
rubygems_version: 2.
|
|
47
|
+
rubygems_version: 2.4.5
|
|
48
48
|
signing_key:
|
|
49
49
|
specification_version: 4
|
|
50
50
|
summary: Ethiopian date to Gregorian and Vice versa convertor
|