anufrievroman / calcure

Modern TUI calendar and task manager with minimal and customizable UI.
https://anufrievroman.gitbook.io/calcure
MIT License
1.55k stars 44 forks source link

Fix Persian Calendar #61

Closed xmha97 closed 1 year ago

xmha97 commented 1 year ago

Hi, please fix the Persian Calendar. Thanks.

Screenshot

https://github.com/anufrievroman/calcure/assets/23485114/f6e31c80-2482-4a0f-a8bd-a97a096ed2e0

Log

[WARNING] Couldn't load birthdays. File. C:\Users\Muhammadhussein/.abook/addressbook does not exist.
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Muhammadhussein\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\calcure\__main__.py", line 1070, in <module>
    cli()
  File "C:\Users\Muhammadhussein\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\calcure\__main__.py", line 1064, in cli
    curses.wrapper(main)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1520.0_x64__qbz5n2kfra8p0\Lib\curses\__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Muhammadhussein\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\calcure\__main__.py", line 1012, in main
    monthly_screen_view.render()
  File "C:\Users\Muhammadhussein\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\calcure\__main__.py", line 803, in render
    day_number_view.render()
  File "C:\Users\Muhammadhussein\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\calcure\__main__.py", line 497, in render
    if self.screen.date == self.screen.today:
       ^^^^^^^^^^^^^^^^
  File "C:\Users\Muhammadhussein\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\calcure\screen.py", line 71, in date
    return jdatetime.date(self.year, self.month, self.day)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Muhammadhussein\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\jdatetime\__init__.py", line 252, in __init__
    raise ValueError("day is out of range for month")
ValueError: day is out of range for month
anufrievroman commented 1 year ago

Thank you for reporting! Okay, I was able to reproduce it, it seems to be related to some specific day in ORDIBEHESHT next year. Do you know if that might be a leap day or something like that? Also, besides that, the Persian calendar works correctly, right? I mean, I am not very familiar with this system, so I might miss some leap years or some minor features.

xmha97 commented 1 year ago

Yes, the Persian calendar is displayed correctly. In the Persian calendar, the first six months of the year always have 31 days and the next five months always have 30 days. The last month is always 30 days, except in the case of a leap year, which is 29 days.

anufrievroman commented 1 year ago

Fixed. Updated the pypi version.

p.s. please be careful when providing information. In fact, last month has 29 days, except the leap year, in which case it is 30.

xmha97 commented 1 year ago

Fixed. Updated the pypi version.

p.s. please be careful when providing information. In fact, last month has 29 days, except the leap year, in which case it is 30.

Thanks for your update 🙏 And sorry for my issue. 😓 I should have checked the text before posting.

anufrievroman commented 1 year ago

No problem :) I'll close this issue then.