mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
Fixes issues when using system default for Date format, it will now properly display it in your locale.
This commit is contained in:
parent
58e0b58a0f
commit
9a23bfd0f5
@ -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
|
Loading…
Reference in New Issue
Block a user