You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2017/09/12 11:35:36 UTC

incubator-ponymail git commit: Bug: stats.lua should use UTC for calculating year and month

Repository: incubator-ponymail
Updated Branches:
  refs/heads/master 5ee25e85b -> 75e3dd18c


Bug: stats.lua should use UTC for calculating year and month

This fixes #409

Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/75e3dd18
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/75e3dd18
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/75e3dd18

Branch: refs/heads/master
Commit: 75e3dd18c07f3dfecf4130989193dcd7d0d0c292
Parents: 5ee25e8
Author: Sebb <se...@apache.org>
Authored: Tue Sep 12 12:35:32 2017 +0100
Committer: Sebb <se...@apache.org>
Committed: Tue Sep 12 12:35:32 2017 +0100

----------------------------------------------------------------------
 CHANGELOG.md       |  1 +
 site/api/stats.lua | 10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/75e3dd18/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d8091c3..f62dfcd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,5 @@
 ## CHANGES in 0.10:
+- Bug: stats.lua should use UTC for calculating year and month (#409)
 - Bug: atom.lua - should generate date in UTC, not local time (#408)
 - Bug: shorten links does not work with cluster ids (#406)
 - Drop lid from 'cluster' hash - it's already in the id (#400)

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/75e3dd18/site/api/stats.lua
----------------------------------------------------------------------
diff --git a/site/api/stats.lua b/site/api/stats.lua
index 0c14932..b9c913f 100644
--- a/site/api/stats.lua
+++ b/site/api/stats.lua
@@ -487,12 +487,12 @@ function handle(r)
         end
     end
 
-    -- extract years and months for response
-    datespan.firstYear = tonumber(os.date("%Y", first))
-    datespan.firstMonth = tonumber(os.date("%m", first))
+    -- extract years and months for response (using UTC, i.e. leading !)
+    datespan.firstYear = tonumber(os.date("!%Y", first))
+    datespan.firstMonth = tonumber(os.date("!%m", first))
 
-    datespan.lastYear = tonumber(os.date("%Y", last))
-    datespan.lastMonth = tonumber(os.date("%m", last))
+    datespan.lastYear = tonumber(os.date("!%Y", last))
+    datespan.lastMonth = tonumber(os.date("!%m", last))
     
     -- Debug time point 4
     if DEBUG then