iamkun / dayjs

⏰ Day.js 2kB immutable date-time library alternative to Moment.js with the same modern API
https://day.js.org
MIT License
46.82k stars 2.29k forks source link

Why doesn't `toISOString` include the offset? #2670

Open thj-dk opened 4 months ago

thj-dk commented 4 months ago

Can you help me understand why dayjs().toISOString() doesn't include the offset by default?

Given the current behaviour, shouldn't this method be named ToUtcIsoString? Or am I wrong, expecting this method to include the offset? What are the reasons behind this behavior?

I'm aware that I can get the ISO 8601 representation including offset using format(), but it's less obvious.

dimarixsus commented 4 months ago

I've always thought about this as just like JavaScript new Date().toISOString()