nestjs - 如何在 Nestjs 中设置默认时区?

标签 nestjs nestjs-config

我试过下面的脚本,但没有成功。

{
  "scripts": {
    "start": "TZ='UTC' nest start"
  }
}

[系统信息]
操作系统版本:Linux 5.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"

关于nestjs - 如何在 Nestjs 中设置默认时区?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63630805/

相关文章:

node.js - Nestjs 中的 Observables - 异步读取文件

node.js - 为什么 useFactory 选项会让我在 Nestjs 配置中出错?

reactjs - eslint + jsconfig + nextjs 模块路径别名(绝对路径导入 - @)

typescript - 如何将 NestJS 配置注入(inject) TypeORM 实体?

NestJS/中间件是否实例化为单例?

javascript - 如何使用类验证器验证多种类型的嵌套数组?

jestjs - 我可以在 NestJS 中的 .spec.ts 之外使用 Jest 的 Expect() 吗?

node.js - Nestjs:如何使用nest/cli 从nestjs monorepo 中删除特定应用程序

javascript - NestJS无法解析JWT_MODULE_OPTIONS的依赖关系(同样的问题,不同的解决方案)