lvgl: Possible bug in lv_calendar, prevents year entry of 2024

LVGL version

8.3

What happened?

I am unable to set a date from 2024 in the calendar. It will not go beyond 2023

If you set the date to 2024 01 05, and the display date to 2024 01 it will set it to 1901 01 When scrolling up in the dropdown, it will end at 2023. You cannot set a date for 2024 This is happening in my production code, and can easily be replicated in the online simulator.

Screenshot 2024-01-05 154640

Screenshot 2024-01-05 154742

Screenshot 2024-01-05 154910

How to reproduce?

To replicate the problem easily, go to the 8.3 docs, then -> lv_calendar ->simulator. In the simulator you can paste this code

##### startup script #####

#!/opt/bin/lv_micropython -i

import lvgl as lv

import display_driver


##### main script #####


def event_handler(evt):
    code = evt.get_code()

    if code == lv.EVENT.VALUE_CHANGED:
        source = evt.get_current_target()
        date = lv.calendar_date_t()
        if source.get_pressed_date(date) == lv.RES.OK:
            calendar.set_today_date(date.year, date.month, date.day)
            print("Clicked date: %02d.%02d.%02d"%(date.day, date.month, date.year))


calendar = lv.calendar(lv.scr_act())
calendar.set_size(200, 200)
calendar.align(lv.ALIGN.CENTER, 0, 20)
calendar.add_event_cb(event_handler, lv.EVENT.ALL, None)

calendar.set_today_date(2024, 1, 5)
calendar.set_showed_date(2024, 1)

# Highlight a few days
highlighted_days=[
    lv.calendar_date_t({'year':2024, 'month':1, 'day':1}),
    lv.calendar_date_t({'year':2023, 'month':12, 'day':25}),
    lv.calendar_date_t({'year':2024, 'month':1, 'day':22})
]

calendar.set_highlighted_dates(highlighted_days, len(highlighted_days))

lv.calendar_header_dropdown(calendar)

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 17 (15 by maintainers)

Most upvoted comments

I think letting the user to explicitly set a year list is better as this the list can be stored in flash too.

@C47D We are in big hurry now to release v9 next Monday, so we can just work with a PR as usual. We will start the shaping/pitching after the release. Thank you for asking anyway, highly appreciated 🤗