For the Hilton, the future is today (and it’s broken..)

A bug in Hilton's booking JavaScript just threw up another of these minor incompatibilites between Opera and IE..

If you try to book a room on Hilton's site with Opera, you will first have to identify as IE.

At the date confirmation step of the booking process you will be surprised to be told that your booking is too far in the future!

Their JavaScript is not quite steady at their date validation. Consider:

var tod = new Date()

var nyr = new Date( tod + (86400000 * 365) )

"tod" is today's date. They want the "nyr" variable to be a date one year from now – adding milliseconds per day multiplied with 365. The correct syntax would be

var nyr = new Date( tod.getTime() + (86400000 * 365) )

Now, Opera does interpret the input as a date – actually as today's date. IE returns NaN (a special JavaScript error value meaning "Not a Number"). The form validation prevents you from making a reservation because the dates you're trying to reserve obviously are more than one day ahead of today, and the script then thinks they are more than one year in the future.

I assume that in IE, this particular step of the form input validation will always "work" even if you are trying to book a date fifty years ahead.

The future is now – and it's broken. Not the best validation of their webmaster's JavaScript knowledge.

Advertisements

One thought on “For the Hilton, the future is today (and it’s broken..)

  1. I tried to make them aware of this issue on the 14th of June. No feedback yet.

    Here's what I wrote:

    Feedback form:
    http://www.hilton.com/en/hi/feedback/index.jhtml

    Message sent:
    I have found serious problems with your website's form validation.

    You use the following JavaScript to check whether a date is more than one year in the future:

    var tod = new Date()
    var nyr = new Date( tod + (86400000 * 365) )

    This is wrong. The correct syntax for the second line would be

    var nyr = new Date( tod.getTime() + (86400000 * 365) )

    Consequences:
    In Opera, booking is impossible.
    In IE and other browsers, the validation does not actually validate anything. It is possible to submit requests for bookings more than one year in the future and the site will respond saying the hotels are "Not available" without giving the customer any further explanation (not the best PR for you).

    You will also have problems in IE if you try to book a date that is in 2005. IE will tell you that this date is in the past and not allow the booking. Probably same issue.

    I recommend fixing this ASAP if you want your customers to be able to book stays next year through your website 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s