Dayjs: How to convert to UTC?

Created on 22 Jan 2019  路  7Comments  路  Source: iamkun/dayjs

I am struggling to convert my date to UTC.

Here is how I did it:

Normal conversion

console.log(dayjs('11-11-2018').format());
// output: 2018-11-11T00:00:00+08:00

UTC conversion

console.log(dayjs('11-11-2018', { utc: true, }).format());
// output: 2018-11-11T00:00:00+08:00

Both outputs are still showing in my timezone.

released

Most helpful comment

@karlmosenbacher Will be avaliable in next version v1.8.9, maybe in two weeks I hope.

All 7 comments

No support at present, however an UTC plugin is working in progress.

So at the moment are there any other tricky way for the conversion?

It looks like currently only momentjs able to perform this.

@xxyuk whats the status with the UTC plugin?

@karlmosenbacher Will be avaliable in next version v1.8.9, maybe in two weeks I hope.

:tada: This issue has been resolved in version 1.8.9 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Was this page helpful?
0 / 5 - 0 ratings