Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3495428
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:07:31+00:00 2026-05-18T12:07:31+00:00

alert(new Date(‘2010-11-29’)); chrome, ff doesn’t have problems with this, but safari cries invalid date.

  • 0
 alert(new Date('2010-11-29'));

chrome, ff doesn’t have problems with this, but safari cries “invalid date”. Why ?

edit : ok, as per the comments below, I used string parsing and tried this :

alert(new Date('11-29-2010')); //doesn't work in safari
alert(new Date('29-11-2010')); //doesn't work in safari
alert(new Date('2010-29-11')); //doesn't work in safari

edit Mar 22 2018 : Seems like people are still landing here – Today, I would use moment or date-fns and be done with it. Date-fns is very much pain free and light as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:07:32+00:00Added an answer on May 18, 2026 at 12:07 pm

    The pattern yyyy-MM-dd isn’t an officially supported format for Date constructor. Firefox seems to support it, but don’t count on other browsers doing the same.

    Here are some supported strings:

    • MM-dd-yyyy
    • yyyy/MM/dd
    • MM/dd/yyyy
    • MMMM dd, yyyy
    • MMM dd, yyyy

    DateJS seems like a good library for parsing non standard date formats.

    Edit: just checked ECMA-262 standard. Quoting from section 15.9.1.15:

    Date Time String Format

    ECMAScript defines a string
    interchange format for date-times
    based upon a simplification of the ISO
    8601 Extended Format. The format is
    as follows: YYYY-MM-DDTHH:mm:ss.sssZ
    Where the fields are as follows:

    • YYYY is the decimal digits of the year in the Gregorian calendar.
    • "-" (hyphon) appears literally twice in the string.
    • MM is the month of the year from 01 (January) to 12 (December).
    • DD is the day of the month from 01 to 31.
    • "T" appears literally in the string, to indicate the beginning of
      the time element.
    • HH is the number of complete hours that have passed since midnight as two
      decimal digits.
    • ":" (colon) appears literally twice in the string.
    • mm is the number of complete minutes since the start of the hour as
      two decimal digits.
    • ss is the number of complete seconds since the start of the minute
      as two decimal digits.
    • "." (dot) appears literally in the string.
    • sss is the number of complete milliseconds since the start of the
      second as three decimal digits. Both
      the "." and the milliseconds field may
      be omitted.
    • Z is the time zone offset specified as "Z" (for UTC) or either "+" or "-"
      followed by a time expression hh:mm

    This format includes date-only forms:

    • YYYY
    • YYYY-MM
    • YYYY-MM-DD

    It also includes time-only forms with
    an optional time zone offset appended:

    • THH:mm
    • THH:mm:ss
    • THH:mm:ss.sss

    Also included are "date-times" which
    may be any combination of the above.

    So, it seems that YYYY-MM-DD is included in the standard, but for some reason, Safari doesn’t support it.

    Update: after looking at datejs documentation, using it, your problem should be solved using code like this:

    var myDate1 = Date.parseExact("29-11-2010", "dd-MM-yyyy");
    var myDate2 = Date.parseExact("11-29-2010", "MM-dd-yyyy");
    var myDate3 = Date.parseExact("2010-11-29", "yyyy-MM-dd");
    var myDate4 = Date.parseExact("2010-29-11", "yyyy-dd-MM");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code in an HTML page: alert(JSON.stringify(new Date())); I'm including the latest
var d = new Date(2011,1,1); alert(d); this alert says February, while it should say
var dateNum = Number('/Date(1306348200000)/'.replace(/[^0-9]/g,'')); var formattedDate = new Date(parseInt(dateNum.substr(6))); alert(formattedDate); What's wrong with this
<script type=text/javascript> alert(new Date(2010,8,31)); alert(new Date(2010,9,1)); </script> Try the code above. The browser display
$.post('includes/script.php', $(this).serialize(), function(data) { $('body').append(data); }); alert ($('#new').length) php script is <php echo <div
a = new function() { this.x=2; B=function() { this.y=super.x; } this.b=new B(); } alert(a.b.y);
The following code below: var unixDate = new Date('07/28/2010'); var unixMonth = unixDate.getMonth(); var
I am wanting to set this jquery date picker to throw an alert /
I have the following javascript object, somewhat pseudocode: { dateField: new Date(), addMinutes:function(numMinutes) {
I have the following entities Alert and Location in Grails. But I cant seem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.