首页 > 解决方案 > 我如何将角度 cli 日期更改为本地时区?

问题描述

我使用ng serve并且当我更改某些文件时,Angular CLI 将显示这样的日期

Date: 2018-08-26T13:55:06.527Z - Hash: be4766fc643be6692ac3 - Time: 126ms

但这Date:2018-08-26T13:55:06.527Z不是我的当地时间。

如何将角度 cli 日期更改为本地时区?我国的时区是台湾的UTC+8

在此处输入图像描述

标签: angular-cliangular-cli-v6

解决方案


代码来看,我认为这是不可能的:

export function generateBuildStats(hash: string, time: number, colors: boolean): string {
  const w = (x: string) => colors ? bold(white(x)) : x;
  return `Date: ${w(new Date().toISOString())} - Hash: ${w(hash)} - Time: ${w('' + time)}ms`
}

推荐阅读