android-times-square
android-times-square copied to clipboard
Week in Arabic is shown two days ahead
The calender shows the current date two days ahead. Example, if today is 13th Seb Wednesday then in Arabic it is showing 13th Sep Friday. How can this is solved?
calendarView.init(today,nextYear.getTime(),new Locale("ar","EG")). inMode(CalendarPickerView.SelectionMode.MULTIPLE);
+1 Facing the same issue with Bengali(bn) language
I found the problem and was able to work around it by forking the library and editing isRtl
view.isRtl = false; // was isRtl(locale);
this changes the order of days and it now starts from Saturday but at least it displays the correct day.
I won't be submitting a pull request since my solution changes the appearance slightly and if the maintainers want to use it is just one line.
here is my fork that contains the fix: https://github.com/humazed/android-times-square
you can use from; https://jitpack.io/#humazed/android-times-square
implementation 'com.github.humazed:android-times-square:1.7.12-SNAPSHOT-1'
here is how it looks now:

So small update here in case someone else is in the same situation.
I have device with language setting like:

During debug I found that Locale.getDefault() returns en_NL which is second one in the android settings.
However, if I use new API LocaleList.getDefault() it returns correct list of locales that exact same as in the device settings.
With the code:
val locale = LocaleListCompat.getDefault()[0]
calendarView.init(currentDate, maxDate, locale)
I achieved next result:

Notice that week starts on Saturday and there is compat version of LocaleList to work on the older API.
This is nothing related to RTL language. So please excuse me for the message above.