From e6992aa81e11f46d95d0dc4e1e6eeb4eb2eae165 Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Fri, 21 Feb 2020 10:51:08 +0100
Subject: [PATCH] New date handling for year

---
 source/src/index.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/source/src/index.js b/source/src/index.js
index 97b08e3..a96c346 100644
--- a/source/src/index.js
+++ b/source/src/index.js
@@ -219,10 +219,11 @@ function aggregating(data, doctype) {
   const reducer = (accumulator, currentValue) => accumulator + currentValue.load
   if (doctype === rangeDate.an.doctype) {
     const year = moment().year()
+    // console.log(data)
     var filtered = data.filter(function(el) {
       return el.year == year
     })
-    const time = moment()
+    const time = moment().startOf('year')
     return [
       {
         load: filtered.reduce(reducer, 0),
-- 
GitLab