I would be good to add DATE as an option when configuring fields in the Data module. It should be recognized by Mysql as a DATE field type. I belive that currently you would need to create a varchar in the Data module UI and it would be recognized in Mysql as a varchar.
http://dev.mysql.com/doc/refman/5.6/en/datetime.html

This is useful for large datasets since DATE only takes up 3 bytes in the database.

Comments

herd45 created an issue. See original summary.

drunken monkey’s picture

Status: Active » Needs review
StatusFileSize
new3.74 KB

The attached patch works for me to implement this.

To use:

  1. For the table schema, set the column type to "date" (new option).
  2. On the "Configure date fields" tab, set the column to "Datetime" (with the desired granularity).
  3. On the "Configure Views" tab, make sure that the field handler is (the new) views_handler_field_data_date and the filter and argument handlers are those from the "Date" module (if installed). (Both the default and the date-specific sort handler provided by Views should work.)
mautumn’s picture

This patch failed for me for both the 7.x-1.0-alpha8 and the 7.x-1.x-dev versions (which appear to have the same date).

patch -p1 < 2718343-2--native_date_support.patch

patching file data.info
Hunk #1 FAILED at 10.
1 out of 1 hunk FAILED -- saving rejects to file data.info.rej
patching file data.module
patching file data.views.inc
patching file data_ui/data_ui.admin.inc
patching file views/views_handler_field_data_date.inc

The only issue was for some strange reason it couldn't add the following line to data.info :-

files[] = views/views_handler_field_data_date.inc
drunken monkey’s picture

It seems like you're just using the release tarball from the project page. Since those add additional information to the .info files, patches that change those files will sometimes fail.
Use a Git checkout of the module instead to avoid the problem – or just make that one change manually.

jerry’s picture

Status: Needs review » Reviewed & tested by the community

This is working fine for me, and after three years with no complaints, I'm inclined to RTBC it.

lazzyvn’s picture

there is new version data dev update, this patch doesn't work well, module date is update new version also
i see some query change
(DATE_FORMAT(ADDTIME(time_sheet.start, SEC_TO_TIME(3600)), '%Y-%m') >= '2019-01' AND DATE_FORMAT(ADDTIME(time_sheet.start, SEC_TO_TIME(7200)), '%Y-%m') <= '2019-01')