Closed lordk911 closed 2 months ago
I deploy dify use k8s helm : https://github.com/douban/charts/tree/master/charts/dify
I've set the sandbox container env:
- name: TZ
value: "Asia/Shanghai"
and go into the container:
But why In dify when exec code in python it still use UTC timezone
1、go into the containser anf exec : ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
, can work it out
Thanks so much for reporting this, I have fixed it.
@Yeuoly I set the TZ environment in dockerfile,but still not work. In dockerfile
# 设置时区为上海
ENV TZ=Asia/Shanghai
RUN rm -rf /var/lib/apt/lists/* \
&& chmod +x /main \
&& chmod +x /env \
&& pip3 install jinja2 requests httpx PySocks httpx[socks] \
&& wget -O /opt/node-v20.11.1-linux-x64.tar.xz https://npmmirror.com/mirrors/node/v20.11.1/node-v20.11.1-linux-x64.tar.xz \
&& tar -xvf /opt/node-v20.11.1-linux-x64.tar.xz -C /opt \
&& ln -s /opt/node-v20.11.1-linux-x64/bin/node /usr/local/bin/node \
&& rm -f /opt/node-v20.11.1-linux-x64.tar.xz \
&& /env \
&& rm -f /env \
&& ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo Asia/Shanghai > /etc/timezone \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& rm -rf /var/lib/apt/lists/*
My Code Request:
// request
{
"language":"nodejs",
"code":"console.log(new Date('2024-10-03 15:26:49').getTime())"
}
// response
{
"code": 200,
"message": "success",
"data": {
"error": "",
"stdout": "1727969209000\n"
}
}
// console.log(new Date(1727969209000)) // Thu Oct 03 2024 23:26:49 GMT+0800 (China Standard Time)
when :
it will use the default UTC timezone
when :
will got error:
operation not permitted