Planet PDF Forum Archive

Planet PDF ForumWowsers! This is page is old, head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions. If you wish to continue... one & two archive covers 1999-2011 (160,000 pages).


New Forum | Previous | Next | (P-PDF) Developers


Topic: DST Problem
Conf: (P-PDF) Developers, Msg: 75795
From: CynthiaBlue
Date: 11/6/2002 08:40 AM

I'm having a wee problem with Daylight Savings Time.

We have a form which the users fill out, and it calculates meals they are eligible to receive a reimbursement for based on a date they leave, and a date they return. It works great, except for the one person who left during Daylight Savings Time, and returned during Standard Time.

The function we use to calculate the difference in the date is as follows:
function sou_dateAdd(startDt,daysAdd)
{
var calcDt = new Date(startDt);
var calcDtNum = calcDt.valueOf();
calcDtNum += 1000 * 60 * 60 * 24 * daysAdd;
var newDt = new Date(calcDtNum);

return newDt;
}

This works great, except for during the time change, and I expect it will happen during the switch back to DST as well (I haven't tried it yet).

What happens is it seems to add 24 hrs, but during the daylight savings time switch, it missed the hour to fall back, and thus it didn't add the necessary time. Here are the results I have displayed:

calcDt Sat Oct 26 00:00:00 GMT-0600 (Mountain Daylight Time) 2002
newDt Sat Oct 26 00:00:00 GMT-0600 (Mountain Daylight Time) 2002
Date 1
----------
calcDt Sat Oct 26 00:00:00 GMT-0600 (Mountain Daylight Time) 2002
newDt Sun Oct 27 00:00:00 GMT-0600 (Mountain Daylight Time) 2002
Date 2
----------
calcDt Sat Oct 26 00:00:00 GMT-0600 (Mountain Daylight Time) 2002
newDt Sun Oct 27 23:00:00 GMT-0700 (Mountain Standard Time) 2002
Date 3
----------
calcDt Sat Oct 26 00:00:00 GMT-0600 (Mountain Daylight Time) 2002
newDt Mon Oct 28 23:00:00 GMT-0700 (Mountain Standard Time) 2002
Date 4
----------
calcDt Sat Oct 26 00:00:00 GMT-0600 (Mountain Daylight Time) 2002
newDt Tue Oct 29 23:00:00 GMT-0700 (Mountain Standard Time) 2002
Date 5
----------
calcDt Sat Oct 26 00:00:00 GMT-0600 (Mountain Daylight Time) 2002
newDt Wed Oct 30 23:00:00 GMT-0700 (Mountain Standard Time) 2002

You can see the difference between Date 2 and Date 3. The return date (the 2nd date listed) is the same on both Date 2 and Date 3. It incremented only 23 hrs, instead of 24 hrs.

I've been looking at possible fixes, and I'm not finding much. Anyone have any ideas? :)
Thanks


PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Back to the past, 15 years ago! Open Publish 2002

Looking back to 2002, it's amazing how much of the prediction became a reality. Take a read and see what you think!

September 14, 2017
Platinum Sponsor





Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.

Features

Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.