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

DateTime Dialog(DatePicker) not working on Physical Devices #23

Closed
ankur141295 opened this issue Feb 4, 2023 · 5 comments
Closed

DateTime Dialog(DatePicker) not working on Physical Devices #23

ankur141295 opened this issue Feb 4, 2023 · 5 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@ankur141295
Copy link

The DateTime Dialog to select only dates is not working on Physical devices but it works on emulator as expected. On a physical device, it only shows to select date while month and year never shows.

The same behaviour can be seen in the sample app.

Untitled.mp4
@maxkeppeler
Copy link
Owner

The view uses by default the localized date and time pattern with the specified FormatStyle and Locale.
The idea was to let the view build up an input based on the pattern, the locale and the format style in the matching order of a date or time.

Defaults are like this:

    override val locale: Locale = Locale.getDefault(),
        override val dateFormatStyle: FormatStyle = FormatStyle.MEDIUM,
        override val timeFormatStyle: FormatStyle = FormatStyle.SHORT,

Can you pass a specific Locale to the Dialog and see if it works? What is the current locale, perhaps some rules/ conditions are missing for a specific locale/ pattern?

@ankur141295
Copy link
Author

Hey, thanks for the reply. My current Locale is en_IN.
As you suggested changing the default values for locale or dateFormatStyle shows the dialogue's expected UI.

In my case setting either of these values shows the expected result:-
locale = Locale.UK
or
dateFormatStyle = FormatStyle.FULL/FormatStyle.LONG

@maxkeppeler
Copy link
Owner

That's good! However, does that mean it couldn't generate a valid date pattern for the locale of the device? Can you figure out what the pattern was? Ideally, it should still work with the Locale.getDefault().

@ankur141295
Copy link
Author

ankur141295 commented Feb 4, 2023

Hi @maxkeppeler upon debugging I found out that when using default values for locale and dateFromatStyle, for my locale i.e. en_IN the generated pattern is dd-MMM-y and in your com.maxkeppeler.sheets.date_time.utils.Utils.kt file for function getLocalizedValues - delimiters is missing. Due to this in PickerComponent.kt values state size is 1 and only one composable is generated.

Screenshot 2023-02-04 at 10 32 37 PM

Upon changing dateFormatStyle = FormatStyle.FULL the generated pattern is EEEE, d MMMM, y and in PickerComponent.kt values state size is 4 and the output UI is as expected.
Screenshot 2023-02-04 at 10 35 04 PM

@maxkeppeler
Copy link
Owner

I have to look through all the possible characters and fix this!
Thanks man, very helpful as I'm currently keeping myself busy with landscape layouts.

@maxkeppeler maxkeppeler added bug Something isn't working enhancement New feature or request labels Feb 4, 2023
maxkeppeler added a commit that referenced this issue Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants