Old dates (Pre 1900) not showing in List
Archived from the Xataface Users forum.
lemon dexter — Tue Nov 20, 2012 3:12 am
I am using Xataface for storing thousands of records relating to family history, which by their nature have old dates.
I’m finding that Xataface will not display dates before 1900 (actually 1902, for some reason), which is the majority of records! I have a field set as DATE format in the MySQL database and I would simply like that to be sortable in list view. Plus being able to do date range searches in find. The new datepicker module works really well for this in edit, but list and browse views are not working.
I’ve found I can get around this by overriding it using a display function in my table’s delegate class, however this seems to slow up fetching records quite a lot.
Does anyone know of a fix for this please?
shannah — Tue Nov 20, 2012 9:09 am
Hmm.. Sounds like there may be a bug with the default date formatting functions. I have added this to the issue tracker.
http://bugs.weblite.ca/view.php?id=1191
Your solution of a custom display method is the best workaround I can think of until it is fixed. Simply implementing a custom display() method for the field shouldn’t slow the app down. Can you post the contents of your display method?
-Steve
lemon dexter — Wed Nov 21, 2012 2:46 am
Thanks Steve.
Just converting to a string, but keeping the YYYY-mm-dd format so I can sort.
….
function Numeric_Date__display($record, $el){
$val = $record->strval(‘Numeric_Date’);
return $val;
}
….
There are 4,112 records in this particular table, but quite a few more in others, so I can’t afford too many workarounds!
lemon dexter — Fri Jan 04, 2013 10:46 am
Just an update to this:
Having uploaded to a live server (using slightly different PHP and mySQL versions) I’m now getting all dates/years showing, but now getting inconsistency of behaviours over display formats. Datepicker still works fine, but when enabled its ‘widget:dateFormat’ has no effect, whereas the standard ‘date_format’ works OK!
So happy for the time-being as working on live site is obviously preferred. Just wondering about effect of PHP versions as I’ve seen reports about some problems with old dates and deprecated formats?
shannah — Sun Jan 06, 2013 10:49 am
What version of PHP is on the live server, and what version of PHP was on the dev server?
lemon dexter — Tue Jan 08, 2013 3:54 am
Here we go:
Live:
mySQL: 5.1.66-cll
PHP: 5.3.16
Dev:
mySQL: 5.0.8-dev
PHP: PHP: 5.3.8