Forums / Developer / "date" attribute limited 1970

"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 :)

eZ debug

Timing: Jan 20 2025 23:39:25
Script start
Timing: Jan 20 2025 23:39:25
Module start 'content'
Timing: Jan 20 2025 23:39:25
Module end 'content'
Timing: Jan 20 2025 23:39:25
Script end

Main resources:

Total runtime0.1500 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0085 587.7188180.8359
Module start 'content' 0.00850.0069 768.554797.8672
Module end 'content' 0.01540.1345 866.4219526.8047
Script end 0.1499  1,393.2266 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00352.3387200.0002
Check MTime0.00140.9073200.0001
Mysql Total
Database connection0.00130.851110.0013
Mysqli_queries0.103368.83171410.0007
Looping result0.00140.91751390.0000
Template Total0.134189.410.1341
Template load0.00100.664510.0010
Template processing0.133188.715410.1331
Override
Cache load0.00060.410410.0006
Sytem overhead
Fetch class attribute can translate value0.00070.497210.0007
XML
Image XML parsing0.00040.284610.0004
General
dbfile0.00281.8769200.0001
String conversion0.00000.004430.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs