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

Missing LocalTime converters #894

Open
Jolanrensen opened this issue Sep 27, 2024 · 5 comments
Open

Missing LocalTime converters #894

Jolanrensen opened this issue Sep 27, 2024 · 5 comments
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation (not KDocs) enhancement New feature or request good first issue Good issues to pick-up for newcomers
Milestone

Comments

@Jolanrensen
Copy link
Collaborator

As discovered by #887 (comment), we're missing some converters from kotlinx/java LocalTime, making auto conversion from kotlinx->java LocalTime not possible.

(auto)-converters are defined here

  • We need to check whether all possible conversions are present. Especially that kotlinx <-> java conversions are all there.
  • java/kotlinx LocalTime as from classes are missing and should be added

The website also doesn't seem to cover all our converters: https://kotlin.github.io/dataframe/convert.html so it should probably be updated

@Jolanrensen Jolanrensen added bug Something isn't working documentation Improvements or additions to documentation (not KDocs) enhancement New feature or request good first issue Good issues to pick-up for newcomers labels Sep 27, 2024
@Jolanrensen Jolanrensen added this to the 0.15.0 milestone Sep 27, 2024
@Ahar28
Copy link

Ahar28 commented Sep 28, 2024

Hi @Jolanrensen ! I'm interested in contributing to this issue as a new contributor.

Proposed Solution

I've updated the createConverter function to add converters for LocalTime:

import kotlinx.datetime.toKotlinLocalTime

LocalTime::class -> when (toClass) {
    JavaLocalTime::class -> convert<LocalTime> { it.toJavaLocalTime() }
    else -> null
}

JavaLocalTime::class -> when (toClass) {
    LocalTime::class -> convert<JavaLocalTime> { it.toKotlinLocalTime() }
    else -> null
}

Could you please let me know if this approach aligns with the requirements or if you have any feedback?

@Jolanrensen
Copy link
Collaborator Author

Hi @Ahar28, thanks for offering your help :)

I was thinking that we might be missing some more conversions like from/to Instant or LocalDateTime, but on second thought, I wouldn't know what a "default date" would need to be. (Like year 0? 1970?), so it might be best to leave those conversions out. Same with conversions to Long/Int (like, would it be the milliseconds or seconds of the current day? No obvious default exists).

So, java <-> kotlin conversion would be enough I suppose. However, do check the other conversions if you're willing to make a PR. I see for instance that (kotlin) LocalTime is missing from the Long conversions while JavaLocalTime is present.

We'd also need some tests of course, and finally a small update to the website (in the docs/StarDustDocs/topics folder) with the newly supported types. Would you be up for that? :)

@Jolanrensen Jolanrensen assigned Jolanrensen and Ahar28 and unassigned Jolanrensen Sep 30, 2024
@Ahar28
Copy link

Ahar28 commented Sep 30, 2024

Hi @Jolanrensen, yes I'm up for it !

I'll make the changes and get it reviewed from you. Thank you for giving me this opportunity.

@Jolanrensen
Copy link
Collaborator Author

@Ahar28 did you have a chance to look at it already? We would like to have this bug fixed for 0.15.0 ideally :)

@Ahar28
Copy link

Ahar28 commented Oct 29, 2024

Hi @Jolanrensen , sorry for the delay on my part. But I'm currently tied up with some other commitments and won’t be able to take this on until next week. If the timeline allows, I’ll look into it as soon as I’m available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation (not KDocs) enhancement New feature or request good first issue Good issues to pick-up for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants