Rework DisclosureDate check to match core code

Framework core uses Date.parse, so many date formats are valid.

There is no reason we shouldn't be using ISO 8601 dates.
This commit is contained in:
William Vu 2018-11-16 11:05:47 -06:00
parent a30403dbfe
commit 3dd47b34b0
1 changed files with 3 additions and 11 deletions

View File

@ -441,18 +441,10 @@ class Msftidy
# Check disclosure date format
if @source =~ /["']DisclosureDate["'].*\=\>[\x0d\x20]*['\"](.+)['\"]/
d = $1 #Captured date
begin
Date.parse($1) #Captured date
# Flag if overall format is wrong
if d =~ /^... (?:\d{1,2},? )?\d{4}$/
# Flag if month format is wrong
m = d.split[0]
months = [
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
]
error('Incorrect disclosure month format') if months.index(m).nil?
else
rescue ArgumentError
error('Incorrect disclosure date format')
end
else