Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong time in new Date #1108

Open
davidschrooten opened this issue Sep 17, 2019 · 3 comments
Open

Wrong time in new Date #1108

davidschrooten opened this issue Sep 17, 2019 · 3 comments

Comments

@davidschrooten
Copy link

#626

Having this same issue on node:10-alpine. Tried solution from issue above and whatever I could find in gliderlabs/docker-alpine/issues/136. But to no avail. When doing console.log(new Date()) the issue persists in node.js; time differs minus 2 hours from what busybox says when running the date command.

@davidschrooten
Copy link
Author

My Dockerfile

FROM node:10-alpine

ENV TZ=Europe/Amsterdam

RUN apk --update add \
		tzdata \
	&& cp /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
	&& apk del tzdata

RUN apk --no-cache --virtual temp add build-base \
                       autoconf \
                       curl

RUN apk --no-cache add zeromq-dev \
                       python2 && \
    curl -Ls "https://github.com/dustinblackman/phantomized/releases/download/2.1.1/dockerized-phantomjs.tar.gz" | tar xz -C /

ENV PYTHON /usr/bin/python2

ADD ./bin /home/node/app/bin
ADD ./packages /home/node/app/packages
ADD ./package.json /home/node/app/package.json
ADD ./npm-shrinkwrap.json /home/node/app/npm-shrinkwrap.json
ADD ./lerna.json /home/node/app/lerna.json

WORKDIR /home/node/app

RUN npm ci

WORKDIR /home/node/app/packages/lib-helpers

RUN npm install zeromq --zmq-external

WORKDIR /home/node/app

RUN npm run bootstrap && \
    npm rebuild && \
    apk del temp

RUN find . -name ".env" -type f -delete

@ex1st
Copy link

ex1st commented Nov 6, 2019

Node.js (> v10) doesn't use system's tzdata anymore, ICU has its own tzdata. Maybe is it a reason?

@stringang
Copy link

Node.js gets its timezone data from the ICU library, aka International Components for Unicode.

ICU can be changed by configuration during compilation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@ex1st @stringang @davidschrooten and others