diff options
| author | Scott Gasch <[email protected]> | 2021-09-10 13:23:31 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2021-09-10 13:23:31 -0700 |
| commit | 83c1e0d04fe2e78963c8b508e8b7d0ae03bfcb16 (patch) | |
| tree | dadcd5f5a9fbd50f468a0f07ee28963ca4a3cf54 /dateparse | |
| parent | 6f132c0342ab7aa438ed88d7c5f987cb52d8ca05 (diff) | |
Adding more tests, working on the test harness.
Diffstat (limited to 'dateparse')
| -rwxr-xr-x | dateparse/dateparse_utils.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/dateparse/dateparse_utils.py b/dateparse/dateparse_utils.py index e5e7e76..f354ad0 100755 --- a/dateparse/dateparse_utils.py +++ b/dateparse/dateparse_utils.py @@ -271,9 +271,9 @@ class DateParser(dateparse_utilsListener): return TimeUnit.MONTHS txt = orig.lower()[:3] if txt in self.day_name_to_number: - return(self.day_name_to_number[txt]) + return(TimeUnit(self.day_name_to_number[txt])) elif txt in self.delta_unit_to_constant: - return(self.delta_unit_to_constant[txt]) + return(TimeUnit(self.delta_unit_to_constant[txt])) raise ParseException(f'Invalid date unit: {orig}') def _figure_out_time_unit(self, orig: str) -> int: @@ -509,7 +509,7 @@ class DateParser(dateparse_utilsListener): unit = self.context['delta_unit'] dt = n_timeunits_from_base( count, - unit, + TimeUnit(unit), date_to_datetime(self.date) ) self.date = datetime_to_date(dt) @@ -890,7 +890,7 @@ class DateParser(dateparse_utilsListener): unit = self._figure_out_date_unit(unit) d = n_timeunits_from_base( count, - unit, + TimeUnit(unit), d) self.context['year'] = d.year self.context['month'] = d.month @@ -920,7 +920,7 @@ class DateParser(dateparse_utilsListener): unit = self._figure_out_date_unit(unit) d = n_timeunits_from_base( count, - unit, + TimeUnit(unit), d) self.context['year'] = d.year self.context['month'] = d.month |
