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:
parent
a30403dbfe
commit
3dd47b34b0
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue