huyvdit / datejs

Automatically exported from code.google.com/p/datejs
Other
0 stars 0 forks source link

Date.parse() seems to mix up day and month #183

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The Date.parse() function mixes up my days and month. My date fields are 
formatted like "dd.mm.yyyy", so that 01.04.2014 means "first of April, 2014". 
The parse() function, however, makes "January 4th, 2014", out of it. Do I have 
a chance to correct that?

What steps will reproduce the problem?

I have a PDF document with several form fields, one of them a "begin_date" 
field into which the user needs to enter a begin date.

For example, the user enters "01.10.2014" as the first of October, 2014. In 
order to get this date for further calculations, I use:

var begin = Date.parse(this.getField('begin_date').value);

and the result is January 10, 2014 (month and day switched).

(I need to add 24 months afterwards, like "Date.begin.addMonths(24)".

What is the expected output? What do you see instead?

I'd of course like to see the correct result "first of October, 2014".

What version of the product are you using? On what operating system?

I downloaded the latest version yesterday. I'm working on WIN 7 with Acrobat 
Pro XI.

Thanks!
Rudi

Original issue reported on code.google.com by rwarttm...@googlemail.com on 12 Jan 2014 at 2:39

GoogleCodeExporter commented 8 years ago
Addendum:

If I configure the date field in Acrobat as "mm.dd.yyyy", Date.parse() will 
also switch month and day.
Example: 01.31.2014 (31st of January, 2014) will result in "null" because there 
is no 31. month.

So in my eyes clearly a bug.

Is there a chance that someone can look into it and fix that?

Original comment by rwarttm...@googlemail.com on 13 Jan 2014 at 6:51