Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to convert to UTC? #462

Closed
aibrahim3546 opened this issue Jan 22, 2019 · 8 comments · Fixed by #517
Closed

How to convert to UTC? #462

aibrahim3546 opened this issue Jan 22, 2019 · 8 comments · Fixed by #517
Labels

Comments

@aibrahim3546
Copy link

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.

@ghost
Copy link

ghost commented Jan 22, 2019

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

@aibrahim3546
Copy link
Author

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

@aibrahim3546
Copy link
Author

It looks like currently only momentjs able to perform this.

@karlmosenbacher
Copy link

@xxyuk whats the status with the UTC plugin?

@ghost
Copy link

ghost commented Feb 27, 2019

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

@iamkun
Copy link
Owner

iamkun commented Mar 6, 2019

🎉 This issue has been resolved in version 1.8.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

@iamkun iamkun added the released label Mar 6, 2019
@iamkun
Copy link
Owner

iamkun commented Feb 22, 2020

Yes, please check.

https://day.js.org/docs/en/parse/utc

@vaynevayne
Copy link

console.log(dayjs('11-11-2018', { utc: true, }).format());

this api design is better, Why not follow suit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants