Date component saving incorrectly in 2.1.2

pebosi - July 24, 2008 - 09:54
Project:Webform
Version:5.x-2.1.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi,

when creating a new submission the values of day and month are swaped. i create a patch for 5--2 Branch, please review.

regards pebosi

AttachmentSize
date_sorting.patch.txt1.58 KB

#1

quicksketch - July 24, 2008 - 16:51

Could you clarify: are the values going into the wrong fields? That is, after you submit, does the day end up in the month as the saved value?

This probably has to do with the changes I made that make Webform mimic the site settings for the date format. We can't just switch the position of the day and month, as it would break all the sites that have been using Webform previous to that change in the 2.1 version. Also "month/day/year" is the standard format in the United States, as little sense as that makes. I think the display of the values is probably fine, but our saving is incorrect when the format is "day/month/year".

In the database, Webform should save:
day: row 0
month: row 1
year: row 2

If it's saving in a different order, we've got a problem.

#2

quicksketch - August 8, 2008 - 03:13
Title:Date component, sorting failed» Date component saving incorrectly in 2.1.2
Version:5.x-2.x-dev» 5.x-2.1.2
Status:needs review» fixed

In both the 2.1 version for D5 and D6, the date component is saving incorrectly if using day/month/year format. We've got a serious problem in that all dates prior to 2.1 were being saved correctly, while dates after 2.1 have been saved in a different order. Without being able to pinpoint when the date component was changed, we've probably got a lot of corrupted databases out there.

To clarify the problem 2.0 and earlier saved dates as such (Apologies, my comment in #1 was not accurate):
row 0: month
row 1: day
row 2: year

If using an international date format (day/month/year) and using 2.1.x, all the dates since have been saved incorrectly as:
row 0: day
row 1: month
row 2: year

Since Webform has no way of telling which row 0's are days and which are months, all the collected dates using the 2.1 version of Webform are going to be screwed up.

I've committed the following patches to correct this problem, and I'm going to get 2.1.3 out to fix this rather severe problem.

D5: http://cvs.drupal.org/viewcvs/drupal/contributions/modules/webform/compo...
D6: http://cvs.drupal.org/viewcvs/drupal/contributions/modules/webform/compo...

#3

Anonymous (not verified) - August 22, 2008 - 03:24
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.