-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Persian calendar leap year issue #7421
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
Comments
Hi @Vahid-Taheri, thanks for pointing this out! |
FYI back in 2016 when we pulled the original I apparently didn't find it published on NPM so I copied the source code into my repo. It now apparently is published: https://www.npmjs.com/package/kbw-calendars - but I only see up to v2.1.0 published there while the latest in https://github.com/kbwood/calendars is v2.2.0, so I guess best is to still copy in the source code. Also note that in v2.1.0 kbwood reorganized the repo, so there will likely be a bunch of work to get the codegen working again. |
Hmm I was optimistic that the new upstream version would fix the issue you identified @Vahid-Taheri, especially since the latest version over there is just two months old (suspiciously close to the date this discrepancy occurs!) but it seems the @Vahid-Taheri is that the same code you were trying to edit? Do you have a proposed update that would give the correct leap years in all cases? Or a reference you can point us to for precisely how to decide which years are leap years? Ideally I guess this means we should open a PR upstream to fix the bug there before we update world-calendars. |
The Persian calendar was correct as is (according to https://www.iranchamber.com/calendar/converter/iranian_calendar_converter.php and https://www.parstimes.com/persian/calendar/). I have added a new "iranian" calendar to provide one that matches the alternative version with 1403 being a leap year (http://www.time.ir/). |
Hi @alexcjohnson, thanks for your early answer. In Jalali calendar, often leap years repeats every 4 years. 1395 was leap year, 1399 is leap year, 1403 is leap year too. By this pattern the next leap year should be 1407, but it is not ! because of that scientists !! 🙄😂 The next leap year is 1408. If you want to read more, this link is a good source. About algorithms, I found two algorithms that cover this issue. |
Thank you @kbwood - and I don't think we've corresponded before but let me say thank you for creating and maintaining your calendar plugin, that's been the basis of Plotly's international calendar support for nearly a decade now! It does look like your leap year logic in iranian.js matches that in ng2-datepicker-jalali. The |
@alexcjohnson, both are the same (or maybe a little different). We mostly use Jalali calendar. |
Thank you @Vahid-Taheri for raising this issue. And thank you to everyone else for addressing it. @kbwood, where and how can we access the new "iranian" calendar that you have added? I can't seem to find it in the plotly codebase. |
@hmanz we (Plotly) will need to rebuild using the new version of @kbwood's calendar code in order to get the new But I'm still unclear on the usage of these calendars and how we can help our users to pick the correct one for their needs. @Vahid-Taheri what do you mean by "mostly use Jalali"? Are there specific cases where the other one is used? |
@alexcjohnson and @hmanz, Jalali, Persian, Iranian, and Solar Hijri are all the same, and in global convention and language, we use the Jalali name for it. Still, in the native language, we call it Solar Hijri (هجری شمسی). This article may help you in this subject. It was strange for me to see both in world-calendar package. I think it's better to fix one and refer another to that to keep safe usage for users who are using each one. |
The new calendar is available in my Calendars project. I'm don't fully understand the difference between the two calendars but they correspond to two different implementations as mentioned in my previous post. |
Hi everyone - so is the best solution here for plotly.js to switch to @kbwood's project (https://github.com/kbwood/calendars) rather than continuing with @alexcjohnson's (originally https://github.com/alexcjohnson/world-calendars, but I'm in the process of moving it to https://github.com/plotly/world-calendars)? Fewer packages => less confusion ? |
It isn't really possible for us to use I'm kind of in the same boat as @kbwood in that I don't really understand the distinction between |
I have another repository for the world calendars that removes the jQuery dependency: https://github.com/kbwood/world-calendars. It is written in TypeScript however. |
Oh that's cool, thanks for pointing that out! We should be able to use I'm curious what you plan for these projects going forward. Clearly it's not ideal to be maintaining two parallel codebases, perhaps there's a route to |
Hello,
In the Persian calendar(Jalali), 1403 was a leap year, and the 12th month had 30 days. In other words, 2025/03/20 should be converted to 1403/12/30, but it is converted to 1404/01/01.
I tried to find the reason, and I found out that plotly.js is using world-calendars package to convert calendars, and the main issue is related to this package, but it hasn't been updated for 8 years.
I want to change xaxis type to categorical data because I need data type features like changing format based on resolution, avoiding repetitive labels, etc.
Also, I tried to fix world-calendar and rebuild plotly.js and patch changes using patch-package, but it didn't work.
Is there any solution to use other libraries for converting dates to Persian with coverage of features, or fixing world-calendar issue?
The text was updated successfully, but these errors were encountered: