/    Sign up×
Community /Pin to ProfileBookmark

Date Math Dilemma

I have encountered a problem that really has me baffled.

Here’s the background:

  • 1. I’m maintaining a production version of a VB.Net front-end application that’s been in production for appx 3 years.

  • 2. On one of my pages, I’m using a 3rd party datagrid from a company named Infragistics with client-side events using JavaScript code behind.

  • 3. I’m developing on a development server and once tested, am moving the front-end code over to a production server. Been using the same strategy for 3 years.
  • Here’s the issue:

    The grid has seven columns. On one column the user enters the begin date for a trip. In the next column he enters the end date for the trip. When the change cell event fires resulting from changing the end date, I use Javascript to calculate the number of days (i.e., the length) of the trip. The problem is that when users remote to our facility type a begin date of 10/15/2006 and an end date of 11/15/2006, the end date displayed “falls back to” 10/29/2006 vs 11/15/2006! The date math is correct (i.e., 14 days) for end date 10/29/2006. If our remote user types a begin and end date that both [B]preceed [/B] 10/29/2006 all works fine. If the user types a begin/end date both of which [B]succeed [/B] 10/29/2006, all works fine again. Only when the dates [B]span [/B] 10/29/2006 does the problem occur!! When the user performs the same steps for Fiscal Year 2008 (i.e., 10/15/2007 – 11/15/2007), the date “falls back to” 10/28/2007!! Both 10/29/2006 and 10/28/2007 are Sundays!

    Here’s the kicker:

    I, the developer, use the same production application here on site. I am in the same building as the server, but am accessing the identical front-end through the same internet url as the two folks at the distant site. When I execute the identical scenario — you guessed it — [B]NO PROBLEM[/B]! End date 11/15/06 enters into the grid cell just fine and the lenth of the trip correctly displays as 31 days. I submit the record to the database, come back later, and everything still looks good!!

    I assumed the first remote user was mis-typing something (e.g., choosing the wrong year), but when a second person in a different remote location tried the same thing and had the same results, I realize the error was not human induced.

    Could anyone point me in the proper direction? Could the problem be a firewall issue? I believe remote users go through the firewall and I do not here. Could the problem be different Javascript versions? One of the remote users and I are apparently using the same version of IE (6.0.2900.23180). I’m really stumped. ?

    to post a comment
    JavaScript

    1 Comments(s)

    Copy linkTweet thisAlerts:
    @GaryAFauthorAug 24.2006 — This problem was the result of the two dates spanning the date that clocks are turned from daylight savings time to standard time (29Oct06). My javascript logic was comparing two date fields to avoid a looping condition. What I had not counted on was that when the dates spanned 29Oct06, the date that fell in the standard time zone was decremented by an hour which actually placed it in the previous day. My check failed and decremented the end date one day per loop until it hit the first day (29Oct06) that was in the same time zone (daylight savings time) as the begin day. At that point, the check succeeded. I could not get it to fail here in Arizona because we don't turn our clocks. That's why only users remote to our site experienced the problem.
    ×

    Success!

    Help @GaryAF spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.21,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...