Repository: alvinwan/timefhuman

Issue:
Error trying to process rule "duration_part":  'years' is an invalid keyword argument for __new__()
To reproduce, run the following:

```python
timefhuman("in 1 year")
```

Hints from issue comments:
@rafecolton: Same, I tried parsing `timefhuman('1 year ago')`. Would love support for this!@alvinwan: Thank you both @andrzej-pomirski-yohana and @rafecolton for commenting! Just added support for both 

Solution patch:
diff --git a/timefhuman/main.py b/timefhuman/main.py
index ffe632c..6353031 100644
--- a/timefhuman/main.py
+++ b/timefhuman/main.py
@@ -195,6 +195,10 @@ class tfhTransformer(Transformer):
             ('years', 'year', 'yrs', 'yr'),
         ):
             if duration_unit in group:
+                if group[0] == 'months':
+                    return tfhTimedelta.from_object(timedelta(days=30 * duration_number), unit=group[0])
+                if group[0] == 'years':
+                    return tfhTimedelta.from_object(timedelta(days=365 * duration_number), unit=group[0])
                 return tfhTimedelta.from_object(timedelta(**{group[0]: duration_number}), unit=group[0])
         raise NotImplementedError(f"Unknown duration unit: {data['duration_unit']}")
 


Test patch:
diff --git a/tests/test_e2e.py b/tests/test_e2e.py
index d827435..623df1f 100644
--- a/tests/test_e2e.py
+++ b/tests/test_e2e.py
@@ -62,6 +62,7 @@ import pytz
     ('30 minutes', [datetime.datetime(2018, 8, 4, 14, 30)]),
     ('30-40 mins', [(datetime.datetime(2018, 8, 4, 14, 30), datetime.datetime(2018, 8, 4, 14, 40))]),
     ('1 or 2 days', [[datetime.datetime(2018, 8, 5, 14, 0), datetime.datetime(2018, 8, 6, 14, 0)]]),
+    ('in 1 year', [datetime.datetime(2019, 8, 4, 14, 0)]), # gh#73
     
     # standard structured formats
     ('2022-12-27T09:15:01.002', [datetime.datetime(2022, 12, 27, 9, 15, 1, 2)]),  # fixes gh#31
@@ -108,6 +109,7 @@ def test_default(now, test_input, expected):
     ('awk', []),  # should *not become 'a week'
     ('a wk', [datetime.timedelta(days=7)]),
     ('thirty two hours', [datetime.timedelta(hours=32)]),
+    ('in 1 year', [datetime.timedelta(days=365)]), # gh#73
     
     # duration ranges and lists
     ('30-40 mins', [(datetime.timedelta(minutes=30), datetime.timedelta(minutes=40))]),