From 9a23bfd0f58d6e444011732b577ecba1d73d33fd Mon Sep 17 00:00:00 2001 From: echel0n Date: Sat, 17 May 2014 00:56:41 -0700 Subject: [PATCH] Fixes issues when using system default for Date format, it will now properly display it in your locale. --- sickbeard/sbdatetime.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sickbeard/sbdatetime.py b/sickbeard/sbdatetime.py index b7af2d32..06826fc1 100644 --- a/sickbeard/sbdatetime.py +++ b/sickbeard/sbdatetime.py @@ -94,13 +94,14 @@ class static_or_instance(object): # subclass datetime.datetime to add function to display custom date and time formats class sbdatetime(datetime.datetime): has_locale = True + ORIG_LC_TIME = locale.LC_TIME # display Time in Sickbeard Format @static_or_instance def sbftime(self, dt=None, show_seconds=False, t_preset=None): try: - locale.setlocale(locale.LC_TIME, '') + locale.setlocale(locale.LC_TIME, self.ORIG_LC_TIME) except: pass @@ -129,7 +130,7 @@ class sbdatetime(datetime.datetime): finally: try: if sbdatetime.has_locale: - locale.setlocale(locale.LC_TIME, '') + locale.setlocale(locale.LC_TIME, self.ORIG_LC_TIME) except: sbdatetime.has_locale = False return strt @@ -139,7 +140,7 @@ class sbdatetime(datetime.datetime): def sbfdate(self, dt=None, d_preset=None): try: - locale.setlocale(locale.LC_TIME, '') + locale.setlocale(locale.LC_TIME, self.ORIG_LC_TIME) except: pass @@ -164,7 +165,7 @@ class sbdatetime(datetime.datetime): def sbfdatetime(self, dt=None, show_seconds=False, d_preset=None, t_preset=None): try: - locale.setlocale(locale.LC_TIME, '') + locale.setlocale(locale.LC_TIME, self.ORIG_LC_TIME) except: pass @@ -206,7 +207,7 @@ class sbdatetime(datetime.datetime): finally: try: if sbdatetime.has_locale: - locale.setlocale(locale.LC_TIME, '') + locale.setlocale(locale.LC_TIME, self.ORIG_LC_TIME) except: sbdatetime.has_locale = False return strd \ No newline at end of file