Kaynağa Gözat

Fix wrong dates shown on table listing

Toni Fadjukoff 5 yıl önce
ebeveyn
işleme
3d13dcdba3
1 değiştirilmiş dosya ile 2 ekleme ve 1 silme
  1. 2 1
      food.py

+ 2 - 1
food.py Dosyayı Görüntüle

1
 #!/usr/bin/env python3
1
 #!/usr/bin/env python3
2
 
2
 
3
 # Copyright 2018 Toni Fadjukoff. All Rights Reserved.
3
 # Copyright 2018 Toni Fadjukoff. All Rights Reserved.
4
+# Copyright 2019 Google LLC. All Rights Reserved.
4
 #
5
 #
5
 # Licensed under the Apache License, Version 2.0 (the "License");
6
 # Licensed under the Apache License, Version 2.0 (the "License");
6
 # you may not use this file except in compliance with the License.
7
 # you may not use this file except in compliance with the License.
69
 if max_week >= 1 and max_week <= 52:
70
 if max_week >= 1 and max_week <= 52:
70
   # figure out the date range
71
   # figure out the date range
71
   while True:
72
   while True:
72
-    stamp_week = int(time.strftime("%W", time.localtime(stamp)))
73
+    stamp_week = datetime.datetime.utcfromtimestamp(stamp).isocalendar()[1]
73
     if stamp_week == max_week:
74
     if stamp_week == max_week:
74
             break
75
             break
75
     stamp += 3600*24
76
     stamp += 3600*24