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

Error handling fractional seconds? #75

Open
liavkoren opened this issue Nov 27, 2015 · 1 comment
Open

Error handling fractional seconds? #75

liavkoren opened this issue Nov 27, 2015 · 1 comment

Comments

@liavkoren
Copy link

It's possible I'm missing something here, but it seems like Delorean doesn't handle fractional seconds correctly in the next_second/last_second methods:

In [115]: dt
Out[115]: datetime.datetime(2015, 1, 1, 0, 0)

In [116]: d = Delorean(dt, timezone='utc')

In [117]: d.next_second(0.5).datetime
Out[117]: datetime.datetime(2015, 1, 1, 0, 0, tzinfo=<UTC>)

In [118]: _.microsecond
Out[118]: 0

In [119]: dt + relativedelta(seconds=0.5)
Out[119]: datetime.datetime(2015, 1, 1, 0, 0, 0, 500000)

Fractional days do seem to work:

In [124]: d.next_day(0.7390)
Out[124]: Delorean(datetime=2015-01-01 17:44:09.600000+00:00, timezone=utc)

BTW, really enjoying the package so far, it's made the code I've been writing an order of magnitude better.

@liavkoren
Copy link
Author

Also seems to be an issue with next_hour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant