diff --git a/maya/core.py b/maya/core.py index 35dec43..19b34e2 100644 --- a/maya/core.py +++ b/maya/core.py @@ -675,7 +675,7 @@ def now(): return MayaDT(epoch=epoch) -def when(string, timezone='UTC', prefer_past=None): +def when(string, timezone='UTC', prefer_dates_from='current_period'): """"Returns a MayaDT instance for the human moment specified. Powered by dateparser. Useful for scraping websites. @@ -693,13 +693,9 @@ def when(string, timezone='UTC', prefer_past=None): 'TIMEZONE': timezone, 'RETURN_AS_TIMEZONE_AWARE': True, 'TO_TIMEZONE': 'UTC', + 'PREFER_DATES_FROM': prefer_dates_from, } - if prefer_past is False: - settings['PREFER_DATES_FROM'] = 'future' - if prefer_past is True: - settings['PREFER_DATES_FROM'] = 'past' - dt = dateparser.parse(string, settings=settings) if dt is None: raise ValueError('invalid datetime input specified.')