Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support millisecond/milliseconds in relativedelta #1175

Open
isVoid opened this issue Nov 1, 2021 · 3 comments · May be fixed by #1226
Open

Support millisecond/milliseconds in relativedelta #1175

isVoid opened this issue Nov 1, 2021 · 3 comments · May be fixed by #1226

Comments

@isVoid
Copy link

isVoid commented Nov 1, 2021

In python, I can add a timedelta specified with milliseconds to a datetime object.

In [7]: from datetime import datetime, timedelta
In [8]: dt = datetime(2018, 4, 9, 13, 37, 0)
In [12]: dt + timedelta(milliseconds=42)
Out[12]: datetime.datetime(2018, 4, 9, 13, 37, 0, 42000)

With relativedelta, this is not possible (for both arithmatic input or absolute replacement input)

In [13]: dt + relativedelta(millisecond=42)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-13-8e589d33a46f> in <module>
----> 1 dt + relativedelta(millisecond=42)

TypeError: __init__() got an unexpected keyword argument 'millisecond'

In [14]: dt + relativedelta(milliseconds=42)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-14-d64aff9f46cc> in <module>
----> 1 dt + relativedelta(milliseconds=42)

TypeError: __init__() got an unexpected keyword argument 'milliseconds'
@mariocj89
Copy link
Member

That's fair, we could add this for arithmetic input similar to how we support weeks.

@rahulbanerjee26
Copy link

Hi!

Is this issue up for grabs? I am interested in it

@mariocj89
Copy link
Member

Absolutely, take inspiration on how "weeks" work.

@stereodamage stereodamage linked a pull request Jul 25, 2022 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants