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
|