From 3dd47b34b0bf6643125ec177b41a27ff8be5950b Mon Sep 17 00:00:00 2001 From: William Vu Date: Fri, 16 Nov 2018 11:05:47 -0600 Subject: [PATCH] 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. --- tools/dev/msftidy.rb | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/tools/dev/msftidy.rb b/tools/dev/msftidy.rb index 6260f5e8fc..18f391a484 100755 --- a/tools/dev/msftidy.rb +++ b/tools/dev/msftidy.rb @@ -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