From ISO 8601 , it allows timezone with or without colon.
But dayjs can not work on ie11 when date string timezone without colon. This is the example: https://jsbin.com/royewipupa/edit?html,js,console,output
The first, about your jsbin code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js' /> is invalid.
The correct way is <script src=''></script>.
IE11 does not support timezone without the colon, like new Date("2000-08-06T16:00:00.000+0800") -> Invalid Date.
You also can view http://dygraphs.com/date-formats.html or https://segmentfault.com/a/1190000003710954?mType=Group
try CustomParseFormat
I tried 'yyyy-MM-dd\'T\'HH:mm:ssZ', but it still does not parse.
I ended up inserting the colon with regex before passing it to dayjs...
isoDate.replace(/([+-]\d{2})(\d{2})$/g, '$1:$2')
I tried
'yyyy-MM-dd\'T\'HH:mm:ssZ', but it still does not parse.
@fabb a reproduction demo, please?
Same as the above demo, but with the parse format passed as 2nd parameter:
https://jsbin.com/jirosazeta/1/edit?html,js,console,output
@fabb
You have to use CustomParseFormat plugin first.
dayjs.extend(customParseFormat)
after that you could pass format as 2nd parameter:
https://github.com/iamkun/dayjs/blob/dev/docs/en/Plugin.md#customparseformat
Most helpful comment
The first, about your jsbin code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js' />is invalid.The correct way is
<script src=''></script>.IE11 does not support timezone without the colon, like
new Date("2000-08-06T16:00:00.000+0800") -> Invalid Date.417 DayJS depends heavily on native Date.
You also can view http://dygraphs.com/date-formats.html or https://segmentfault.com/a/1190000003710954?mType=Group