时刻时区和Ionic2 datepicker

时间:2017-06-12 13:47:11

标签: ionic2 timezone momentjs angular-moment

我正在做一个简单的测试(我位于法国),使用时刻和时刻(带有角度Angular2库)。

尽管文档中有什么内容,但我没有成功获得合理的结果。

let timezone = moment.tz.guess();
console.log(timezone); // ok: Europe/Paris

let now = moment();
let nowFr = now.tz(timezone); // docs: should convert to time zone

// both display UTC format (13pm instead of 15pm local time)
console.log(now.toISOString());
console.log(nowFr.toISOString());

// first show 13pm, second 15pm
// this works, but i'm supposed to be passing ISO string to Ionic2 date picker !!
console.log(now.format());
console.log(nowFr.format());

0 个答案:

没有答案