浏览代码

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