birthday subtracts one day

Mod that adds a birthday field to the users profile, theire age are displayed beside the posts, and on there birthday they will have a greeting popup
Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

Postby madnessmotors on Sun 04. Jan, 2004 20:29

Dragonfire's fix seems to have fixed it perfectly.
madnessmotors
Poster
Poster
 
Posts: 16
Joined: Fri 03. Oct, 2003 18:57

Postby madnessmotors on Thu 22. Jan, 2004 10:03

DragonFire*_* wrote:New development. The fix listed in the first thread doesn't work when daylight savings switches back in the fall :?

Ok, found out the issue (even with latest release as of this posting).

Open include/functions.php
Find:
Code: Select all
if ($birth_year>1970)
      $epoch=$epoch+$epoch_Y*365-1+$leapyear;
   else
      $epoch=$epoch-$epoch_Y*365-1-$leapyear;
   return $epoch;

Change to:
Code: Select all
if ($birth_year>1970)
      $epoch=$epoch+$epoch_Y*365+$leapyear;
   else
      $epoch=$epoch-$epoch_Y*365-1-$leapyear;
   return $epoch;


The two epoch lines are the same. If your birthyear is >1970, it still subtracts 1. It should just use the epoch date as is.

Hope this helps.


This was working for me, now it's adding a day.
madnessmotors
Poster
Poster
 
Posts: 16
Joined: Fri 03. Oct, 2003 18:57

Problem with Round() function in certain versions of PHP

Postby crinrict on Sun 18. Apr, 2004 21:19

I think I found a solution to the problem. It seems that the round() function used in mkrealdate() does not always do what one expects. round(0.6) equals in 0 instead of 1 (at least in version 4.3.3 of php).

The following fix sovled the problem for me:
Code: Select all
   
  //$leapyear=round((($epoch_Y+2) / 4)-0.5);

  $leapyear=(($epoch_Y+2) / 4)-0.5;
  If ($leapyear-floor($leapyear) >= 0.5)
  {
   $leapyear = floor($leapyear)+1;
  }
  else
  {
   $leapyear = floor($leapyear);
  }
crinrict
Poster
Poster
 
Posts: 37
Joined: Sun 18. Apr, 2004 00:25
Location: Switzerland

Postby Seijin_Dinger on Fri 09. Jul, 2004 18:37

it displays the birthday on the calandar correctly for me, it just sends the popup 1 day early
Seijin_Dinger
Poster
Poster
 
Posts: 5
Joined: Mon 05. Apr, 2004 21:42

Postby Metallicheck on Sun 21. Nov, 2004 17:44

It seems like I've got this problem after setting DST at my hosting which runs at:
Linux kernel 2.4.20-30.9
Apache 1.3.33
PHP 4.3.9
mySQL 4.0.22-standard

I've tried the following fixes:
Code: Select all
   if ($birth_year>1970)
      $epoch=$epoch+$epoch_Y*365+$leapyear;
   else
      $epoch=$epoch-$epoch_Y*365-$leapyear;
   return $epoch;


Code: Select all
   
  //$leapyear=round((($epoch_Y+2) / 4)-0.5);
 
  $leapyear=(($epoch_Y+2) / 4)-0.5;
  If ($leapyear-floor($leapyear) >= 0.5)
  {
   $leapyear = floor($leapyear)+1;
  }
  else
  {
   $leapyear = floor($leapyear);
  }


and
Code: Select all
function realdate($date_syntax="Ymd",$date=0)
{ return create_date($date_syntax,$date*86400,$board_config['board_timezone']); }


But none of those help. At the same time everything works fine at my Windows localhost.

I have just phpBB 2.0.11 and Birthday 1.5.7, no more mods.
Metallicheck
Poster
Poster
 
Posts: 2
Joined: Mon 23. Dec, 2002 23:43

Postby gurlzlubme on Mon 22. Nov, 2004 06:26

I just noticed that I'm experiencing this as well.

I just installed this mod, and everything seems to work okay, except the correct reflection of when my birthday is.

I changed my birthdate to November 21 (the current time and date is 8:30pm pacific 11/21, which is also the setting on my board), and I didn't see my birthdate reflected at the bottom of the index.

Then I changed my birthdate to the 22nd and now it's showing my name under "Today's birthdays"

running 2.0.10
gurlzlubme
Poster
Poster
 
Posts: 29
Joined: Wed 03. Nov, 2004 07:10

Postby coolsmurf on Thu 29. Sep, 2005 04:16

thanks for the fix, it was bugging me a lot! 8)
coolsmurf
Poster
Poster
 
Posts: 1
Joined: Thu 29. Sep, 2005 04:07

Previous

Return to Birthday [2.0.10/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron