ソースを参照

Fix wrong dates shown on table listing

Toni Fadjukoff 5 年 前
コミット
3d13dcdba3
共有1 個のファイルを変更した2 個の追加1 個の削除を含む
  1. 2 1
      food.py

+ 2 - 1
food.py ファイルの表示

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