It would be kind of handy to have a form field type for both date AND time selection boxes which could be used in things like the event module.

CommentFileSizeAuthor
#4 datetime.module_0.txt9.67 KBderhasi
#3 datetime.module.txt9.67 KBderhasi

Comments

tatien’s picture

Version: x.y.z » 4.7.4

Actually, what would be nice would be that the "date" type be "formatable" with options, so that you can choose how you want to specify it (e.g. just the year, a month and a day, just the hours/minutes/seconds, with select boxes or with a sring timestamp, etc.)

webchick’s picture

Version: 4.7.4 » 6.x-dev

True. Features only go against the next dev release though.

derhasi’s picture

Status: Active » Reviewed & tested by the community
StatusFileSize
new9.67 KB

For my custom module I developped a datetime element type. It extends the features of the date element type.

With specific options for each element, you can select if it should be hidden. You can also set pre- and suffix for each child element, limit range of the select options of each child, customize the elements' order and assign a default_value different to the current time default.

You also get a lot more output on your field's value. It still contains the standard date-array with 'year','month','day' plus now for time: 'hour','minute','second'. Additionally it extends the array with 'timestamp', 'sql_datetime' (like it is used to save in SQL-tables' datetime), 'sql_date' and 'format_date'.

I attached the module's .module, which only will add this datetime element type.

derhasi’s picture

Version: 6.x-dev » 5.x-dev
StatusFileSize
new9.67 KB

For developing reasons I had changed the 'hidden'-type to 'textfield', now I set it back to 'hidden'. Sorry for that. Now it's ready to commit.

yched’s picture

Status: Reviewed & tested by the community » Needs review

Your patch needs reviews before it can be set 'ready to be committed' - usually not by the guy who submitted the patch :-)

derhasi’s picture

I created a forum topic on http://drupal.org/node/130694 to discuss about my datetime.module. There also a dev-version is linked for downloading.

ChrisKennedy’s picture

Version: 5.x-dev » 6.x-dev
Component: base system » forms system
Status: Needs review » Needs work

This isn't a patch and it has some major coding style issues (http://drupal.org/node/318). It will need to be developed for Drupal 6, not 5.

karens’s picture

Version: 6.x-dev » 7.x-dev

This won't go into core before 7.x since 6.x is frozen. The new Date API (still in development in HEAD) will create a couple date_time elements, a date_select and a date_text (the date_text can use jquery-calendar or jscalendar popup widgets). They will be usable by any module in 5.x and 6.x (no dependence on CCK), and I hope we can get them into core in 7.x.

karens’s picture

Status: Needs work » Active

And it isn't a patch yet...

wienczny’s picture

What is the current state about this?

wim leers’s picture

Since CCK will be moving into D7 core, I imagine this *will* happen. But it probably won't happen until CCK for D6 is ready, at the least.

webchick’s picture

Not sure... Date module is a bit of a different beast from standard text/number/etc. faire. Unless some people step up to help, this probably won't happen for D7.

karens’s picture

The new Date version 2 has an API that *could* be partly moved into core for D7. I have a session to discuss that in Boston (http://boston2008.drupalcon.org/session/drupal-dates-we-can-do-better). The API includes some standard, configurable date elements like #date_select and #date_popup. Since D7 will require PHP 5.2, we can (finally!) use the new PHP timezone handling that actually works correctly.

If we have a good date API in core, I can then create a simple date field for CCK in core that could use it, and leave the more complex date handling in a contrib module.

Once the Date version 2 is finalized and ported to D6, I plan to submit a patch to add some of the API to core.

wim leers’s picture

Status: Active » Closed (fixed)

Cleaning up the issue queue.