Skip to content

fix: DateTime.add/3 :nanosecond precision error#34

Open
ceolinrenato wants to merge 3 commits intomathieuprog:masterfrom
ceolinrenato:master
Open

fix: DateTime.add/3 :nanosecond precision error#34
ceolinrenato wants to merge 3 commits intomathieuprog:masterfrom
ceolinrenato:master

Conversation

@ceolinrenato
Copy link

Steps to reproduce:

DateTime.add(DateTime.utc_now(), 1_000, :nanosecond, Tz.TimeZoneDatabase)

(added a test that reproduces it)

@ceolinrenato
Copy link
Author

@mathieuprog 7f2fbb3 generalizes the conversion, but it looks like elixir uses microsecond precision by default and there's no higher precision than nanoseconds. So I'm not sure which solution is better, as not using constants for this could lead into weird behaviours

we can revert 7f2fbb3 if you agree

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

Successfully merging this pull request may close these issues.

1 participant