Display date as today if no articles published
On "The Daily Shaarli" page (index.php?do=daily), the date is "Tuesday 30, November 1999" if no articles have been published/shared. This patch checks the parameter ($linkdate) before the mktime call to prevent and generate the "day 0" string. mktime(0,0,0,0,0,0) returns 943916400 (hum?)
This commit is contained in:
parent
569ffb59d4
commit
f5b059254f
1 changed files with 6 additions and 3 deletions
|
@ -555,9 +555,12 @@ function endsWith($haystack,$needle,$case=true)
|
||||||
PS: I could have used strptime(), but it does not exist on Windows. I'm too kind. */
|
PS: I could have used strptime(), but it does not exist on Windows. I'm too kind. */
|
||||||
function linkdate2timestamp($linkdate)
|
function linkdate2timestamp($linkdate)
|
||||||
{
|
{
|
||||||
$Y=$M=$D=$h=$m=$s=0;
|
if(strcmp($linkdate, '_000000') !== 0 || !$linkdate){
|
||||||
sscanf($linkdate,'%4d%2d%2d_%2d%2d%2d',$Y,$M,$D,$h,$m,$s);
|
$Y=$M=$D=$h=$m=$s=0;
|
||||||
return mktime($h,$m,$s,$M,$D,$Y);
|
$r = sscanf($linkdate,'%4d%2d%2d_%2d%2d%2d',$Y,$M,$D,$h,$m,$s);
|
||||||
|
return mktime($h,$m,$s,$M,$D,$Y);
|
||||||
|
}
|
||||||
|
return time();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Converts a linkdate time (YYYYMMDD_HHMMSS) of an article to a RFC822 date.
|
/* Converts a linkdate time (YYYYMMDD_HHMMSS) of an article to a RFC822 date.
|
||||||
|
|
Loading…
Reference in a new issue