ThreeTen / threeten

This project was the home of code used to develop a modern date and time library for JDK8. Development has moved to OpenJDK and a separate backport project, threetenbp.
http://threeten.github.io/
191 stars 37 forks source link

LocalDate.ofEpochDate() should specify the TimeZone used. #355

Closed niclash closed 7 years ago

niclash commented 7 years ago

IIUIC, the LocalDate.ofEpochDay() uses UTC time zone for computing the localdate and not the system default timezone, nor does it allow a time zone to be provided.

This is probably an oversight either in the thinking (no days are not time zone dependent - wrong) or oversight in documenting what is exactly happening.

I am simply suggesting that the Javadoc is updated to state that UTC is used, which could go into a patch release.

jodastephen commented 7 years ago

This is a misunderstanding. As per the docs, EPOCH_DAY is a local value, where no time-zone is involved. As such, conversion from a local epoch day to a LocalDate requires no time-zone (they are using the same local time-line). UTC is not relevant to the conversion, thus not mentioned.

niclash commented 7 years ago

Ok, I acknowledge that ofEpochDay() does what it is supposed to do. BUT for future reference this is "poor name choice", since it varies in definition from ofEpochMillis(). Intuitively, most of us would assume that there is >0 epochMillis/epochSeconds in an epochDay. so to speak, but the former are defined differently than the latter. I also realize that it is too late to change now. Thanks for the quick RTFM response, Stephen. I should have assumed that you were right all along.