Forums / General / General Problem with ezdate before 1970?

General Problem with ezdate before 1970?

Author Message

Norman Leutner

Monday 25 September 2006 1:12:09 am

I have a user attribute birthdate (ezdate).

If a user tries to register with a date before 01.01.1970 he gets a error:
"Date not valid"

This seems to be a general problem with the datatype in combination with the time function.

Does anybody have a workaround for me how to fix this?

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

Norman Leutner

Monday 25 September 2006 1:25:16 am

/ezp383/lib/ezutils/classes/ezdatetimevalidator.php

    function validateDate( $day, $month, $year )
    {
        $check = checkdate( $month, $day, $year );
        $datetime = mktime( 0, 0, 0, $month, $day, $year );
        if ( !$check or
             $year < 1970 or
             $datetime === false )
        {
            return EZ_INPUT_VALIDATOR_STATE_INVALID;
        }
        return EZ_INPUT_VALIDATOR_STATE_ACCEPTED;
    }

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

Norman Leutner

Monday 25 September 2006 1:35:26 am

Ok,
I think I'll need to split the birthdate into three servel integer fields.

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

Paul Forsyth

Monday 25 September 2006 1:36:18 am

its a general php problem. php 4 doesnt handle timestamps before 1970. have a google around for this.

if you want to hack the php you may be able to have negative timestamps and write some code to interpret this. if you look on the php.net/strtotime comments you'll find people with similar issues and workaround.

i believe php5 handles the negative timestamps more gracefully than php4...

paul

Xavier Dutoit

Monday 25 September 2006 1:54:32 am

Hi,

Have a look at the birthday datatype in the contrib:
http://ez.no/community/contribs/datatypes/birthday_datatype

Haven't tested with a recent ez version.

X+

http://www.sydesy.com

Paul Forsyth

Monday 25 September 2006 1:57:06 am

Good spot Xavier, I completely forgot about that extension.

I wrote my own the other day to do something similar :(

Paul

Norman Leutner

Monday 25 September 2006 2:20:05 am

Thanks for you help,
I installed the extension and added the GregorianToJD function.

Works fine.

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

Xavier Dutoit

Monday 25 September 2006 5:10:11 am

Hi,

I think that's a problem in general: that's hard to find extensions in the contrib and everyone re do the same things (see the countries ones), then ez develop something similar on its own.

I'd help if the contrib could be made more visible in the documentation...

X+

http://www.sydesy.com

Xavier Dutoit

Monday 25 September 2006 5:12:32 am

@Paul,

The other thing is that even if Guiness is good for you, it doesn't help for the memory ;)

X+

http://www.sydesy.com

eZ debug

Timing: Jan 31 2025 00:21:50
Script start
Timing: Jan 31 2025 00:21:50
Module start 'content'
Timing: Jan 31 2025 00:21:50
Module end 'content'
Timing: Jan 31 2025 00:21:51
Script end

Main resources:

Total runtime0.1795 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 587.9453370.2969
Module start 'content' 0.00730.0151 958.24221,013.6563
Module end 'content' 0.02240.1570 1,971.89843,901.9141
Script end 0.1794  5,873.8125 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00402.2477200.0002
Check MTime0.00130.7148200.0001
Mysql Total
Database connection0.00080.423910.0008
Mysqli_queries0.086147.96011410.0006
Looping result0.00110.62281390.0000
Template Total0.156687.210.1566
Template load0.00070.416110.0007
Template processing0.155986.823210.1559
Override
Cache load0.00050.291910.0005
Sytem overhead
Fetch class attribute can translate value0.00170.920810.0017
XML
Image XML parsing0.00030.151410.0003
General
dbfile0.00894.9467200.0004
String conversion0.00000.002930.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.0001 secs