feat: add English datepicker support and comprehensive documentation improvements

This commit adds English language support to the datepicker widget and includes major documentation enhancements with proper attribution.

New Features:
- add English language option to nepali-datepicker widget (language: 'english')
- datepicker now respects en=True field parameter for English month/day names
- automatic language detection based on DEFAULT_LANGUAGE setting

Documentation:
- add Credits section acknowledging nepali package and nepali-datepicker library
- improve FAQ formatting with proper spacing between questions

Bug Fixes:
- fix datepicker language selection logic to properly prioritize English mode
- correct nepali package attribution to opensource-nepal/py-nepali
- update nepali-datepicker GitHub link to correct repository

Technical Details:
- datepicker initialization now checks data-en attribute
- language priority: explicit ne=true > explicit en=true > default (English)
- English mode displays transliterated BS month names and Arabic numerals
This commit is contained in:
sankalp committed 2026-01-30 18:29:26 +05:45
1 parent fa255d0fcf
commit d447f456ba
2 files changed
+25 -6

No files matched your search

+16 -4
View File
@@ -169,11 +169,16 @@ Just like standard Django fields, pass `null=True, blank=True` to any `django-ne
No. The `YYYY-MM-DD` format is hardcoded to ensure database-level sorting and indexing work consistently. However, you can change the **display** format via global settings or template filters.
**Q: How do I get Devanagari (local script) digits in my API?**
**Q: Can I use Devanagari output?**
Yes. Pass `ne=True` to fields, forms, or serializers.
**Q: Can I display the datepicker in English?**
Yes. By default, if you pass `en=True` (or if `DEFAULT_LANGUAGE` is set to `"en"`), the datepicker will display month and day names in English instead of Devanagari script.
In your Serializer field or Model field, pass `ne=True`.
```python
birth_date = NepaliDateField(ne=True)
birth_date = NepaliDateField(en=True) # English month/day names in picker
```
**Q: Is the location data up to date?**
@@ -204,6 +209,13 @@ We welcome contributions and feedback from the community.
---
## 📄 License
## 🙏 Credits
This library is built on top of excellent open-source projects:
- **[nepali](https://github.com/opensource-nepal/py-nepali)** by [@opensource-nepal](https://github.com/opensource-nepal) - Provides the core `nepalidate`, `nepalidatetime` objects and regional location data (Provinces, Districts, Municipalities).
- **[Nepali Datepicker](https://nepalidatepicker.sajanmaharjan.com.np/)** by [Sajan Maharjan](https://github.com/sajanm/nepali-date-picker) - Powers the beautiful BS date picker widget in the Django Admin.
---
MIT License. Designed for the local Django ecosystem.
@@ -54,9 +54,16 @@
closeOnDateSelect: true
};
// Use Devanagari if data-ne attribute is present
if (el.dataset.ne === 'true') {
// Determine language based on data attributes
var useNepali = el.dataset.ne === 'true';
var useEnglish = el.dataset.en === 'true';
if (useNepali) {
// Devanagari digits and Nepali month/day names
options.unicodeDate = true;
} else if (useEnglish || (!useNepali && !el.dataset.ne)) {
// English month/day names and digits
options.language = 'english';
}
// Nepali Datepicker v5 exposes `element.NepaliDatePicker(options)`