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.datet


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: Sun, 28 Mar 2004 15:17:38 -0500
User-agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.6) Gecko/20040113

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: 
                Sun 03/28/04 at 20:17 (Australia/Melbourne)

------------------ Additional Follow-up Comments ----------------------------
I had this isssue in another app.  I know a fix for it.  I will look into 
fixing it.






/**************************************************************************/
[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:  None
Assigned to:  skwashd
Status:  Open
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: 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









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]