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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:57:04+00:00 2026-06-17T14:57:04+00:00

If I use the strategy to compare text-based dates shown here: Compare two dates

  • 0

If I use the strategy to compare text-based dates shown here: Compare two dates with JavaScript.

Suppose the user inputs “03/02/2013” (the format with “/” will be respected) and I compare it to “04/01/2013”. In the European calendar, the first date is February 3rd and the second is January 1st. But in the US calendar, the first is March 2nd and the second is April 1st. For the European standard, the first date is bigger than the second, but for the US standard, the second is larger.

Does this method from the link account for dates location? I haven’t found a way to test this without my computer taking the European version, that’s why I ask.

  • 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-06-17T14:57:05+00:00Added an answer on June 17, 2026 at 2:57 pm

    No, the strategy there doesn’t handle Date Localization for you.

    Javascripts internal Date Object does take Localization in account. But thats just depending on the Browsers/Machines Locale settings
    Which does not necessarily have to match the Users Date format,sitting infront of it

    And you can’t distinguish a DD/MM/YYYY from a MM/DD/YYYY format. exception for: DD > 12
    without further information about the user .

    You could of course use the localization from the browser/machine or the ip adress to get a location or something else,
    and handle the formating depending on this information, but this could easily lead to wrong results.

    I would rather make sure that the Date Object is constructed right.

    For example by providing a Date Picker which lets the user choose the Year Month and Day respectively to avoid the Date ambiguity due to their format.

    Because you can’t make sure what format the user, sitting at the PC is using.

    e.g: I’m european and have my Browsers Locale Settings on enUS.

    Therefore the

    Then you can construct your Date Object like new Date(YEAR,MONTH,Day)
    e.g ->

    var year1 = 2013; //Suppose those variables will be handle by some user input method
    var year2 = 2013;
    
    var month1 = 0; //January (Months are zero based in javascripts Date Object)
    var month2 = 3; //April
    
    var day1 = 3;
    var day2 = 1
    
    
    var date1 = new Date(year1,month1,day1);
    var date2 = new Date(year2,month2,day2);
    
    console.log(date2.getTime() > date1.getTime()); //true
    

    And avoid that Problem at all

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

Sidebar

Related Questions

I mean, I use to have this widget : <script src=http://www.mywebsite.com/widget/widget.js?type=normal type=text/javascript></script> <div id=archie-container></div>
I have a class which is going to need to use the strategy design
What's the best strategy to use when writing JMeters tests against a web application
At work we use a branching strategy where all changes start off in a
What strategy should I use if I have an implementation of std::fstream with 32-bit
What type of transaction management strategy we should use in Spring? Declarative or Programmatic?
Use Case Show a photo uploaded by the user in a square box with
use Text::Table; my $tb = Text::Table->new(Planet,Radius\nkm,Density\ng/cm^3); $tb->load( [ Mercury,2360,3.7], [ Mercury,2360,3.7], [ Mercury,2360,3.7], );
I'd like to know what would be the best strategy to compare a group
What is a good deployment strategy to use with Git + Heroku (Ruby on

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.