Sha256: 8191777dc3f1e7adcc6a85cda1adcc33abfac7835d21d6a464673cff8aefcbda
Contents?: true
Size: 661 Bytes
Versions: 3
Compression:
Stored size: 661 Bytes
Contents
require 'timezone/parser/zone' require 'time' # Responsible for parsing the UNTIL value of a TZData zone entry. module Timezone::Parser::Zone module Until FORMATS = [ '%Y %b', # 1900 Oct '%Y %b %e', # 1948 May 15 ] # 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. 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 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
timezone-0.3.2 | lib/timezone/parser/zone/until.rb |
timezone-0.3.1 | lib/timezone/parser/zone/until.rb |
timezone-0.3.0 | lib/timezone/parser/zone/until.rb |