Skip to content

not expected result on selectDay(LocalDate date) #19

@haoziliu

Description

@haoziliu
    private int getDayForDate(@NonNull LocalDate date) {
        return firstDay.until(date).getDays();
    }

This method is supposed to get the offset of days from first day. But in fact it only get the days of month. As a result, selectDay and setDateIndicator won't work correctly.

This would be correct:

    private int getDayForDate(@NonNull LocalDate date) {
        return (int) (date.toEpochDay() - firstDay.toEpochDay());
    }

or

    private int getDayForDate(@NonNull LocalDate date) {
        return (int) firstDay.until(date, ChronoUnit.DAYS);
    }

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