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

gotoday select wrong day #117

Open
KORuL opened this issue May 30, 2019 · 4 comments
Open

gotoday select wrong day #117

KORuL opened this issue May 30, 2019 · 4 comments

Comments

@KORuL
Copy link

KORuL commented May 30, 2019

Expected Behavior / Goal

I have tried this way in onResume method:

            calendarHorizontal!!.goToday(true)
            calendarHorizontal!!.refresh()

It almost always works fine, but some users receive a complaint about switching the calendar a day ago from the current date.

Actual Behavior

example: System date is 30.05.2019 but gotoday set 29.05.2019

Steps to Reproduce the Problem (sample code if possible)

            calendarHorizontal!!.goToday(true)
            calendarHorizontal!!.refresh()

Specifications

        calendarHorizontal = HorizontalCalendar.Builder(this, R.id.calendarViewHorizontal)
            .range(startDate, endDate)
            .datesNumberOnScreen(7)   // Number of Dates cells shown on screen (Recommended 5)
            .configure()
            .formatTopText("EEE")       // default to "MMM".
            .formatMiddleText("dd")    // default to "dd".
            .formatBottomText("MMM''yy")    // default to "EEE".
            .sizeBottomText(10f)
            .sizeTopText(14f)
            .sizeMiddleText(21f)
            .textColor(
                ContextCompat.getColor(applicationContext, R.color.new_black_unsel),
                ContextCompat.getColor(applicationContext, R.color.new_black_sel)
            )    // Text color for none selected Dates, Text color for selected Date.
            .selectedDateBackground(getResourses().getDrawable(R.drawable.gradient_selected_calendar))  // Background Drawable of the selected date cell.
            .selectorColor(
                ContextCompat.getColor(
                    applicationContext,
                    R.color.new_calendar_selector_color
                )
            )
            .end()
            .defaultSelectedDate(Calendar.getInstance())
            .build()
  • Android Version: 6.0
  • Horizontal-Calendar Version: 1.3.4
@KORuL
Copy link
Author

KORuL commented Jun 1, 2019

I clone this repo!

        calendarHorizontal = HorizontalCalendar.Builder(this, R.id.calendarViewHorizontal)
            .range(startDate, endDate)
            .datesNumberOnScreen(8)   // Number of Dates cells shown on screen (Recommended 5)
            .configure()
            .formatTopText("EEE")       // default to "MMM".
            .formatMiddleText("dd")    // default to "dd".
            .formatBottomText("MMM''yy")    // default to "EEE".
            .sizeBottomText(10f)
            .sizeTopText(14f)
            .sizeMiddleText(21f)
            .textColor(
                ContextCompat.getColor(applicationContext, R.color.new_black_unsel),
                ContextCompat.getColor(applicationContext, R.color.new_black_sel)
            )    // Text color for none selected Dates, Text color for selected Date.
            .selectedDateBackground(getResourses().getDrawable(R.drawable.gradient_selected_calendar))  // Background Drawable of the selected date cell.
            .selectorColor(
                ContextCompat.getColor(
                    applicationContext,
                    R.color.new_calendar_selector_color
                )
            )
            .end()
            .defaultSelectedDate(Calendar.getInstance())
            .build()

if datesNumberOnScreen(8) - selecting incorrect date
image

@muraee
Copy link
Owner

muraee commented Jun 1, 2019

datesNumberOnScreen should be an odd number since the calendar will try to center the date on screen. Even numbers are not supported atm.

@KORuL
Copy link
Author

KORuL commented Jun 4, 2019

Ok, I use datesNumberOnScreen(7) And everyone chooses the current date, however, the previous day is chosen in Kiev

@dharmesh-om
Copy link

@KORuL @Mulham-Raee Did you guys find any solution for this?
when i am giving
datesNumberOnScreen(7) // Number of Dates cells shown on screen
its not working for selection on current date.

Only working for when i am giving dateNumberOnScreen(5)..
Please help..

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

3 participants