"date" attribute limited 1970

Author Message

Santi Castells

Friday 19 October 2007 4:55:48 am

For one of our projects we have created a form which includes the "date" attribute in order to verify the date of birth of the user. However, we have realised that the "date" attribute is limited from the year 1970 and later. We need to introduce a new user who is born before that date (1964) but it reports an error "invalid date" and it doesn't save the info introduced in the form.

Manually we have changed the kernel of ez. first we have found the files which were controlling the "date" attribute (the following ones)...

kernel/classes/datatypes/ezdatetime/ezdatetimetype.php
kernel/classes/datatypes/ezdate/ezdatetype.php
lib/ezutils/classes/ezdatetimevalidator.php

Then we have changed the 1970 into an earlier date (1950).

The question is if this change will be affecting to the normal performance of eZ.

André R.

Friday 19 October 2007 5:08:27 am

This is a limitation in the date handling in php, it should be fixed in php 5, so it should in theory work on eZ Publish 4.0 (but I havn't personally tested this yet).

Alternative is to use the birthday-datatype:
http://ez.no/developer/contribs/datatypes/birthday_datatype

Most uptodate version is here:
http://svn.ez.no/svn/extensions/birthday_datatype/

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Santi Castells

Friday 19 October 2007 5:27:06 am

Thanks for your help.

Do you know if the manual change i have made on the kernel will be affecting negatively to the performance of ez? the thing is that the templates are already done with the "date" attribute and i would have to change quite a many if i wanna change the attribute type.

André R.

Friday 19 October 2007 5:43:02 am

Probably not.
But have you tested saving dates prior to 1970 after the kernel hack?
If so, what php version are you on?

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Santi Castells

Friday 19 October 2007 5:52:15 am

I changed it already and the specifically form works well, but don't know about general perfomance.
My php version is 4.4.7.

Thanks

Laurent BOURREL

Friday 19 October 2007 6:04:13 am

Hi,

I think it would be better to use a custom datatype than to modify the kernel...

For example :
http://ez.no/developer/contribs/datatypes/birthday_datatype

UPDATE : Oups, didn't see that the contrib was already posted, sorry guys :)

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 01:05:04
Script start
Timing: Jan 19 2025 01:05:04
Module start 'layout'
Timing: Jan 19 2025 01:05:04
Module start 'content'
Timing: Jan 19 2025 01:05:05
Module end 'content'
Timing: Jan 19 2025 01:05:05
Script end

Main resources:

Total runtime0.7389 sec
Peak memory usage4,096.0000 KB
Database Queries68

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 590.2734152.6250
Module start 'layout' 0.00530.0048 742.898439.4453
Module start 'content' 0.01010.7274 782.3438605.6250
Module end 'content' 0.73760.0013 1,387.968816.1641
Script end 0.7389  1,404.1328 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.4791160.0002
Check MTime0.00140.1944160.0001
Mysql Total
Database connection0.00060.081710.0006
Mysqli_queries0.672791.0435680.0099
Looping result0.00090.1213660.0000
Template Total0.694794.020.3474
Template load0.00210.279520.0010
Template processing0.692693.740520.3463
Template load and register function0.00020.029210.0002
states
state_id_array0.00090.127610.0009
state_identifier_array0.00070.095520.0004
Override
Cache load0.00180.2398350.0001
Sytem overhead
Fetch class attribute can translate value0.00090.118830.0003
Fetch class attribute name0.00140.183870.0002
XML
Image XML parsing0.00100.134730.0003
class_abstraction
Instantiating content class attribute0.00000.003380.0000
General
dbfile0.00710.9564170.0004
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 26
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs