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

Improved LocalDateTime documentation #248

Closed
wants to merge 2 commits into from

Conversation

holgerbrandl
Copy link

Improved reasoning for missing date-time arithmetics and added an example

Improved reasoning for missing date-time arithmetics and added an example
core/common/src/LocalDateTime.kt Outdated Show resolved Hide resolved
core/common/src/LocalDateTime.kt Outdated Show resolved Hide resolved
Co-authored-by: ilya-g <ilya.gorbunov@jetbrains.com>
@holgerbrandl
Copy link
Author

I figured later that this is greatly documented in https://github.com/Kotlin/kotlinx-datetime#date--time-arithmetic but maybe extending the javadoc makes sense as well.

What I also tend to do in my projects is to bluntly cross reference the main documentation via hyperlinks from the java-doc to keep docs centralized while avoiding redundancy. For example https://github.com/holgerbrandl/kalasim/blob/master/src/main/kotlin/org/kalasim/Component.kt#L131. I still wonder about the best practice here.

@dkhalanskyjb
Copy link
Collaborator

What do you think about writing something like this instead?

* See the documentation [LocalDateTime.toInstant] for an explanation of problems with raw [LocalDateTime] values.

It's nice to have information discoverable, but I also think that it's better to write one good explanation and link to it from ten places instead of writing ten unrelated explanations.

Or maybe it would be better to write one good explanation in some place other than LocalDateTime.toInstant. Or maybe the explanation in LocalDateTime.toInstant is also not good enough. WDYT?

@holgerbrandl
Copy link
Author

Currently the actual explanation sits at https://github.com/Kotlin/kotlinx-datetime#date--time-arithmetic, but definitely, keeping it at once place with proper references is better.

@dkhalanskyjb
Copy link
Collaborator

I know, I'm the one who wrote the explanation ff43dd6. I agree with the spirit of this PR though, it would be nice for such things to be discoverable through KDoc only. The only question is, where to put the explanation in a systematic manner.

@dkhalanskyjb dkhalanskyjb added the documentation Improvements or additions to documentation label Feb 29, 2024
@dkhalanskyjb
Copy link
Collaborator

Superseded by #367.

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

Successfully merging this pull request may close these issues.

3 participants