phpgroupware-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-tracker] [bugs #8315] Function convertDate in class.dateti


From: Dave Hall
Subject: [Phpgroupware-tracker] [bugs #8315] Function convertDate in class.datetime.inc.php does not work with the d-M-Y format that can selected in Preferences
Date: Sat, 01 May 2004 05:33:04 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040405 Firefox/0.8

This mail is an automated notification from the bugs tracker
 of the project: phpGroupWare.

/**************************************************************************/
[bugs #8315] Latest Modifications:

Changes by: 
                Dave Hall <address@hidden>
'Date: 
                Sat 05/01/04 at 09:32 (Australia/Melbourne)

            What     | Removed                   | Added
---------------------------------------------------------------------------
          Resolution | Works for me              | Fixed
              Status | Open                      | Closed







/**************************************************************************/
[bugs #8315] Full Item Snapshot:

URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=8315>
Project: phpGroupWare
Submitted by: Alan Oshry
On: Fri 03/26/04 at 20:43

Category:  API - phpGWapi
Item Group:  0.9.16.000 release
Severity:  5 - Average
Priority:  7 - High
Resolution:  Fixed
Assigned to:  skwashd
Status:  Closed
Component Version:  CVS
Platform Version:  MS Windows
Reproducibility:  Every Time


Summary:  Function convertDate in class.datetime.inc.php does not work with the 
d-M-Y format that can selected in Preferences

Original Submission:  The function works like this, and returns the new 
formatted date:

convertDate($date, $dateFormat, $newFormat)

The function does this by finding the seperator used to seperate month, day, 
and year. Then builds an array of the month day values, and maps each value to 
the d/m/y format of the date passed.

For Example: Array ( [d] => 26 [m] => 03 [Y] => 2005 )

Then it finds the seperator of the format that you want the date to output the 
date to. Then builds an array of the month/day/year new format

And ultimately builds the new formmated date by starting from the order of the 
desired format, and matching the first value key with the old formmated value 
key.

An Example of what would make it not work:

convertDate('30-Mar-2004', 'd-M-Y', 'm-d-Y')

The passed date, turns into this:
For Example: Array ( [d] => 30 [M] => Mar [Y] => 2004 )

Notice how month is formmated as 'M' in the old format, and 'm' in the new 
format. At the end of the function when its building the end array that puts 
the old formmated date into the new formmated date, it looks for the 'm', but 
it cant find it, and returns a blank.

So the outcome will be: /30/2004

d-M-Y is the only dateformat Preference that is different than the rest because 
it has the 'M' instead of 'm'.

I am not sure what the best way to fix this is, but thought I would explain 
what is happening.

- scibe

Follow-up Comments
------------------


-------------------------------------------------------
Date: Wed 03/31/04 at 22:50         By: scibe
Thanks skwashd!, this fixed the problem.

-------------------------------------------------------
Date: Tue 03/30/04 at 06:28         By: skwashd
I am about to upload a patch, scibe if you can test it, then I will commit it.

Cheers

-------------------------------------------------------
Date: Sun 03/28/04 at 20:17         By: skwashd
I had this isssue in another app.  I know a fix for it.  I will look into 
fixing it.

-------------------------------------------------------
Date: Sat 03/27/04 at 02:20         By: None
The month name is not the issue, the code assembles the new date format by 
using the key, not the value. What makes it break is if any of the keys do not 
match the output keys. A developer using this function would need to know the 
format coming in, to prepare a proper output format that will work correctly. 
Since d-M-Y is the only dateformat preference that is unlike the others with 
the naming of the keys, it makes it difficult to know in advance to look for a 
d,m,Y combination, or a d,M,Y combination without editing the function itself 
to handle either one.

-------------------------------------------------------
Date: Sat 03/27/04 at 01:47         By: None
The month name is not the issue, the code assembles the new date format by 
using the key, not the value. What makes it break is if any of the keys do not 
match the output keys. A developer using this function would need to know the 
format coming in, to prepare a proper output format that will work correctly. 
Since d-M-Y is the only dateformat preference that is unlike the others with 
the naming of the keys, it makes it difficult to know in advance to look for a 
d,m,Y combination, or a d,M,Y combination without editing the function itself 
to handle either one.

-------------------------------------------------------
Date: Fri 03/26/04 at 22:35         By: powerstat
Assuming that the month name is language dependend this is not trivial. Best 
solution would be to parse the given date into a timestamp and then return the 
new string by converting the timestamp (with strftime() for example).
The problem is still language depending parsing of the incoming string 
(strtotime() will NOT work here because it can not handle other 
formats/lnguages).


-------------------------------------------------------
Date: Fri 03/26/04 at 20:53         By: cboettger
This might be something for Powerstat to fix ...






CC List
-------

CC Address                          | Comment
------------------------------------+-----------------------------
khofmann --AT-- probusiness --DOT-- de | Powerstat may be able to help



File Attachments
-------------------

-------------------------------------------------------
Date: Tue 03/30/04 at 06:34  Name: class.datetime_fix.diff  Size: 1KB   By: 
skwashd
fix typo in patch
http://savannah.gnu.org/bugs/download.php?item_id=8315&amp;item_file_id=1142






For detailed info, follow this link:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=8315>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/







reply via email to

[Prev in Thread] Current Thread [Next in Thread]