# Graphical schedule

**URL:** <https://community.gladysassistant.com/t/horaire-graphique/7347>\
**Category:** Configuration\
**Created:** [June 3, 2022, 7:36am UTC](https://community.gladysassistant.com/t/horaire-graphique/7347 "2022-06-03T07:36:47Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [June 7, 2022, 9:47am UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/21 "2022-06-07T09:47:52Z")

</div>

Ok! It’s a real bug then, I created an issue to keep track of the error:

> <https://github.com/GladysAssistant/Gladys/issues/1554>
>
> https://community.gladysassistant.com/t/horaire-graphique/7347/20?u=pierre-gille…s

If someone can reproduce it on their side and wants to propose a fix, I’d appreciate it!! 🙂

---

<div class="post-metadata">

**Author:** ![Will\_71](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/will_71/32/9582_2.png) [@Will\_71](https://community.gladysassistant.com/u/Will_71)\
**Post date:** [June 7, 2022, 8:14pm UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/22 "2022-06-07T20:14:48Z")

</div>

@pierre-gilles, To be sure, I checked with another sensor. For this example, an Aqara temperature and humidity sensor.

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/e/e02486070a5c2b89d5e2e55e7a6bc1abc9dd1dac.png)

Here a humidity

---

<div class="post-metadata">

**Author:** ![VonOx](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/vonox/32/10128_2.png) [@VonOx](https://community.gladysassistant.com/u/VonOx)\
**Post date:** [June 7, 2022, 8:52pm UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/23 "2022-06-07T20:52:29Z")

</div>

In the database the time zone is incorrect

---

<div class="post-metadata">

**Author:** ![Will\_71](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/will_71/32/9582_2.png) [@Will\_71](https://community.gladysassistant.com/u/Will_71)\
**Post date:** [June 7, 2022, 8:57pm UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/24 "2022-06-07T20:57:37Z")

</div>

That seemed correct for @pierre-gilles

> [@pierre-gilles](#):
>
> The time in the DB seems fine to me; in the database the data was recorded in the UTC timezone (indicated by the +00:00 at the end of the datetime, so indeed 2 hours behind French time)

---

<div class="post-metadata">

**Author:** ![VonOx](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/vonox/32/10128_2.png) [@VonOx](https://community.gladysassistant.com/u/VonOx)\
**Post date:** [June 7, 2022, 9:01pm UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/25 "2022-06-07T21:01:36Z")

</div>

Ah yes, exactly — it’s stored in UTC.

However, it’s returned with an incorrect datetime (-2h compared to the database)

---

<div class="post-metadata">

**Author:** ![Will\_71](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/will_71/32/9582_2.png) [@Will\_71](https://community.gladysassistant.com/u/Will_71)\
**Post date:** [June 7, 2022, 9:17pm UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/26 "2022-06-07T21:17:10Z")

</div>

A problem during aggregation?

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [June 8, 2022, 7:15am UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/27 "2022-06-08T07:15:54Z")

</div>

In my opinion it’s more of a problem in the API route, but I haven’t been able to look yet 🙂

---

<div class="post-metadata">

**Author:** ![bertrandda](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/bertrandda/32/5929_2.png) [@bertrandda](https://community.gladysassistant.com/u/bertrandda)\
**Post date:** [July 5, 2022, 9:35pm UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/28 "2022-07-05T21:35:45Z")

</div>

Hi, having the same issue on my instance, I started a fix

> <https://github.com/GladysAssistant/Gladys/pull/1566>
>
> \### Pull Request check-list
> 
> To ensure your Pull Request can be accepted as fa…st as possible, make sure to review and check all of these items:
> 
> \- \[x\] If your changes affects code, did your write the tests?
> \- \[x\] Are tests passing? (\`npm test\` on both front/server)
> \- \[x\] Is the linter passing? (\`npm run eslint\` on both front/server)
> \- \[x\] Did you run prettier? (\`npm run prettier\` on both front/server)
> \- \[x\] Did you test this pull request in real life? With real devices? If this development is a big feature or a new service, we recommend that you provide a Docker image to \[the community\](https://community.gladysassistant.com/) for testing before merging.
> 
> NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.
> 
> \### Description of change
> 
> DeviceStateAgregate are saved with an UTC datetime, when we load it for sampling we need to specify that it's an UTC date
> 
> ~~⚠️ need to be sure that all device state agregates are always store with UTC datetime~~
> 
> Fix #1554

But before marking the PR as ready for review I’d like to understand why it works for some and not for others.

To explain, the saved date for the state to display is stored in UTC format (at least for @_Will_71 and me, both having this problem). But when we read this value in the aggregation retrieval API, we create a new date from that value; however the Date class seems to interpret it as a date in the machine’s timezone and then convert it back to UTC which causes a 2-hour shift (for the French time zone).

So first question: those whose graphs display the times correctly, can you tell me the format of the date of your aggregations in the database please?

---

<div class="post-metadata">

**Author:** ![Will\_71](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/will_71/32/9582_2.png) [@Will\_71](https://community.gladysassistant.com/u/Will_71)\
**Post date:** [July 6, 2022, 6:28am UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/29 "2022-07-06T06:28:21Z")

</div>

That reassures me, I feel less alone with this problem.

---

<div class="post-metadata">

**Author:** ![Tlse-vins](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/tlse-vins/32/6054_2.png) [@Tlse-vins](https://community.gladysassistant.com/u/Tlse-vins)\
**Post date:** [July 6, 2022, 7:23am UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/30 "2022-07-06T07:23:58Z")

</div>

I hadn’t seen it, but on my side there’s also a 2-hour difference.  
I hadn’t noticed this difference before checking this morning.

I’m on G-plus and can’t check the DB.

---

<div class="post-metadata">

**Author:** ![VonOx](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/vonox/32/10128_2.png) [@VonOx](https://community.gladysassistant.com/u/VonOx)\
**Post date:** [July 6, 2022, 8:39am UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/31 "2022-07-06T08:39:02Z")

</div>

Looks OK on my end, I’ll check the DB ASAP

 ![IMG_20220706_103745](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/a/a8255ac71702abc750b2b159863f119106f4f56a.jpeg)

State:

![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/6/6552b7226797881ad353c76edf5ac96d5cd850ef.png)

Aggregation:

![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/6/699c79916da800d58a20abb8f45ed64edf43fc03.png)

So UTC

---

<div class="post-metadata">

**Author:** ![Will\_71](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/will_71/32/9582_2.png) [@Will\_71](https://community.gladysassistant.com/u/Will_71)\
**Post date:** [July 6, 2022, 11:20am UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/32 "2022-07-06T11:20:34Z")

</div>

@VonOx can you check your graph with the 24-hour view.  
I don’t have any issue for the last hour, but I do for the last 24 hours.

---

<div class="post-metadata">

**Author:** ![VonOx](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/vonox/32/10128_2.png) [@VonOx](https://community.gladysassistant.com/u/VonOx)\
**Post date:** [July 6, 2022, 12:36pm UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/33 "2022-07-06T12:36:31Z")

</div>

I confirm the 2-hour shift on the 24-hour graph

---

<div class="post-metadata">

**Author:** ![bertrandda](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/bertrandda/32/5929_2.png) [@bertrandda](https://community.gladysassistant.com/u/bertrandda)\
**Post date:** [July 6, 2022, 6:02pm UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/34 "2022-07-06T18:02:11Z")

</div>

So for now everyone has the problem.  
@Terdious you say it works for you; in your screenshots your graphs are on the last hour. Can you check what it looks like over 24h, please?

---

<div class="post-metadata">

**Author:** ![VonOx](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/vonox/32/10128_2.png) [@VonOx](https://community.gladysassistant.com/u/VonOx)\
**Post date:** [July 6, 2022, 6:04pm UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/35 "2022-07-06T18:04:18Z")

</div>

Do you want me to patch my prod to test your fix?

---

<div class="post-metadata">

**Author:** ![bertrandda](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/bertrandda/32/5929_2.png) [@bertrandda](https://community.gladysassistant.com/u/bertrandda)\
**Post date:** [July 6, 2022, 6:40pm UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/36 "2022-07-06T18:40:07Z")

</div>

If you want to try, yes I’d be happy to, thanks, but I can create a dev image for you if that’s easier

---

<div class="post-metadata">

**Author:** ![Terdious](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/terdious/32/6316_2.png) [@Terdious](https://community.gladysassistant.com/u/Terdious)\
**Post date:** [July 6, 2022, 9:38pm UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/37 "2022-07-06T21:38:34Z")

</div>

I also confirm the 2-hour offset on the graphs of the last 24 hours!!^^

---

<div class="post-metadata">

**Author:** ![bertrandda](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/bertrandda/32/5929_2.png) [@bertrandda](https://community.gladysassistant.com/u/bertrandda)\
**Post date:** [July 7, 2022, 7:32am UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/38 "2022-07-07T07:32:23Z")

</div>

Ok thanks Thomas.  
So the fix is ready, I’m starting to create a test image for anyone who wants one

---

<div class="post-metadata">

**Author:** ![VonOx](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/vonox/32/10128_2.png) [@VonOx](https://community.gladysassistant.com/u/VonOx)\
**Post date:** [July 7, 2022, 9:06am UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/39 "2022-07-07T09:06:35Z")

</div>

I’ve patched, fix ok @bertrandda

---

<div class="post-metadata">

**Author:** ![bertrandda](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/bertrandda/32/5929_2.png) [@bertrandda](https://community.gladysassistant.com/u/bertrandda)\
**Post date:** [July 7, 2022, 10:35am UTC](https://community.gladysassistant.com/t/horaire-graphique/7347/40 "2022-07-07T10:35:05Z")

</div>

Thanks Vincent, for everyone else a test Docker image is available `bertrandda/gladys:fix-graph`

[Previous page](https://community.gladysassistant.com/t/horaire-graphique/7347.md?page=1)

[Next page](https://community.gladysassistant.com/t/horaire-graphique/7347.md?page=3)
