whois-parser icon indicating copy to clipboard operation
whois-parser copied to clipboard

Fix AFNIC parsers date format

Open itghlu opened this issue 6 years ago • 1 comments

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

itghlu avatar Apr 12 '19 22:04 itghlu

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.

jarthod avatar Nov 09 '21 13:11 jarthod