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

Inconsistent months data for date conversion #82

Open
aj3sh opened this issue Apr 9, 2024 · 13 comments
Open

Inconsistent months data for date conversion #82

aj3sh opened this issue Apr 9, 2024 · 13 comments

Comments

@aj3sh
Copy link
Member

aj3sh commented Apr 9, 2024

We have noticed inconsistencies in the monthly data across Hamro Patro and Nepali Patro, starting from the year 2081. This inconsistency was initially highlighted in the go-nepali project (opensource-nepal/go-nepali#15). The issue was addressed in this project through PR #79. However, this PR only fixes the data for the year 2081.

After a thorough examination, here's what I discovered:

  • Hamropatro has incorrect data for the year 2087, with 367 days in a year.
  • The data pattern of the Baishakh from Nepali Patro appears to follow a specific pattern and is likely to provide accurate information.

Here are the data from different sources:

[Year]
[Current Data]
[Hamro Patro Data]
[Nepali Patro Data]

[2082]
30 32 31 32 31 30 30 30 29 30 30 30
30 32 31 32 31 30 30 30 29 30 30 30
31 31 31 32 31 31 30 29 30 29 30 30

[2083]
31 31 32 31 31 30 30 30 29 30 30 30
31 31 32 31 31 30 30 30 29 30 30 30
31 31 32 31 31 31 30 29 30 29 30 30

[2084]
31 31 32 31 31 30 30 30 29 30 30 30
31 31 32 31 31 30 30 30 29 30 30 30
31 32 31 32 31 30 30 30 29 29 30 31

[2085]
31 32 31 32 30 31 30 30 29 30 30 30
31 32 31 32 30 31 30 30 29 30 30 30
30 32 31 32 31 30 30 30 29 30 29 31

[2086]
30 32 31 32 31 30 30 30 29 30 30 30
30 32 31 32 31 30 30 30 29 30 30 30
31 31 32 31 31 31 30 29 30 29 30 30

[2087]
31 31 32 31 31 31 30 30 29 30 30 30
31 31 32 31 31 31 30 30 30 30 30 30
31 31 32 32 31 30 30 29 30 29 30 30

[2088]
30 31 32 32 30 31 30 30 29 30 30 30
30 31 32 32 30 31 30 30 29 30 30 30
31 32 31 32 31 30 30 30 29 29 30 31

Possible solutions

  1. Align with one of the data sources.
  2. Wait for the updated 2082 data and compare which source had the correct data.
  3. ...
@aj3sh aj3sh converted this from a draft issue Apr 9, 2024
@khumnath
Copy link

@aj3sh i have created those data calculation algorithm in https://github.com/opensource-nepal/nepdate-cli/tree/main/src bikram.h and used in main.cpp. you can check npm package bikram-js or https://github.com/build-for-nepal/bikram-calendar for typescript implementation.

@aj3sh
Copy link
Member Author

aj3sh commented Dec 15, 2024

@aj3sh i have created those data calculation algorithm in https://github.com/opensource-nepal/nepdate-cli/tree/main/src bikram.h and used in main.cpp. you can check npm package bikram-js or https://github.com/build-for-nepal/bikram-calendar for typescript implementation.

Wow thats great. Will look into it. :-) Thanks for sharing.

@aj3sh
Copy link
Member Author

aj3sh commented Dec 22, 2024

@khumnath, Your algorithm has 32 days in Ashar 2082, but Hamropatro and Nepalipatro both have 31 days. Do you have any idea about that?

@aj3sh
Copy link
Member Author

aj3sh commented Dec 22, 2024

The data for the year 2082 on Hamropatro has been updated and now aligns with the data on Nepalipatro, as opposed to the data previously mentioned in the issue. However, Hamropatro still contains incorrect data for the year 2087, showing 367 days in a year.

Therefore, the current data will be updated using the Nepalipatro source.

@khumnath
Copy link

i think month index should change. every 32 days in a month should in shravan. let me see if i got time

@khumnath
Copy link

@aj3sh If the past dates (for which we have data) align correctly with my calculations, future dates may still have incorrect data on Nepali Patro or Hamro Patro. i have tested only some birthdays and aligned current month with weekday name.

