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 6783817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:54:59+00:00 2026-05-26T16:54:59+00:00

Safari browser gives a syntax error when i try to display the date format

  • 0

Safari browser gives a syntax error when i try to display the date format in

dd/mm/yyyy

format. Is there any solution how to display them using jquery? Thanks in advance

        function parseDate(input) {
      var d= new Date(input);
      return d.format("dd-mm-yyyy");//"dd/mm/yyyy"
    }//works on chrome not in safari
  • 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-26T16:55:00+00:00Added an answer on May 26, 2026 at 4:55 pm

    I’ve created a quick demo of your example code using the date format plugin, fiddle here and it appears to work fine in Safari.

    Things to try:

    • Check the format of the date you’re passing in to the input is a valid date object
    • Make sure that the javascript plugin is included in your page correctly, and that an older version is not being cached by Safari.

    Failing that, please provide more information about the error Safari gives you.

    UPDATE

    As you’ve now said you’re passing a string to the Date() object, I can see the problem. Safari is very strict about what it will accept, so you’ll need to parse the string first, to form a valid Date object. Try the below:

    //var d = new Date("2011-11-02"); // This will work for the vast majority of browsers - but not safari
    
    function parseDate(input) {
      var parts = input.match(/(\d+)/g);
      return new Date(parts[0], parts[1]-1, parts[2]);
    }
    
    var d = parseDate("2011-11-02");
    alert(d.format("dd-mm-yyyy"));
    

    You can test it in this fiddle: http://jsfiddle.net/Ly4vb/1/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I launch the Safari browser or the user's default browser pointing it
I'm interested in doing some development against the Safari browser but I'm not sure
how does browser (firefox/safari) detects that website you are visiting is infected? Do they
I just upgraded my browser to Safari 4 and find that our website is
How do I open a browser window (Safari) with Ruby on a Mac and
Mobile Safari is a very capable browser, and it can handle my website as
Safari gives resize handles for text-areas. anyone knows how to stop that? thanx
i have a mac. i wonder which browser (safari or firefox) i should use
I can get my background image to fill out every browser other than safari
Im using the openURL command to send an SMS, but it opens the safari,

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.