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

Kotlinx datetime CalendarModel (support date picker on darwin and web) #717

Merged
merged 27 commits into from Aug 5, 2023

Conversation

alexzhirkevich
Copy link

@alexzhirkevich alexzhirkevich commented Jul 29, 2023

Proposed Changes

  • Fix some bugs in String.format
  • Implement KotlinxDatetimeCalendarModel
  • Full support of calendar model on darwin including weekdays localization and date skeletons (respects iOS Language & Region preferences)
  • Full support of calendar model on JS with date skeleton and weekdays localization
Screenshot 2023-07-29 at 12 31 03 Screenshot 2023-07-29 at 12 32 12

macOS native
Screenshot 2023-07-29 at 16 36 31

image Screenshot 2023-07-29 at 15 59 01

Testing

Test: KotlinxDatetimeCalendarModelTest + mpp Date & Time pickers

Issues Fixed

Fixes: JetBrains/compose-multiplatform#3359
Fixes: JetBrains/compose-multiplatform#3354
Fixes: JetBrains/compose-multiplatform#1299

@alexzhirkevich alexzhirkevich changed the title Kotlinx datetime CalendarModel (support date picker on darwin) Kotlinx datetime CalendarModel (support date picker on darwin and web) Jul 29, 2023
@alexzhirkevich alexzhirkevich marked this pull request as ready for review July 29, 2023 13:08
@dima-avdeev-jb dima-avdeev-jb self-requested a review August 1, 2023 09:22
@alexzhirkevich
Copy link
Author

alexzhirkevich commented Aug 2, 2023

I am not sure how multiplatform tests work. Need some help here.

  1. How to properly setup tests in skiko? For some reason my AS doesn't treat skikoTest directory as a module... Looks like i need to add dependsOn from other test module to activate it. And 2nd question is probably can be solved with dependsOn
  2. If i add tests for expect object in skikoTest, will it be tested on each platform or do i need to add test for actuals in each module?

@eymar
Copy link
Collaborator

eymar commented Aug 2, 2023

  1. If i add tests for expect object in skikoTest, will it be tested on each platform or do i need to add test for actuals in each module?

Unless actual implementations intentionally produce different results, there is no need to add the same test to platform-specific test source sets. skikoTests should be fine.

@alexzhirkevich
Copy link
Author

alexzhirkevich commented Aug 2, 2023

Should we use new calendar model for desktop too and set it as actual in skiko? Or it's better to left legacy one for now? Date format is delegated to legacy anyway.

@eymar
Copy link
Collaborator

eymar commented Aug 3, 2023

Should we use new calendar model for desktop too and set it as actual in skiko? Or it's better to left legacy one for now? Date format is delegated to legacy anyway.

If the desktop tests pass, then I think it's better to use a common implementation (common for skiko targets without android). And as for formatter, let it delegate to legacy impl for now. Maybe adding a link to Kotlin/kotlinx-datetime#251 in desktop formatter could be helpful in the future.

Co-authored-by: Oleksandr Karpovich <a.n.karpovich@gmail.com>
@alexzhirkevich
Copy link
Author

alexzhirkevich commented Aug 3, 2023

If the desktop tests pass,

They do. Except 2 muted (only on desktop) tests for a non-implemented desktop ICU skeleton feature.

@eymar
Copy link
Collaborator

eymar commented Aug 4, 2023

Is such date formatting (without spaces) expected on jvm/desktop untill we use kotlinx.datetime? I'm on Ubuntu (haven't tested other OS yet).

left - browser
right - desktop

Screenshot from 2023-08-04 18-19-16

Copy link
Collaborator

@eymar eymar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Web part looks good to me! thank you!

@alexzhirkevich
Copy link
Author

Is such date formatting (without spaces) expected on jvm/desktop untill we use kotlinx.datetime

It is a consequence of non-implemented ICU date skeletons.

We can replace it for now with something readable without localization (for ex. take patterns from the left screen). The only thing there can be troubles c падежами in some languages.
Or we can use a 3rd party library such as ibm ICU4j

Co-authored-by: dima.avdeev <dima.avdeev@jetbrains.com>
@dima-avdeev-jb
Copy link

@alexzhirkevich We added automatically check Google CLA.
Can you please follow instructions here: https://github.com/JetBrains/compose-multiplatform-core/pull/717/checks?check_run_id=15644479000

You need to add an additional email (in GitHub account) to which you accepted the signature

@alexzhirkevich
Copy link
Author

It seems like it is not because of me :D
image

@dima-avdeev-jb
Copy link

Yeah, thanks! Overall LGTM. I will merge it

@dima-avdeev-jb dima-avdeev-jb merged commit c63c81e into JetBrains:jb-main Aug 5, 2023
1 check failed
igordmn pushed a commit that referenced this pull request Jan 30, 2024
#717)

implement Calender on all platforms
Co-authored-by: Oleksandr Karpovich <a.n.karpovich@gmail.com>
Co-authored-by: dima.avdeev <dima.avdeev@jetbrains.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants