Skip to content

Bug: shortened day text is almost the same for all days in Hebrew, and days don't change direction  #495

Open

Description

@AndroidDeveloperLB

Suppose you take this when on English:

image

When I switch to Hebrew, I get this:

image

Almost all days here have the same letter, which is wrong because it's not how it should be on Hebrew.
I think it's because the library truncates a longer text here, as you will see below.

Pressing "Today" will get it right:

image

However, only the days are ok. The order of them is incorrect, because Hebrew is an RTL language.
This means that you are supposed to see the days from right to left.

See Google Calendar for example:

device-2018-05-03-100330

Sunday ("יום א" - first day) is on the right, then Monday, then Tuesday, then Wednesday, then Thursday (which is today - "יום ה" - the 5th day of the week) , then Friday, then Saturday ("שבת" - Sabbath, last day of the week) .

This is how it should have been.

Activity

  1. AndroidDeveloperLB commented on May 6, 2018

    @AndroidDeveloperLB
    Author

    Correct way to format the dates is as such:

    private fun setupDateTimeInterpreter(shortDate: Boolean) {
        val calendar = Calendar.getInstance()
        calendar.set(Calendar.MINUTE, 0)
        calendar.set(Calendar.SECOND, 0)
        calendar.set(Calendar.MILLISECOND, 0)
        val dateFormat = DateFormat.getTimeFormat(this@BaseActivity)
                ?: SimpleDateFormat("HH:mm", Locale.getDefault())
        val format = SimpleDateFormat(" M/d", Locale.getDefault())
        weekView.dateTimeInterpreter = object : DateTimeInterpreter {
            ...
    
            override fun interpretDate(date: Calendar): String {
                var weekday = DateUtils.getDayOfWeekString(date.get(Calendar.DAY_OF_WEEK), DateUtils.LENGTH_SHORT)
                if (shortDate) {
                    val dayOfWeekString = DateUtils.getDayOfWeekString(date.get(Calendar.DAY_OF_WEEK), DateUtils.LENGTH_SHORTEST)
                    weekday = dayOfWeekString
                }
                return weekday + format.format(date.time)
            }
    
        }
    }
    

    But for the RTL issue, this is something else...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions