weppos / whois-parser

An intelligent — pure Ruby — WHOIS parser.
https://whoisrb.org
MIT License
99 stars 102 forks source link

Fix AFNIC parsers date format #119

Open itghlu opened 5 years ago

itghlu commented 5 years ago

Fix date parsing in AFNIC parsers as the format had changed from DD/MM/YYYY to YYYY-MM-DDThh:mm:ssZ (ISO 8601).

The parse_time method can handle this date format without pre-processing.

Original code would result in negative dates:

#!/usr/bin/env ruby

require 'bundler/setup'
require 'whois'
require 'whois-parser'

parser = Whois.lookup('1c2.fr').parser

2.3.1 :008 > parser.created_on
 => -2004-05-20 11:28:40 UTC
2.3.1 :009 > parser.updated_on
 => -2018-04-08 03:52:04 UTC
2.3.1 :010 > parser.expires_on
 => -2019-05-07 07:43:45 UTC
jarthod commented 2 years ago

I've hit this problem too, thanks for the fix @itghlu :bow: For the record I merged this into my fork: jarthod/whois-parser which is going to include many other updates so we can benefit from a more up-to-date version without cherry-picking everywhere.