question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

goToday() and selectDate() selecting incorrect date

See original GitHub issue

Expected Behavior / Goal

I have placed a button in my toolbar that should return the horizontal calendar to today.

Actual Behavior

Upon clicking the today button, the horizontal calendar will intermittently return to the wrong day.

Steps to Reproduce the Problem

I have tried this 2 different ways:

Using selectDate()

  if(id == R.id.today_button) {
            Calendar today = Calendar.getInstance();
            if(mHorizontalCalendar != null){
                mHorizontalCalendar.selectDate(today, true);
            }
        }

Using goToday()

 if(id == R.id.today_button) {
            if(mHorizontalCalendar != null){
                mHorizontalCalendar.goToday(true);
            }
        }

When using selectDate(), the outcome is intermittently 1 day before (ie. today is Tuesday, it will switch between selecting Monday and Tuesday as today)

When using goToday(), the outcome is intermittently 1 day before, or 1 day after (ie. today is Tuesday, it will switch between selecting Monday, Tuesday, and Wednesday as today)

Specifications

  • Android Version: 6.0.1 and 8.1.0
  • Horizontal-Calendar Version: 1.3.2

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
muraeecommented, Feb 2, 2018

@alliejc changes are live in version 1.3.4

0reactions
KORuLcommented, 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

My Issue #117

Read more comments on GitHub >

github_iconTop Results From Across the Web

goToday() and selectDate() selecting incorrect date #63 - GitHub
When using selectDate(), the outcome is intermittently 1 day before (ie. today is Tuesday, it will switch between selecting Monday and ...
Read more >
Incorrect date passed from date picker if selecting the first of ...
I defined some variables to easily set the min/max dates up. ... onSelect: function (selectedDate) { console.log(`Selected dates are ...
Read more >
how to import moment file in LWC in salesforce
when i am deploy this code to source org its give me "Invalid reference moment of type resourceUrl in file demoDate.js". – singh_25....
Read more >
BeatPicker docs
Select range of date from start to end programmatically. Format: Any date string that Date.parse will accept.using this reference to see ISOs Date.parse()....
Read more >
react-native-slideable-calendar: Documentation | Openbase
selectedDate, The current selected date, Required. onPressDate, Press date callback, Optional, (date) => {}. onPressGoToday, Press gotoday button callback, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found