dater 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/dater.rb +14 -4
- data/lib/dater/version.rb +1 -1
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/lib/dater.rb
CHANGED
@@ -30,12 +30,22 @@ module Dater
|
|
30
30
|
else
|
31
31
|
if period.include?('/')
|
32
32
|
date=period.split('/')
|
33
|
-
|
34
|
-
|
33
|
+
if @format.include? '-'
|
34
|
+
return date.join('-') if date.first.size==4
|
35
|
+
return "#{date[2]}-#{date[1]}-#{date[0]}"
|
36
|
+
else
|
37
|
+
return date.join('/') if date.first.size==4
|
38
|
+
return "#{date[2]}/#{date[1]}/#{date[0]}"
|
39
|
+
end
|
35
40
|
elsif period.include?('-')
|
36
41
|
date=period.split('-')
|
37
|
-
|
38
|
-
|
42
|
+
if @format.include? '-'
|
43
|
+
return date.join('-') if date.first.size==4
|
44
|
+
return "#{date[2]}-#{date[1]}-#{date[0]}"
|
45
|
+
else
|
46
|
+
return date.join('/') if date.first.size==4
|
47
|
+
return "#{date[2]}/#{date[1]}/#{date[0]}"
|
48
|
+
end
|
39
49
|
elsif (amount=period.scan(/\d+/)).size>0
|
40
50
|
case @lang
|
41
51
|
when 'es'
|
data/lib/dater/version.rb
CHANGED