I have the following date: 06-24-2016 02:18:13 PM
I'm trying to use moment.js but getting invalid date in Safari and FF using the following:
moment(data.d.results[0].Updated_On).format('MMMM Do YYYY'))
Not sure what I need to do to get it working an all browsers?
just provide the correct format for your date, then it will work everywhere
var d = "06-24-2016 02:18:13 PM";
alert(moment(d, "MM-DD-YYYY HH:mm:ss A").format("MMMM Do YYYY"))
可能不是推荐的方式。但这对所有浏览器都适用:
moment(data.d.results[0].Updated_On, "MM-Do-YYYY").format('MMMM Do YYYY'))
Probably not applicable to most. But in my case I was appending 'z' to my date string. Which worked fine in Chrome but failed testing in Safari. Simply change the 'z' to a capitalized 'Z' fixed for me.
Thought I'd share this rare edge case.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.