21
Roby73
Re: Problem with news1.66 and xoops 2.5
  • 2011/12/15 23:28

  • Roby73

  • Friend of XOOPS

  • Posts: 262

  • Since: 2011/6/15


Thanks Trabis.
I deleted all caches but i not resolved the problem.

I checked all files with checksum.php and all are ok.

What are all files that manage the date? calendar.js only?




22
Roby73
Re: Problem with news1.66 and xoops 2.5
  • 2011/12/18 2:37

  • Roby73

  • Friend of XOOPS

  • Posts: 262

  • Since: 2011/6/15


I have installed 2 version of xoops.
2.5.1a and 2.5.4, only core and news module.

All configuration date is "j/n/Y"

In 2.5.1a the date visible is as in fig:
Resized Image

and when submit the date is:
Resized Image

all is ok,

But in core 2.5.4
visible date is:
Resized Image

But when submit news the date is wrong mm/dd/yyyy
...in this case is 12/12/2011, sorry for the foto, but if es. 10/12/2011 when submit is 12/10/2011, or 1/1/1970 if mounth is > 12.


23
pgroell
Re: Problem with news1.66 and xoops 2.5
  • 2011/12/18 8:13

  • pgroell

  • Just popping in

  • Posts: 20

  • Since: 2005/4/3 1


Hello,
I have the same problem.
The workaround I found is to publish the article with the "Approved" box not selected, then go to admin side, open the unapproved article (which now has the correct date) and then approve it.
May be it can help you track down the problem.
Regards

24
Roby73
Re: Problem with news1.66 and xoops 2.5
  • 2011/12/19 3:23

  • Roby73

  • Friend of XOOPS

  • Posts: 262

  • Since: 2011/6/15


Thanks, I'm happy to not be the only one with this problem.
But this is not a permanent solution.

The module is impossible to use from moderators... The module or calendar core must be fixed.
how?



25
Roby73
Re: Problem with news1.66 and xoops 2.5
  • 2011/12/22 0:58

  • Roby73

  • Friend of XOOPS

  • Posts: 262

  • Since: 2011/6/15


I try another time to resolve this bug with date dd/mm/yyyy.
The file calendar.js and formtextdateselect.php don't are compatible with Italan date.
If modify this files with 2.5.1 the date are correct.

26
trabis
Re: Problem with news1.66 and xoops 2.5
  • 2011/12/23 19:14

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


:(
I have finally understood the problem.
Modules use strtotime() to convert the string 01/06/2000 to a unix timestamp.

Please read:
http://php.net/manual/en/function.strtotime.php
Quote:
Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed.

To avoid potential ambiguity, it's best to use ISO 8601 (YYYY-MM-DD) dates or DateTime::createFromFormat() when possible.


The problem is that php does not know if 01 is the day or the month! It assumes that if the string uses '/' the 01 is the month. If you use '-' then it will assume that the 01 is the day.

Quote:

The best way to compensate for this is by modifying your joining characters. Forward slash (/) signifies American M/D/Y formatting, a dash (-) signifies European D-M-Y and a period (.) signifies ISO Y.M.D.


I cannot say it is a core or a module bug, it is just the way php works.

You can fix your problem by editing language/yourlanguage/global.php and change
define('_SHORTDATESTRING', 'd/m/Y');
into
define('_SHORTDATESTRING', 'd-m-Y');

27
Roby73
Re: Problem with news1.66 and xoops 2.5
  • 2011/12/23 21:59

  • Roby73

  • Friend of XOOPS

  • Posts: 262

  • Since: 2011/6/15


Thanks trabis!!!
I have read the article.

For not modify date format, i add funcion in news module (include/functions.php):

function convert_date($date)  
{
    if (
strpos(_SHORTDATESTRING"/")) 
    {
    
$date=str_replace("/""-"$date);
    }
    return 
strtotime($date);
}


And i modify all strtotime in submit.php with convert_date.
Now work

Thank you!!

Are not possible resolve the problem in the core?
In italian's sites the date format normally are d/n/y. Is not problem use separator "-", but would be better able to choose preferred date.


28
Marco
Re: Problem with news1.66 and xoops 2.5
  • 2012/1/4 21:12

  • Marco

  • Home away from home

  • Posts: 1256

  • Since: 2004/3/15


@trabis
Quote:

You can fix your problem by editing language/yourlanguage/global.php and change
define('_SHORTDATESTRING', 'd/m/Y');
into
define('_SHORTDATESTRING', 'd-m-Y');

you imagine we have to change all translation for all modules, depending on the version of xoops we use?
it's perhaps time to fix this in the core, xoops 2.5.4 is more than 2 months old , now.
thanks
marco
Do synergy or die.

29
Mamba
Re: Problem with news1.66 and xoops 2.5
  • 2012/1/5 7:21

  • Mamba

  • Moderator

  • Posts: 11391

  • Since: 2004/4/23


Quote:
you imagine we have to change all translation for all modules, depending on the version of xoops we use?

Please re-read exactly what Trabis said.
You're jumping to totally wrong conclusion!
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

30
jjdai
Re: Problem with news1.66 and xoops 2.5
  • 2012/1/5 8:37

  • jjdai

  • Just popping in

  • Posts: 25

  • Since: 2006/6/17


Hello
I think it's not
Quote:
define('_SHORTDATESTRING', 'd-m-Y');

but
Quote:
define('_SHORTDATESTRING', 'Y-m-d');


And why not correct the file global.php directly in the french distribution ?

JJDai




Login

Who's Online

351 user(s) are online (112 user(s) are browsing Support Forums)


Members: 0


Guests: 351


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits