Vue's path to the pit (eight)----Ios:safari incompatible with date issues in JavaScript

Source: Internet
Author: User

The Safari browser in IOS5 and above (not including IOS5) correctly interprets the date object of the new date (' 2013-10-21 ') in JavaScript. However, the IOS5 version of Safari explains that new date (' 2013-10-21 ') is not correct, and the return in IOS5 Safari is always "Invalid date". later I found the information on the Internet, originally the low version of Safari explained that the new Date (' 2013-10-21 ') This object is not the same, in IOS5 Safari does not support this type of writing,then I checked a lot of foreign technical blog, finally found a solution, originally wanted to IOS5 in the safari can correctly parse the new Date () so it must be writtennew Date (' 2013/10/21 '); orvar d = new Date (date);
d = d.getfullyear () > 0? d:new Date (Date.parse (Date.replace (/-/g, "/"));The main thing is back in the background. The format of the date returned is ' 2013-10-21 '. Causes it to not be interpreted correctly in the low-end version of Safari! Tai Hang!!!

Vue's path to the pit (eight)----Ios:safari incompatible with date issues in JavaScript

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.