Browse Source

Fix wrong dates shown on table listing

Toni Fadjukoff 5 years ago
parent
commit
3d13dcdba3
1 changed files with 2 additions and 1 deletions
  1. 2 1
      food.py

+ 2 - 1
food.py View File

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