Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧩 Support year 0 again (Possible Solution) #132

Open
ReconVirus opened this issue May 21, 2024 · 0 comments
Open

🧩 Support year 0 again (Possible Solution) #132

ReconVirus opened this issue May 21, 2024 · 0 comments

Comments

@ReconVirus
Copy link

ReconVirus commented May 21, 2024

Scope

Support 0 as a actual year again similar to how it was originally supported for a brief time parior to v1.2.2

This is something Fantasy Calendar currently supports, and the original plugin under that name and was supported in calendarium for a brief time

Discovery

Allowing years to be displays as -1, 0, 1 , the current way the code is handing it is its skipping 0

Validate

3488dbd

Possible Solution

  • similar to Fantasy Calendar, adding a check box to allow year 0 to exisit
    image

  • possible best guess would be on years.store.ts how lines 136 and 137 are

    if (original == 1) return 0;
    let year = original >= 1 ? original : original + 1;

and to handle different scenarios:

If original is greater than 1, set year to original (no change).

If original is less than 0, set year to original (no change).

If original is 0, set year to 0 explicitly.

This way, the year 0 remains unchanged, and other values are handled appropriately:

For original = -1: year remains -1.

For original = 0: year is explicitly set to 0.

For original = 2: year remains 2.

if (original === 1) return 0;
let year;

// Handle year transformation
if (original > 1) {
    year = original;
} else if (original < 0) {
    year = original;
} else {
    year = 0;  // Explicitly handle year 0
}
@ReconVirus ReconVirus changed the title 🧩 Support year 0 (again) 🧩 Support year 0 again (Possible Solution) Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant