Forums / Developer / Create a custom default value for date field datatypes
Barney Gumble
Tuesday 20 January 2004 7:03:58 am
When adding a new date field datatype to a class, the default value can either be 'Empty' or 'Current Date'. Is is possible to add to this list, adding for example 'One year ahead'?
Eirik Alfstad Johansen
Tuesday 20 January 2004 7:22:13 am
Hi Barney,
> Is is possible to add to this list, adding for example 'One year ahead'?
Probably not without modifying the datatype itself (and thereby, the kernel). I suggest creating your own datatype using the date datatype as a starting point. Extending the datatype to handle dates one year from now probably won't be to hard (and if you run into problems, you can always post a question here).
Sincerely,
Eirik Johansen
Sincerely, Eirik Alfstad Johansen http://www.netmaking.no/
Balazs Halasy
Tuesday 20 January 2004 7:32:06 am
Yeah, this would be easy to do. Simply copy the original date datatype, create an extension and implement your custom date datatype such that it also gives the possibility to do 1 day/month/year ahead/behind, etc. Couple lines of PHP should take care of this. Refer to http://ez.no/developer/ez_publish_3/documentation/development/extensions/datatypes/new_datatype_ for info about creating the datatype.
Balazs
Tuesday 20 January 2004 8:27:21 am
Thanks guys, that's enough info to give me a good start! Lightning speed support yet again ;o)