Skip to content

calendar-widget: 'today' day is not set when opening the calendar #434

@Luka5W

Description

@Luka5W

When keeping the computer turned on over night, the current day/ today day is not updated. To update the day, the calendar popup has to be closed (which triggers the update, see calendar.lua#L229-L234) and opened again.

I've changed L228-235 in calendar.lua and test it a few weeks (because I'm too lazy to learn Lua or something). I'll create a PR if I know more.

-- OLD
       if popup.visible then
            -- to faster render the calendar refresh it and just hide
            cal:set_date(nil) -- the new date is not set without removing the old one
            cal:set_date(os.date('*t'))
            popup:set_widget(nil) -- just in case
            popup:set_widget(cal)
            popup.visible = not popup.visible
        else
-- NEW (not tested yet but should work (tm))
        if popup.visible then
            -- to faster render the calendar refresh it and just hide
            cal:set_date(nil) -- the new date is not set without removing the old one
            popup:set_widget(nil) -- just in case
            popup.visible = false
        else
            -- apply it when the calendar is opened! - probably slower but fixes the issue that the
            --  day is not updated when *opening* the popup (only when closing)
            cal:set_date(os.date('*t'))
            popup:set_widget(cal)

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