@aj3sh
Copy link
Member Author

aj3sh commented Dec 23, 2024

@khumnath I will check if your data matches with the past data.

@aj3sh
Copy link
Member Author

aj3sh commented Dec 23, 2024

@khumnath I have cross-checked your data with nepali-datetime (our package), Hamro Patro, and Nepali Patro. There are 121 mismatches from the years 2000 to 2081. Here are a few sample dates. Please review and verify.

Year Month nepali-datetime bikram-js nepalipatro hamropatro
2000 1 30 31 30 -
2001 9 30 29 30 30
2001 10 29 30 29 29
2002 4 32 31 32 32
2008 1 31 30 31 31
2008 2 31 32 31 31
2008 3 31 32 31 31
2008 4 32 31 32 32
2008 10 29 30 29 29
2020 3 31 32 31 31
2020 9 30 29 30 30
2024 3 31 32 31 31
2024 10 29 30 29 29
2026 12 31 30 31 31
2039 4 32 31 32 32
2039 11 30 29 30 30
2043 4 32 31 32 32
2043 9 30 29 30 30
2051 3 31 32 31 31
2051 4 32 31 32 32
2051 10 29 30 29 29
2058 1 30 31 30 30
2062 3 31 32 31 31
2062 6 31 30 31 31
2070 3 31 32 31 31
2076 9 29 30 29 29
2078 9 30 29 30 30

@khumnath
Copy link

I think the calculation for the first day of the solar month should be re-evaluated here: https://github.com/build-for-nepal/bikram-calendar/blob/main/src/index.ts#L90-L115. First, we need to research whether the Bikram Sambat in Nepal uses the Drik Siddhanta or Surya Siddhanta method for its calculations.

@sumanchapai
Copy link

These are my questions, concerns before approving the PRs on the repos that I have been requested:

@aj3sh , you have highlighted inconsistencies between hamropatro, nepalipatro and bikraj-js #82 (comment). Upon closer inspection it looks like hamropatro and nepalipatro are consistent in the table. Are there inconsistencies between the two for future date, like 2087 that you mentioned? Which source are we using as authoritative for the PRs opensource-nepal/go-nepali#26 (comment) and opensource-nepal/py-nepali#80 (comment)?

On a somewhat higher level, could you please share your perspective on why making the BS calendar has been so challenging? We should have always used a library that algorithmically calculates the days in a month, but that seems to be challenging to build. Every year when the joytis come up with the calendar, what algorithm do they use? Work of @khumnath seems to make a way for this. But without knowing the algorithm ourselves, we cannot verify or change the code. Can you tell us more about how this stuff works? Is there a blog or a video? I have seen that you've used magic numbers such as source:

  double YugaRotation_star = 1582237828;
  double YugaRotation_sun = 4320000;

Would a library like astropy help us in any way, for example knowing the positions of the planets and the stars in the past/present/future?

@aj3sh
Copy link
Member Author

aj3sh commented Jan 14, 2025

@sumanchapai, Currently, I have used NepaliPatro as my source. Based on the data I have collected while creating the issue, it appears that HamroPatro has now updated its data for the year 2082 and it still has 367 days in the year 2087. Therefore, I have chosen to follow NepaliPatro. These PR is also for the immediate fix for year 2082.

Regarding your question about which algorithm to use for building the calendar, I still don’t have any idea about it. @khumnath is currently working on figuring out the algorithm.

FYI: The comment was only for the previous years data. Future years data are still inconsistent.

@khumnath
Copy link

@sumanchapai @aj3sh

Nepal has had an inconsistent standard time over the years. Initially, Nepal used the Indian Ujjain longitude time, then switched to Kathmandu local time, followed by Indian Standard Time. Currently, Nepal operates on a 5:45 offset from UTC.

I am unsure how longitude and latitude are used in calculating the Bikram date. The correct day and month transitions can vary depending on the time and location used, causing discrepancies in the month-changing day. I am still working on understanding these discrepancies by comparing available data.

@sumanchapai
Copy link

@khumnath thanks for the info. The work you're doing is important. Please let us know if we can be of help in any way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

3 participants