slashmili / python-jalali

Jalali calendar binding for Python based on Python's datetime module
http://pypi.python.org/pypi/jdatetime/
Other
339 stars 47 forks source link

Add support for jalali months in persian alphabets in strftime #96

Closed mojixcoder closed 2 years ago

mojixcoder commented 2 years ago

Now we have %B which gives us Azar for example.

I've added %E which gives us آذر‍ in this case.

mojixcoder commented 2 years ago

I have worked on the change str.replace TODO (in strftime method).
But I don't wanna push yet because it will be mixed with this pull request if I push my changes.
Is this PR gonna be merged soon? or is it possible to open two pull requests at the same time?

hramezani commented 2 years ago

I have worked on the change str.replace TODO (in strftime method).

Good to hear!

But I don't wanna push yet because it will be mixed with this pull request if I push my changes. Is this PR gonna be merged soon? or is it possible to open two pull requests at the same time?

You can create a new PR for that change. Don't add that change to this patch.

slashmili commented 2 years ago

Thanks for your contribution.

I couldn't find %E directive in datetime docs. is it described in other docs %E? We avoid adding additional directive to be compatible with the official module.

mojixcoder commented 2 years ago

I think no we don't have since python doesn't have jalali dates.

hramezani commented 2 years ago

@MojixCoder it seems that we can get the month in Persian by setting locale in object creation. Thanks @slashmili for clarification.

mojixcoder commented 2 years ago

Yes we can do it, But for example in django-jalali when we are using jalali template tags. It's not that easy to set locale in templates. and it's also very common.

{% load jformat %}

{{ my_date|jformat:"%d %E %Y" }}

This is what I mean.

slashmili commented 2 years ago

just for sake of prosperity we discussed it in #98 for Django case, you need to set it in as LANGUAGE_CODE setting.