Reputation: 33
I'm working in a project where i've to implement Nepali calender. The calender is working fine but django validation does not accept the date. The date selected is valid according to BS (Bikram Sambat) calender but it is not valid as per AD calender. If i choose the date upto 2077-04-30 it works fine but it does not accept 31 and 32 on 4th month. There are 32 days on 4th month of BS calender. How can i make django accept this date?
Any suggestion is highly appreciated. Thanks.
Upvotes: 1
Views: 221
Reputation: 317
Its because you might be using DateField()
in your model / form. And DateField
works on top of AD date. Since in AD 4th month (i.e April) doesn't have 32 days, so its showing you the error.
I have developed NepaliDateField()
which works on top of Bikram Sambat (B.S) date, that you can implement & should solve your problem. Check it out here.
Upvotes: 2