Date issue in Safari browser in iOS

Source: Internet
Author: User

The Safari browser in IOS5 and above (not including IOS5) correctly interprets the date object of the new date (' 2017-3-27 ') in JavaScript.

However, the IOS5 version of Safari explains that the new date (' 22017-3-27 ') is not correct, and the return in IOS5 Safari is always "Invalid date".

If you want safari in IOS5 to correctly parse the new Date () then it must be written

New Date (' 2017/3/27 ');

Or turn 2017-3-27 into a slash format,
var d = new Date (date);
D = d.getfullyear () > 0? D:new Date (Date.parse (Date.replace (/-/g, "/")));

(Back then to the back of the 2017-3-27 format, other browsers are all right, this is the thing)

Date issue in Safari browser in iOS

Related Article

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.