Skip to content
This repository was archived by the owner on Sep 22, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion persiantools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

__title__ = "persiantools"
__url__ = "https://github.com/mhajiloo/persiantools"
__version__ = "1.4.1"
__version__ = "1.6.0"
__build__ = __version__
__author__ = "Majid Hajiloo"
__author_email__ = "majid.hajiloo@gmail.com"
Expand Down
9 changes: 6 additions & 3 deletions persiantools/jdatetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def ctime(self):

def strftime(self, fmt, locale=None):
if locale is None or locale not in ["fa", "en"]:
locale = self._locale
locale = self.locale

month_names = MONTH_NAMES_EN if locale == "en" else MONTH_NAMES_FA
month_names_abbr = MONTH_NAMES_ABBR_EN if locale == "en" else MONTH_NAMES_ABBR_FA
Expand Down Expand Up @@ -977,7 +977,10 @@ def __repr__(self):
def __str__(self):
return self.isoformat(sep=" ")

def strftime(self, fmt):
def strftime(self, fmt, locale=None):
if locale is None or locale not in ["fa", "en"]:
locale = self.locale

datetime = self.to_gregorian()

format_time = {
Expand All @@ -997,7 +1000,7 @@ def strftime(self, fmt):

result = utils.replace(fmt, format_time)

result = super(JalaliDateTime, self).strftime(result, "en")
result = super(JalaliDateTime, self).strftime(result, locale)

return result

Expand Down