lib/calendar_sniper.rb in calendar_sniper-1.0.4 vs lib/calendar_sniper.rb in calendar_sniper-1.1.0
- old
+ new
@@ -55,13 +55,13 @@
def date_format_for_string(str)
if /^\d{1,2}\/\d{1,2}\/\d{4}/ =~ str
'%m/%d/%Y'
elsif /^\d{4}-\d{1,2}-\d{1,2}/ =~ str
- if /^\d{4}-\d{1,2}-\d{1,2} \S+/ =~ str
- '%Y-%m-%d %Z'
- elsif /^\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{2}:\d{2}+/ =~ str
+ if /^\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{2}:\d{2}+/ =~ str
'%Y-%m-%d %k:%M:%S'
+ elsif /^\d{4}-\d{1,2}-\d{1,2} \S+/ =~ str
+ '%Y-%m-%d %Z'
else
'%Y-%m-%d'
end
else
raise "Date string in unknown format: #{str}"