コード例 #1
0
def test_localize_naive(use_hour_format):

    dt = datetime.utcnow()
    dt_hour = dt.strftime("%H")

    localized_dt_hour = util.localize(dt)

    assert localized_dt_hour == dt_hour
コード例 #2
0
def test_localize_aware(use_tz):
    utc_dt = timezone.now()

    local_dt = timezone.localtime(utc_dt)
    local_dt_hour = local_dt.strftime("%H")

    localized_dt_hour = util.localize(utc_dt)

    assert localized_dt_hour == local_dt_hour
コード例 #3
0
ファイル: admin.py プロジェクト: missterr/django-apscheduler
 def run_time_sec(self, obj):
     return util.localize(obj.run_time)
コード例 #4
0
ファイル: admin.py プロジェクト: missterr/django-apscheduler
 def next_run_time_sec(self, obj):
     if obj.next_run_time is None:
         return "(paused)"
     return util.localize(obj.next_run_time)
コード例 #5
0
 def __str__(self):
     status = 'next run at: %s' % util.localize(
         self.next_run_time) if self.next_run_time else 'paused'
     return '%s (%s)' % (self.name, status)
コード例 #6
0
 def next_run_time_sec(self, obj):
     return util.localize(obj.next_run_time)