From d3aecbd75065977838a4b1f68a01b21543bfb50b Mon Sep 17 00:00:00 2001 From: AmirHossein Habibvand Date: Thu, 13 Feb 2020 13:33:51 +0330 Subject: [PATCH 1/5] Fix jalaidatetime strftime locale --- persiantools/jdatetime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persiantools/jdatetime.py b/persiantools/jdatetime.py index 92a1283..b1b822d 100644 --- a/persiantools/jdatetime.py +++ b/persiantools/jdatetime.py @@ -997,7 +997,7 @@ def strftime(self, fmt): result = utils.replace(fmt, format_time) - result = super(JalaliDateTime, self).strftime(result, "en") + result = super(JalaliDateTime, self).strftime(result, self.locale) return result From 778431a8e02d7f57d45b5a0912d4d85a73879fbb Mon Sep 17 00:00:00 2001 From: AmirHossein Habibvand Date: Thu, 13 Feb 2020 13:34:02 +0330 Subject: [PATCH 2/5] Version 1.5.0 --- persiantools/__init__.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/persiantools/__init__.py b/persiantools/__init__.py index 675c5ae..b037c7b 100644 --- a/persiantools/__init__.py +++ b/persiantools/__init__.py @@ -9,7 +9,7 @@ __title__ = "persiantools" __url__ = "https://github.com/mhajiloo/persiantools" -__version__ = "1.4.1" +__version__ = "1.5.0" __build__ = __version__ __author__ = "Majid Hajiloo" __author_email__ = "majid.hajiloo@gmail.com" diff --git a/setup.py b/setup.py index 8b26e36..e05c6c3 100644 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ def readme(): ], keywords="jalali shamsi persian digits characters converter jalalidate " "jalalidatetime date datetime jdate jdatetime", - url="https://github.com/mhajiloo/persiantools", + url="https://github.com/amirhbv/persiantools", author="Majid Hajiloo", author_email="majid.hajiloo@gmail.com", license="MIT", From 3cbbc492dd12f9351512b19767e15f522a36a787 Mon Sep 17 00:00:00 2001 From: AmirHossein Habibvand Date: Thu, 13 Feb 2020 13:41:10 +0330 Subject: [PATCH 3/5] Add locale to jalaidatetime strftime --- persiantools/jdatetime.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/persiantools/jdatetime.py b/persiantools/jdatetime.py index b1b822d..6d0a06b 100644 --- a/persiantools/jdatetime.py +++ b/persiantools/jdatetime.py @@ -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 @@ -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 = { @@ -997,7 +1000,7 @@ def strftime(self, fmt): result = utils.replace(fmt, format_time) - result = super(JalaliDateTime, self).strftime(result, self.locale) + result = super(JalaliDateTime, self).strftime(result, locale) return result From 7d6d3ed9c1c009fa91697ff5b2c7a0ec1ea1235b Mon Sep 17 00:00:00 2001 From: AmirHossein Habibvand Date: Thu, 13 Feb 2020 13:41:46 +0330 Subject: [PATCH 4/5] Version 1.6.0 --- persiantools/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persiantools/__init__.py b/persiantools/__init__.py index b037c7b..c5da831 100644 --- a/persiantools/__init__.py +++ b/persiantools/__init__.py @@ -9,7 +9,7 @@ __title__ = "persiantools" __url__ = "https://github.com/mhajiloo/persiantools" -__version__ = "1.5.0" +__version__ = "1.6.0" __build__ = __version__ __author__ = "Majid Hajiloo" __author_email__ = "majid.hajiloo@gmail.com" From b3e56a59372a7a90f430b5200021fbf3eb921fb7 Mon Sep 17 00:00:00 2001 From: AmirHossein Habibvand Date: Thu, 13 Feb 2020 13:44:15 +0330 Subject: [PATCH 5/5] Fix repo url --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e05c6c3..8b26e36 100644 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ def readme(): ], keywords="jalali shamsi persian digits characters converter jalalidate " "jalalidatetime date datetime jdate jdatetime", - url="https://github.com/amirhbv/persiantools", + url="https://github.com/mhajiloo/persiantools", author="Majid Hajiloo", author_email="majid.hajiloo@gmail.com", license="MIT",