[Typo3] dates before 1970? + _EREG special mode in backend fields?
kho at gmx.at
Sun Mar 27 18:45:02 CEST 2005
I want to add a "birth date" field to my extension that handles dates before
Initially, I tried to set "eval" to "date" in the config array of the input
field (in ext_tables.php of my extension), but dates before 1970 were
removed and overwritten with the current year.
Played around with "upper" and "lower" as mentioned in core API  under
['columns'][fieldname]['config'] / TYPE: "input", but no effect - php
mktime() allows only years>=1970; using negative numbers for the
corresponding unix epoch did not work, either.
Browsing the sources, I found the reason for this behaviour - it's
implemented like that ;-) for the type "date" in the
t3lib/jsfunc.evalfield.js: function evalFunc_input(). I guess the limit
1970 <= date <= 2038 is to stay platform independent? - ref. quote from PHP
date() function documentation "On Windows this range is limited from
01-01-1970 to 19-01-2038."
I want to be able to enter either YYYY-MM-DD (like ISO8601) or if possible
also DD.MM.YYYY (german locale) that gets reformatted to YYYY-MM-DD
automatically after the input field looses focus (and thus also before data
is written to SQL database); and all that with years _not_ limited to unix
epoch range (1970 <= date <= 2038).
1.) as a quick-hack I tried to add a new type "dateiso8601" to
t3lib/jsfunc.evalfield.js: function evalFunc_input(). This works in
principle, but is just executed when I press on the "Save" button in the
Backend, so that's too late. And I want to avoid changing typo3 sources if
not _really_ necessary ;-)
Is the validation that is done immediately after leaving the input field
implemented in t3lib/jsfunc.validateform.js, function validateForm()? How
can I use the "_EREG" special mode for a backend form field, then?
Grepping through the sources I saw that validateForm() is just called in
class.tslib_content.php, and documentation  just mentions
2.) or is there a more smooth and elegant way how to do that - which I have
missed in my query? Maybe I can attach a userFunction that validates and
maybe reformats the input string that is enter as a custom-format date
(e.g. ISO8601 date: YYYY-MM-DD)?
Any help is appreciated,
Klaus Holler <gmx.at after kho@>
More information about the TYPO3-english