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

No localization for date formats #74

Open
akaish opened this issue Mar 16, 2023 · 0 comments
Open

No localization for date formats #74

akaish opened this issue Mar 16, 2023 · 0 comments

Comments

@akaish
Copy link

akaish commented Mar 16, 2023

Hello, I'm working on app that targeted to Russian\Ukrainian\Belarus audience and noticed that "Selected Day" section for single date dialog picker has US like formatting (yyyy/MM/dd) instead of dd/MM/yyyy (i mean that there is no support for locale dates formatting, in different countries order of year, month and day differs).
Here is possible fix:
File: com.aminography.primedatepicker.picker.selection.single.SingleDaySelectionBarView
Fix (line 48):

    var pickedDay: PrimeCalendar? = null
        set(value) {
            field = value
            rootView.pickedTextView.bottomLabelText = value?.let {
                val dateFormatter: DateTimeFormatter =
                    DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG) // I prefer full date format

                val localDate = Instant.ofEpochMilli(it.timeInMillis)
                    .atZone(ZoneId.systemDefault())
                    .toLocalDate()
                localDate.format(dateFormatter).localizeDigits(value.locale)
            } ?: "---"
        }

By the way, good work. You've created really sweet looking widget easy both to use and implement in code.

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

No branches or pull requests

1 participant