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
Format error in iOS 11.3 #73
Comments
Seems, '2018-09-06T17:00:00.000+0000' is not a standard date format? (need reference here) If so, should we support it? |
May be the best way to deal with these non-standard date format is to format it before send it to const dateString = '2018-09-06T17:00:00.000+0000'.replace(/-/g,'/').replace('T', ' ')
dayjs(dateString) |
@iamkun 2016-09-18T08:01:01.000+0000 这种格式应该是 RFC 3339 中定义的。关于时区的部分,参考 RFC 2822。 从 RFC 2822 中可以看到 +0000 是合法的,不知道为啥 Safari 不支持。 moment('2016-09-18T08:01:01.000+0000').format('YYYY/MM/DD') support. 我用了下面的方法成功了 |
Thanks, seems a nice solution. Maybe we could add this to our core ?@iamkun Besides, nobody should use something else than ISO8601😃 |
var startTime = "2018-05-18T16:00:00.000+0000"; it's work |
let time = '2019-01-01T12:21:10+0800'
console.log(dayjs(time)) // Chrome OK, Firefox OK, Safari NaN
console.log(dayjs(time.replace(/-/g, '/').replace(/T/g, ' '))) // Chrome OK, Firefox NaN, Safari OK So, I write a export let dateFormat = (date) => {
let ua = navigator.userAgent.toLowerCase()
return /firefox/i.test(ua) // For Firefox browser
? date
: date.replace(/-/g, '/').replace(/T/g, ' ')
} |
I think, it is not resloved in 1.8.3 dayjs not work in safari |
@shenghanqin I use
and works well |
oh, thank you! It works well |
dayjs@1.8.24 , has some problem |
@NauxChen For consistent results parsing anything other than ISO 8601 strings, you should use String + Format. https://day.js.org/docs/en/parse/string-format demo: #73 (comment) |
I had I managed to fix the issue by concatenating My API datetime format after this fix: |
Exactly same issue |
In PC
dayjs('2018-09-06T17:00:00.000+0000')
returnThu, 06 Sep 2018 17:00:00 GMT
In Iphone
dayjs('2018-09-06T17:00:00.000+0000')
return Invalid DateThe text was updated successfully, but these errors were encountered: