php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22549 Date/Calc.php, beginOfWeek() fails, easier implementations
Submitted: 2003-03-05 07:35 UTC Modified: 2003-05-25 14:47 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: andreas dot kossmeier at bergfex dot at Assigned: pajoye (profile)
Status: Closed Package: PEAR related
PHP Version: 4.3.1 OS: Debian Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: andreas dot kossmeier at bergfex dot at
New email:
PHP Version: OS:

 

 [2003-03-05 07:35 UTC] andreas dot kossmeier at bergfex dot at
Date/Calc.php

this bug report describes various bugs and issues for calculating begin and end of week (including implementation of beginOfNextWeek and beginOfPreviousWeek)

- endOfWeek()
fails, if date *is* end of the week

- beginOfWeek()
much easier implementation (1 vs. 11 lines of code)

- beginOfNextWeek(), beginOfPreviousWeek()
failing, if date is end of the week

both functions use their own implementation for getting the beginning of a week, but *should* use Date_Calc::beginOfWeek()

A diff (including fix for Bug #22548) to CVS Version 1.9 is available at http://bergfex.at/php/pear/Calc.php.diff.txt

Andreas Kossmeier

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-31 09:31 UTC] andreas dot kossmeier at bergfex dot at
errors only occure if DATE_CALC_BEGIN_WEEKDAY is 0 (default: 1):

20030317 Monday:
endOfWeek()       CVS: 20030323 fixed: 20030323
beginOfWeek()     CVS: 20030317 fixed: 20030317
beginOfNextWeek() CVS: 20030324 fixed: 20030324
beginOfPrevWeek() CVS: 20030310 fixed: 20030310

20030320 Thursday:
endOfWeek()       CVS: 20030323 fixed: 20030323
beginOfWeek()     CVS: 20030317 fixed: 20030317
beginOfNextWeek() CVS: 20030324 fixed: 20030324
beginOfPrevWeek() CVS: 20030310 fixed: 20030310

20030323 Sunday:
endOfWeek()       CVS: 20030330 fixed: 20030323
beginOfWeek()     CVS: 20030317 fixed: 20030317
beginOfNextWeek() CVS: 20030331 fixed: 20030324
beginOfPrevWeek() CVS: 20030317 fixed: 20030310
 [2003-03-31 09:33 UTC] andreas dot kossmeier at bergfex dot at
correction:
errors only occure if DATE_CALC_BEGIN_WEEKDAY is 1 (default)
 [2003-04-27 15:51 UTC] lsmith@php.net
ok I have just confirmed the bugs and that the diff seems to work. However because this date handling is constantly confusing me I rather put up my test script for now.

http://www.backendmedia.com/Date/Calc_new.phps
http://www.backendmedia.com/Date/dayofweek_test.phps
 [2003-04-28 04:05 UTC] arnaud@php.net
IIRC pierre like Date :)
 [2003-05-25 14:47 UTC] pajoye@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 04:01:27 2024 UTC