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

Getting day of month out of range error. #14

Closed
vector65536 opened this issue Nov 27, 2020 · 2 comments
Closed

Getting day of month out of range error. #14

vector65536 opened this issue Nov 27, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@vector65536
Copy link

vector65536 commented Nov 27, 2020

Hi. I have been getting this day of month out of range error when trying to convert date to nepali; and format time.

While rendering Jestha 31, 2077

import nepali_datetime
from datetime import timedelta, datetime

somedate = datetime(2020, 6, 13, 19, 15, 20, 231407) 
jeth_31 = nepali_datetime.date.from_datetime_date(somedate.date())
jeth_31.strftime("%d %N %Y")            
# 31 जेष्ठ

Meanwhile Jestha 32, 2077

otherdate = datetime(2020, 6, 14, 19, 15, 20, 231407) 
jeth_32 = nepali_datetime.date.from_datetime_date(otherdate.date())
jeth_32.strftime("%d %N %Y") 
# day of month out of range error

Dunno if this is related with (Nepali) months with 32 date or something in the package itself.
If it helps, I am using Python 3.9, nepali-datetime 1.0.4.

Edit:: Update: Getting same error for Shrawan 32.

@vector65536
Copy link
Author

Hi. sorry for the late reply.
Assuming the same code above,

jeth_31.strftime("%d %N %Y")          # produces '31 जेष्ठ 2077'

# Meanwhile
jeth_32.strftime("%d %N %Y")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\user\Python\Python39\lib\site-packages\nepali_datetime\__init__.py", line 422, in strftime
    return _wrap_strftime(self, fmt, self.timetuple())
  File "C:\Users\user\Python\Python39\lib\site-packages\nepali_datetime\__init__.py", line 130, in _wrap_strftime
    return _time.strftime(newformat, timetuple)
ValueError: day of month out of range

@amitgaru2 amitgaru2 self-assigned this Nov 28, 2020
@amitgaru2 amitgaru2 added the bug Something isn't working label Nov 28, 2020
@amitgaru2
Copy link
Owner

Fixed with v1.0.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants