Merge pull request #2004 from MycroftAI/feature/tweak-datetime-parse

Tweak English extract_datetime() parsing
pull/2006/head
Åke 2019-02-20 14:05:32 +01:00 committed by GitHub
commit d26650b143
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -634,7 +634,6 @@ def extract_duration_en(text):
not consumed in the parsing. The first value will not consumed in the parsing. The first value will
be None if no duration is found. The text returned be None if no duration is found. The text returned
will have whitespace stripped from the ends. will have whitespace stripped from the ends.
""" """
if not text: if not text:
return None return None
@ -1276,7 +1275,8 @@ def extract_datetime_en(string, dateNow, default_time):
((not daySpecified) or dayOffset < 1)): ((not daySpecified) or dayOffset < 1)):
# ambiguous time, detect whether they mean this evening or # ambiguous time, detect whether they mean this evening or
# the next morning based on whether it has already passed # the next morning based on whether it has already passed
if dateNow.hour < HH: if dateNow.hour < HH or (dateNow.hour == HH and
dateNow.minute < MM):
pass # No modification needed pass # No modification needed
elif dateNow.hour < HH + 12: elif dateNow.hour < HH + 12:
HH += 12 HH += 12