Module: Timezone::Parser::Zone::Until
- Defined in:
- lib/timezone/parser/zone/until.rb
Constant Summary collapse
- FORMATS =
[ '%Y %b', # 1900 Oct '%Y %b %e', # 1948 May 15 ]
Class Method Summary collapse
-
.parse(date) ⇒ Object
Tries to parse the date using FORMATS.
Class Method Details
.parse(date) ⇒ Object
Tries to parse the date using FORMATS. If parsing of one format fails (raises and ArgumentError) then try the next format.
Returns the millisecond value of date.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/timezone/parser/zone/until.rb', line 16 def self.parse(date) FORMATS.each do |format| begin return Time.strptime(date+' UTC', format+' %Z').to_i * 1_000 rescue ArgumentError next end end nil end |