Use tzinfo.tzname instead of key to display timezone on cron
key is a specific to ZoneInfo implementation when tzname is part tzinfo API. Closes #12036
This commit is contained in:
@@ -103,7 +103,7 @@ class Cron(DeactivableMixin, ModelSQL, ModelView):
|
||||
table_h.not_null_action('next_call', 'remove')
|
||||
|
||||
def get_timezone(self, name):
|
||||
return tz.SERVER.key
|
||||
return tz.SERVER.tzname(datetime.datetime.now())
|
||||
|
||||
@classmethod
|
||||
def check_xml_record(cls, crons, values):
|
||||
|
||||
@@ -462,5 +462,12 @@ class IrCronTestCase(unittest.TestCase):
|
||||
cron.compute_next_call(datetime.datetime(2022, 11, 6, 7, 30)),
|
||||
datetime.datetime(2022, 11, 6, 8, 30))
|
||||
|
||||
@with_transaction()
|
||||
def test_get_timezone(self):
|
||||
"Test get_timezone"
|
||||
cron = self._get_cron()
|
||||
|
||||
self.assertIsInstance(cron.get_timezone('timezone'), str)
|
||||
|
||||
|
||||
del ModuleTestCase
|
||||
|
||||
Reference in New Issue
Block a user