Class: Date
- Inherits:
-
Object
- Object
- Date
- Defined in:
- lib/wareki/std_ext.rb
Constant Summary collapse
- JAPAN =
Wareki::GREGORIAN_START
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
._wareki_parse_orig ⇒ Object
24 |
# File 'lib/wareki/std_ext.rb', line 24 alias_method :_wareki_parse_orig, :parse |
.parse(str, comp = true, start = ::Date::ITALY) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/wareki/std_ext.rb', line 25 def parse(str, comp = true, start = ::Date::ITALY) begin Wareki::Date.parse(str).to_date(start) rescue => e ::Date._wareki_parse_orig(str, comp, start) end end |
Instance Method Details
#_wareki_strftime_orig ⇒ Object
14 |
# File 'lib/wareki/std_ext.rb', line 14 alias_method :_wareki_strftime_orig, :strftime |
#strftime(format = "%F") ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/wareki/std_ext.rb', line 15 def strftime(format = "%F") if format.index("%J") to_wareki_date.strftime(format) else _wareki_strftime_orig(format) end end |
#to_wareki_date ⇒ Object
10 11 12 |
# File 'lib/wareki/std_ext.rb', line 10 def to_wareki_date Wareki::Date.jd(self.jd) end |