# Node Red, Docker on Synology does not honor the timezone, always selects UTC no matter what

**URL:** <https://discourse.nodered.org/t/node-red-docker-on-synology-does-not-honor-the-timezone-always-selects-utc-no-matter-what/14860>\
**Category:** General\
**Created:** [28 August 2019 17:11 UTC](https://discourse.nodered.org/t/node-red-docker-on-synology-does-not-honor-the-timezone-always-selects-utc-no-matter-what/14860 "2019-08-28T17:11:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pseudonoob](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pseudonoob/32/6819_2.png) [@pseudonoob](https://discourse.nodered.org/u/pseudonoob)\
**Post date:** [28 August 2019 17:11 UTC](https://discourse.nodered.org/t/node-red-docker-on-synology-does-not-honor-the-timezone-always-selects-utc-no-matter-what/14860/1 "2019-08-28T17:11:54Z")

</div>

Running on the latest version of Synology as of today, which has Docker and docker compose updated to very recent versions, this is what's in my compose file:

```auto
  nodered:
    container_name: nodered
    restart: always
    image: nodered/node-red-docker:v8
    user: root
    volumes:
      - /data/nodered:/data
      - /etc/TZ:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
       - "123:1880"
    environment:
      - TZ=America/Chicago

```

Before this Synology and Docker update, I never had an issue with the timezone set correctly within Node Red. In fact, all I needed was to use the TZ environment variable, but even with the added time mount point above it doesn't work.

All my other containers all have the correct timezone with the TZ variable. Only Node-Red has an issue with the wrong timezone.

Is this an issue with Node-RED in Docker? How to fix this?

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [28 August 2019 23:22 UTC](https://discourse.nodered.org/t/node-red-docker-on-synology-does-not-honor-the-timezone-always-selects-utc-no-matter-what/14860/2 "2019-08-28T23:22:17Z")

</div>

In settings.js add:

```auto
process.env.TZ = "America/Chicago";

```

---

<div class="post-metadata">

**Author:** ![pseudonoob](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pseudonoob/32/6819_2.png) [@pseudonoob](https://discourse.nodered.org/u/pseudonoob)\
**Post date:** [31 August 2019 01:58 UTC](https://discourse.nodered.org/t/node-red-docker-on-synology-does-not-honor-the-timezone-always-selects-utc-no-matter-what/14860/3 "2019-08-31T01:58:56Z")

</div>

That did the trick! Thank you.

---

<div class="post-metadata">

**Author:** ![balthisar](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/balthisar/32/21428_2.png) [@balthisar](https://discourse.nodered.org/u/balthisar)\
**Post date:** [7 May 2020 15:12 UTC](https://discourse.nodered.org/t/node-red-docker-on-synology-does-not-honor-the-timezone-always-selects-utc-no-matter-what/14860/4 "2020-05-07T15:12:03Z")

</div>

I'm late to the party, by _why_ did this work? My setup was pretty much the same as the OP's, and I've been struggling for hours to get this to work, and that simple config change did it. Part of me wants to say "hey, thanks!" because it solves my issue, but most of me wants to think that something else is broken.

For example, my host time and zone were correct; the container time and zone were correct, and only Node Red was wrong.

Since it's working, thanks!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 May 2020 15:33 UTC](https://discourse.nodered.org/t/node-red-docker-on-synology-does-not-honor-the-timezone-always-selects-utc-no-matter-what/14860/5 "2020-05-07T15:33:32Z")

</div>

> [@balthisar](#):
>
> the container time and zone were correct,

How are you setting it and testing it for the container?

---

<div class="post-metadata">

**Author:** ![balthisar](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/balthisar/32/21428_2.png) [@balthisar](https://discourse.nodered.org/u/balthisar)\
**Post date:** [7 May 2020 16:00 UTC](https://discourse.nodered.org/t/node-red-docker-on-synology-does-not-honor-the-timezone-always-selects-utc-no-matter-what/14860/6 "2020-05-07T16:00:50Z")

</div>

Similar as the OP:

```auto
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone
- TZ='America/Detroit'

```

In the correct spots, of course, just as I do for many other containers. I verify the date and timezone by exec'ing into the container and using `date`.

From earlier this morning, results of `date`:

On the server: Thu May 7 09:39:21 EDT 2020  
Inside my container: Thu May 7 09:38:21 EDT 2020  
On my local machine running browser: Thu May 7 09:38:26 EDT 2020  
In Chrome's JS console: Thu May 07 2020 9:41:50 GMT-0400 (Eastern Daylight Time)

The debug window showed the correct time for debug messages. I'm not sure if this comes from the browser or server. Actual message content from the server, as well as node status text (presumably from the server, not the browser) we all off by two hours.

```auto
msg.payload['date'] = new Date();
msg.payload['localedate'] = new Date().toLocaleString();
msg.payload['offset'] = new Date().getTimezoneOffset();
msg.payload['iso'] = new Date().toISOString();
msg.payload['tzname'] = Intl.DateTimeFormat().resolvedOptions().timeZone;

```

Gave me this:

```auto
date: "2020-05-07T13:49:03.895Z"
localedate: "5/7/2020, 7:49:03 AM"
offset: 360
iso: "2020-05-07T13:49:03.895Z"
tzname: "Etc/GMT+5"

```

That 360 offset is two hours different than the correct offset, and I have no idea where that's coming from, but might explain the two hour difference.

And today I learned about "Etc", but no idea where that's coming from. The container is properly configured for EDT.

Trying schedex with a 10:15 on an 10:16 off gave me:

```auto
info:
on: "2020-05-07T10:15:00.000-06:00"
off: "2020-05-07T10:16:00.000-06:00"

info_local:
on: "Thu, 07 May 2020 16:15:00 GMT"
off: "Thu, 07 May 2020 16:16:00 GMT"

```

So it was really confused.

Adding the `process.env.TZ` fixed everything. It's all perfect now.
