小编use*_*541的帖子

如何在Angular 2类中使用moment-timezone?

我想在课堂上使用时刻时区.这是我的打字.

"moment": "github:DefinitelyTyped/DefinitelyTyped/moment/moment.d.ts#a1575b96ec38e916750629839d2110cb96210f89",
"moment-timezone": "github:DefinitelyTyped/DefinitelyTyped/moment-timezone/moment-timezone.d.ts#f8a90040348e83926f44e690b209769c4f88b961"
Run Code Online (Sandbox Code Playgroud)

我的进口:

import * as moment from 'moment';
import * as tz from 'moment-timezone';
Run Code Online (Sandbox Code Playgroud)

我的用法:

var jun = moment("2014-06-01T12:00:00Z");
jun.tz('America/Los_Angeles').format('ha z');
Run Code Online (Sandbox Code Playgroud)

我的错误:

Property 'tz' does not exist on type 'Moment'.
Run Code Online (Sandbox Code Playgroud)

javascript typescript angular

12
推荐指数
4
解决办法
2万
查看次数

标签 统计

angular ×1

javascript ×1

typescript ×1