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

do toISOString(true) in dayjs like in momentjs #1979

Open
rikisechter opened this issue Jul 7, 2022 · 1 comment
Open

do toISOString(true) in dayjs like in momentjs #1979

rikisechter opened this issue Jul 7, 2022 · 1 comment

Comments

@rikisechter
Copy link

We are currently in the process of migrating our legacy momentJS code over to dayJS and so far it is going well. However, we are running into issues when trying to replace 'toISOString()' function, since in momentJS we have an option of send 'True' parameter to prevent UTC conversion while in dayJS we don't have such an option.

Docs: https://momentjs.com/docs/#/displaying/as-iso-string/

in momentjs:
moment().toISOString(true) // '2022-07-06T22:23:50.881+03:00'

in dayjs:
dayjs().toISOString() // '2022-07-06T19:23:41.643Z'

In DayJS is there an equivalent function or how we can accomplish the same goal?

@Bykiev
Copy link

Bykiev commented Jul 7, 2022

Hi, you can use format function like this:

const now = dayjs();
console.log(now.format("YYYY-MM-DDTHH:mm:ss.SSSZ"));

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

No branches or pull requests

2 participants