Bug 445324

Summary: Winter solstice inappropriately listed as a holiday
Product: [Frameworks and Libraries] frameworks-kholidays Reporter: Lukas Sommer <sommerluk>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Severity: normal CC: nate, plasma-bugs, postix, spitz234, winter
Priority: NOR    
Version: 5.88.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description Lukas Sommer 2021-11-11 10:50:21 UTC
Calendar of the digital clock shows winter solstice even though astronomical events are disabled in the settings.

1. Have the digital clock in your panel.
2. Right-click in the digital clock → Settings → Calendar → Uncheck Astronomical Events → OK
2.  Left-click in the digital clock opens the calendar.
3. Choose December as month.

The winter solstice is shown as an event on December, 21.

The winter solstice is NOT shown as an event on December, 21.

Operating System: Kubuntu 21.04
KDE Plasma Version: 5.21.4
KDE Frameworks Version: 5.80.0
Qt Version: 5.15.2
Kernel Version: 5.11.0-40-generic
OS Type: 64-bit
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-7700HQ CPU @ 2.80GHz
Memory: 7.6 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 630

Unlike the winter solstice, the summer solstice is correctly no longer displayed.
Comment 1 Nate Graham 2021-11-12 22:05:56 UTC
If you do have the plugin enabled, does it show up twice on that day? That's what happens for me. This indicates that the same event is coming from multiple calendar plugins. Do you have any holiday plugins also enabled? If you turn those off, does the last occurrence of the event finally disappear?
Comment 2 Lukas Sommer 2021-11-12 22:24:19 UTC
> If you do have the plugin enabled, does it show up twice on that day? That's what happens for me. 

Indeed, if both (Astronomical events and Holidays) are enabled, I see it twice also.

> Do you have any holiday plugins also enabled?

I'm using ci_fr, but I've also tested with at_de, and it's the same problem.

> If you turn those off, does the last occurrence of the event finally disappear?

If both (Astronomical events and Holidays) are disabled, indeed the last occurrence of the event finally disappears.
Comment 3 Nate Graham 2021-11-15 23:39:07 UTC
I can reproduce with the en_us holiday package, so it seems to be a problem that's not unique to a single one. Moving to the kholidays framework.
Comment 4 Allen Winter 2021-11-16 12:41:58 UTC
To the Digital Clock people:

The solstice and equinox "holidays" are added to the Holiday list unconditionally.

the holiday class has a categoryList.  look in that list for QLatin1String("seasonal")
filter on that.
Comment 5 Nate Graham 2021-11-16 18:08:03 UTC
Can we remove them from the holidays lists? They aren't holidays...
Comment 6 Nate Graham 2021-12-01 20:56:05 UTC
*** Bug 446329 has been marked as a duplicate of this bug. ***
Comment 7 Alois Spitzbart 2021-12-27 22:42:49 UTC
I searched and played around with kholiday. I found out, when I comment at function https://lxr.kde.org/source/frameworks/kholidays/src/parsers/holidayparserdriver.cpp#0049 
> Holiday::List HolidayParserDriver::parseHolidays(const QDate &startDate, const QDate &endDate)
following rows
>//    for (int year = startDate.year(); year < endDate.year(); ++year) {
>//        for (auto s : {AstroSeasons::JuneSolstice, AstroSeasons::DecemberSolstice, AstroSeasons::MarchEquinox, AstroSeasons::SeptemberEquinox}) {
>//            const auto dt = AstroSeasons::seasonDate(s, year);
>//            if (dt >= startDate && dt <= endDate) {
>//                Holiday season;
>//                season.d->mDayType = Holiday::Workday;
>//                season.d->mObservedDate = dt;
>//                season.d->mDuration = 1;
>//                season.d->mName = AstroSeasons::seasonName(s);
>//                season.d->mCategoryList.append(QLatin1String("seasonal"));
>//                m_resultList.append(season);
>//            }
>//        }
>//    }
everything works as expected. The autotests are also working. But I am not experienced enough to see, what this is good for and what is the influence to other parts.
Comment 8 Bug Janitor Service 2022-02-27 11:57:55 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kholidays/-/merge_requests/34
Comment 9 Bug Janitor Service 2022-03-13 13:50:46 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kholidays/-/merge_requests/38
Comment 10 Allen Winter 2022-04-10 15:26:30 UTC
Git commit 58c51df658c04361e648adcee711d3ae28289a9c by Allen Winter, on behalf of Alois Spitzbart.
Committed on 10/04/2022 at 15:26.
Pushed by winterz into branch 'master'.

New function for plasma to generate holidays without astro seasons

This function creates just holidays from the holiday files. Astro seasons are not included, which are calculated. In Plasma can the astro seasons displayed two times. When this function is used, this can prevented.

I did get a better name. Maybe someone has a better idea. Would be Plasma as suffix better than Only?

This a follow up to https://invent.kde.org/frameworks/kholidays/-/merge_requests/34

M  +2    -0    CMakeLists.txt
M  +6    -0    autotests/CMakeLists.txt
M  +31   -0    autotests/testholidayregion.cpp
M  +2    -0    autotests/testholidayregion.h
M  +4    -0    docs/Doxyfile.local
M  +8    -1    src/CMakeLists.txt
M  +9    -0    src/holidayregion.cpp
M  +44   -0    src/holidayregion.h
M  +7    -1    src/parsers/holidayparserdriver.cpp
M  +10   -0    src/parsers/holidayparserdriver_p.h