feat: add support for cyclical dates in special events to avoid yearly updates #45
Reference in New Issue
Block a user
Delete Branch "feat/cyclical-special-event"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add suport for cyclical date for special event.
Allow users to avoid updating the same special event dates every year.
Enhance the robustness of special event data parsing.
Wish you could separate
special.jsoninto three files for better organization:static_special.jsonfor events with fixed dates.cyclical_special.jsonfor recurring events (e.g., holidays like Thanksgiving and Mother's Day).custom_special.jsonfor user-defined or custom events.This separation would improve clarity and make managing different event types more efficient. Let me know what you think.
isNaN, range validation) could be extracted into helper functions for cleaner code.elseand validation blocks make the code harder to read. Refactor to flatten the structure where possible.week/weekdayanddateare missing, consider whether a more graceful fallback (or an error throw) is appropriate rather than just logging and returning-1.eventMonth - 1for zero-based indexing) or dates exceeding month limits (e.g.,31in February) are handled properly.It looks like the line for splitting and parsing the IP address is commented out, and a hardcoded value is used instead. Please remove this line.
@@ -8,3 +9,4 @@},"status_index": "0","goodFortunes": {"l_1_event": "家人團聚",感恩節 is celebrated on the fourth Thursday of November.
@@ -133,68 +141,12 @@"r_2_desc": ""}Please remove the following three events.
感恩節 is celebrated on the fourth Thursday of November.
中秋節 (Mid-Autumn Festival) does not fall on the same day every year as it follows the lunar calendar.
Should user-defined events also be divided into fixed dates and recurring dates?
Yes, user-defined (custom) events should also be divided into fixed dates and recurring dates. By "custom," I mean events that don't fall into the first two categories (static or cyclical). Separating them ensures clarity and better organization across all event types.
Hi there,
I'm a bit confused by the current implementation. In our previous discussion about separating
special.json, we agreed on a clear and straightforward organization:static_special.jsonfor events with fixed datescyclical_special.jsonfor recurring eventscustom_special.jsonfor user-defined eventsHowever, your current commit introduces four different JSON files:
custom_static_special.jsoncustom_cyclical_special.jsondefault_static_special.jsondefault_cyclical_special.jsonThis approach raises several questions:
static_special.jsonorcyclical_special.jsonrespectively?The original proposal was to create a clear, simple organizational structure. Your current implementation seems to add unnecessary complexity without a clear rationale.
Could you explain the reasoning behind this approach? I'm concerned that this might make the code harder to understand and maintain.
Looking forward to your explanation.
User-defined events only contain static date or recurring date.
Why not simply place the user-defined events in
static_special.jsonandcyclical_special.json?The current
custom_special.jsonis the same as the originalspecial.json, containing both types.Let me clarify the distinctions between these event types:
Static Events (Fixed Date):
Cyclical Events (Variable Date):
Custom Special Events (Non-Recurring):
The key difference is the recurrence pattern. Static and cyclical events will happen every year, just with different timing. Custom special events are unique occurrences that don't repeat annually.
Does this help clarify why we might want a separate category for custom special events?
OK
However, for events like the Moon Festival, which uses the lunar calendar and clearly occurs every year, the specific date still needs to be specified in
custom_special.json.Exactly! Your example of the Moon Festival perfectly illustrates why we need the
custom_special.json. Events like the Moon Festival, which follows lunar calendar calculations, don't fit neatly into the standard static or cyclical event types.While they do occur annually, their dates can't be predetermined using a simple Gregorian calendar rule. They require specific date input each year, which makes them "custom" in nature. These events need a separate file where you can manually specify their exact dates, taking into account complex calendrical calculations.
So yes,
custom_special.jsonremains crucial for handling these types of unique, annually occurring events that don't follow standard date patterns. It provides the flexibility to include events with more complex recurrence rules that can't be automatically generated.custom_special.json: For one-time or irregular events, or events with complex date calculations (like the Moon Festival in the lunar calendar)This is exactly what I proposed in my initial review comment!
Any special event that does not fit into either:
Goes directly into
custom_special.json.The markdown headers didn't align with the filename.