In an effort to make #254957: Allow sorting on any column in the Results table page and #680386: Views integration for the webform_submitted_data table more feasible, we should convert our date storage from using 3 separate rows to storing dates as timestamps, making them sortable and easier to handle with Views.

Comments

quicksketch’s picture

Version: » 6.x-3.x-dev
Status: Active » Needs review
StatusFileSize
new17.84 KB
new19.94 KB

I've merged this issue with #712352: Convert time component to use seconds in the day (timestamps), since both issues will use essentially the same format.

After speaking with KarenS, the maintainer of Date/DateAPI, I've decided not to use timestamps, but to use ISO 8601 strings. This format states that dates and times be formatted as such:

Datetime: yyyy-mm-ddThh:mm:ss
Date: yyyy-mm-dd
Time: hh:mm:ss

There are a lot of varieties of allowed formats but this will be the set of formats we use. This format has the following advantages:
- Doesn't mess with timezones at all, much less probability for error when converting back/forth from timestamps.
- Still sortable
- MySQL and other datbase systems provide special mechanisms for handling dates in this format.
- Like timestamps, only takes up one row in the database but without the hassle of trying to figure out what timezone the timestamp is in.

After putting together the patch, I found this significantly reduces our logic in a couple of places (things like the analysis page especially). This patch keeps to the focus of converting the data storage, though there are plenty of areas for improvement in our reporting and analysis pages.

Same as other patches, this does not address data migration in the Drupal 7 version, which is being postponed until we can upgrade Drupal 6 core to Drupal 7 core.

quicksketch’s picture

Title: Convert date component database storage to use timestamps » Convert date component database storage to use ISO 8601 strings (similar to timestamps)
Status: Needs review » Fixed

I've committed these patches to both branches.

Status: Fixed » Closed (fixed)

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