XoopsModules25x / news

With this XOOPS module, you can create an unlimited number of news on your site. You can create all the articles you want and attach them to topics.
4 stars 11 forks source link

date problem #8

Closed orwah closed 8 years ago

orwah commented 8 years ago

Hi if date format are changed for xoops (which is usual for some language) in xoops/language/global.php: define('_DATESTRING', 'Y/m/d G:i:s'); define('_MEDIUMDATESTRING', 'Y/m/d G:i'); define('_SHORTDATESTRING', 'y/n/j');

if we edit a news item ,then it's publish_date go back to 1/1/1970 !

reason: in submit.php line 338 $publish_date = $_POST['publish_date']; $pubdate = strtotime($publish_date['date']) + $publish_date['time'];

the date is saved in db in formated y/n/j mode , so when strtotime try to decode it , it fails and return default 1/1/1970

maybe something like $publish_date = date_create_from_format($dateformat,$_POST['publish_date']); or whatever

the only formate string work is m/d/Y because we show date fields as formated date string, but when we save it in db we must specify format string before saving it or use strtotime. or it will try to decode it using m/d/Y