如何在 Nestjs 中设置默认时区?
How to set default time zone in Nestjs?
我试过下面的脚本,但没有用。
{
"scripts": {
"start": "TZ='UTC' nest start"
}
}
[系统信息]
OS版本:Linux5.4
NodeJS 版本:v12.18.3
NPM 版本:6.14.6
[Nest CLI]
Nest CLI 版本:7.4.1
[Nest 平台信息]
platform-express 版本:7.0.0
护照版本:7.0.0
typeorm 版本:7.1.0
普通版本:7.0.0
配置版本:0.5.0
核心版本:7.0.0
智威汤逊版本:7.0.0
在 REPL 中,这按预期工作。
TZ=UTC node
> d = new Date()
> d.toLocaleTimeString()
我假设您需要将启动命令设置为
"start": "TZ=UTC nest start"
我试过下面的脚本,但没有用。
{
"scripts": {
"start": "TZ='UTC' nest start"
}
}
[系统信息]
OS版本:Linux5.4
NodeJS 版本:v12.18.3
NPM 版本:6.14.6
[Nest CLI]
Nest CLI 版本:7.4.1
[Nest 平台信息]
platform-express 版本:7.0.0
护照版本:7.0.0
typeorm 版本:7.1.0
普通版本:7.0.0
配置版本:0.5.0
核心版本:7.0.0
智威汤逊版本:7.0.0
在 REPL 中,这按预期工作。
TZ=UTC node
> d = new Date()
> d.toLocaleTimeString()
我假设您需要将启动命令设置为
"start": "TZ=UTC nest start"